[virglrenderer-devel] [PATCH] shader: fix passing sampleid into interpolateAtSample

Dave Airlie airlied at gmail.com
Mon Jun 18 21:26:05 UTC 2018


From: Dave Airlie <airlied at redhat.com>

Fixes some of the
KHR-GL44.shader_multisample_interpolation.* fails.
---
 src/vrend_shader.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 2f342a4..0d81033 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -3006,9 +3006,12 @@ get_source_info(struct dump_ctx *ctx,
                    ctx->system_values[j].name == TGSI_SEMANTIC_PRIMID ||
                    ctx->system_values[j].name == TGSI_SEMANTIC_VERTICESIN ||
                    ctx->system_values[j].name == TGSI_SEMANTIC_INVOCATIONID ||
-                   ctx->system_values[j].name == TGSI_SEMANTIC_SAMPLEID)
-                  snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", get_string(stypeprefix), ctx->system_values[j].glsl_name);
-               else if (ctx->system_values[j].name == TGSI_SEMANTIC_TESSINNER ||
+                   ctx->system_values[j].name == TGSI_SEMANTIC_SAMPLEID) {
+		  if (inst->Instruction.Opcode == TGSI_OPCODE_INTERP_SAMPLE && i == 1)
+		     snprintf(srcs[i], 255, "ivec4(%s)", ctx->system_values[j].glsl_name);
+		  else
+		     snprintf(srcs[i], 255, "%s(vec4(intBitsToFloat(%s)))", get_string(stypeprefix), ctx->system_values[j].glsl_name);
+	       } else if (ctx->system_values[j].name == TGSI_SEMANTIC_TESSINNER ||
                         ctx->system_values[j].name == TGSI_SEMANTIC_TESSOUTER) {
                   snprintf(srcs[i], 255, "%s(vec4(%s[%d], %s[%d], %s[%d], %s[%d]))",
                            prefix,
-- 
2.14.3



More information about the virglrenderer-devel mailing list