summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-03-26 17:48:26 +1000
committerDave Airlie <airlied@redhat.com>2018-03-29 10:27:31 +1000
commitee13e4b9b7bcc72848de244bb6964493118968fb (patch)
tree19e0fe40bec888be246f23596daeb554f1472cb6
parent6aebabf36cddb90b4ff4f5796e5f6bfd8dac1b54 (diff)
shader: handle declaring fragment shader clip distance input.
We weren't always sizing this correctly, so size it properly now. Tested-by: Jakob Bornecrantz <jakob@collaboa.com>
-rw-r--r--src/vrend_renderer.c2
-rw-r--r--src/vrend_shader.c7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index d1be721..038a9dc 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -2127,7 +2127,7 @@ static inline void vrend_fill_shader_key(struct vrend_context *ctx,
if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY])
key->gs_present = true;
- if (type == PIPE_SHADER_GEOMETRY && ctx->sub->shaders[PIPE_SHADER_VERTEX]) {
+ if ((type == PIPE_SHADER_GEOMETRY || type == PIPE_SHADER_FRAGMENT) && ctx->sub->shaders[PIPE_SHADER_VERTEX]) {
key->prev_stage_pervertex_out = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.has_pervertex_out;
key->prev_stage_num_clip_out = ctx->sub->shaders[PIPE_SHADER_VERTEX]->sinfo.num_clip_out;
}
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 21717f1..a7afb83 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -2566,6 +2566,13 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
}
}
+ if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT && ctx->num_in_clip_dist) {
+ if (ctx->key->prev_stage_num_clip_out) {
+ snprintf(buf, 255, "in float gl_ClipDistance[%d];\n", ctx->key->prev_stage_num_clip_out);
+ STRCAT_WITH_RET(glsl_hdr, buf);
+ }
+ }
+
if (ctx->so) {
char outtype[6] = {0};
for (i = 0; i < ctx->so->num_outputs; i++) {