[virglrenderer-devel] [PATCH 2/3] shader: handle declaring fragment shader clip distance input.

Dave Airlie airlied at gmail.com
Mon Mar 26 21:20:59 UTC 2018


From: Dave Airlie <airlied at redhat.com>

We weren't always sizing this correctly, so size it properly now.
---
 src/vrend_renderer.c | 2 +-
 src/vrend_shader.c   | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

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++) {
-- 
2.14.3



More information about the virglrenderer-devel mailing list