[virglrenderer-devel] [PATCH 17/21] tessellation: handle reading from outputs.

Dave Airlie airlied at gmail.com
Mon Jun 11 05:11:08 UTC 2018


From: Dave Airlie <airlied at redhat.com>

Tessellation shaders can read back from outputs, so handle this.
---
 src/vrend_shader.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index e8de9d7..3613c15 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -2263,8 +2263,23 @@ get_source_info(struct dump_ctx *ctx,
                sinfo->override_no_wm[i] = ctx->inputs[j].override_no_wm;
                break;
             }
-      }
-      else if (src->Register.File == TGSI_FILE_TEMPORARY) {
+      } else if (src->Register.File == TGSI_FILE_OUTPUT) {
+         for (uint32_t j = 0; j < ctx->num_outputs; j++) {
+            if (ctx->outputs[j].first == src->Register.Index) {
+               enum vrend_type_qualifier srcstypeprefix = stypeprefix;
+               if (stype == TGSI_TYPE_UNSIGNED && ctx->outputs[j].is_int)
+                  srcstypeprefix = TYPE_CONVERSION_NONE;
+               if (ctx->outputs[j].glsl_gl_block) {
+                  /* GS input clipdist requires a conversion */
+                  if (ctx->outputs[j].name == TGSI_SEMANTIC_CLIPDIST) {
+                     create_swizzled_clipdist(ctx, srcs[i], src, ctx->outputs[j].sid, 1, get_string(stypeprefix), prefix, arrayname);
+                  }
+               } else {
+                  snprintf(srcs[i], 255, "%s(%s%s%s%s)", get_string(srcstypeprefix), prefix, ctx->outputs[j].glsl_name, arrayname, ctx->outputs[j].is_int ? "" : swizzle);
+               }
+            }
+         }
+      } else if (src->Register.File == TGSI_FILE_TEMPORARY) {
          struct vrend_temp_range *range = find_temp_range(ctx, src->Register.Index);
          if (!range)
             return FALSE;
-- 
2.14.3



More information about the virglrenderer-devel mailing list