[virglrenderer-devel] [PATCH] vrend: fix writemask/swizzle on conversion functions.

Dave Airlie airlied at gmail.com
Wed Feb 14 01:07:44 UTC 2018


From: Dave Airlie <airlied at redhat.com>

These weren't adding the writemask component selection properly,
 F2I TEMP[0].y, IN[1].xyyy
was getting incorrectly translated.

Fixes: dEQP-GLES2.functional.shaders.swizzles.vector_swizzles.*
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/vrend_shader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 420bc83..6e1517e 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -1937,19 +1937,19 @@ iter_instruction(struct tgsi_iterate_context *iter,
          return FALSE;
       break;
    case TGSI_OPCODE_I2F:
-      snprintf(buf, 255, "%s = %s(ivec4(%s));\n", dsts[0], dstconv, srcs[0]);
+      snprintf(buf, 255, "%s = %s(ivec4(%s)%s);\n", dsts[0], dstconv, srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_U2F:
-      snprintf(buf, 255, "%s = %s(uvec4(%s));\n", dsts[0], dstconv, srcs[0]);
+      snprintf(buf, 255, "%s = %s(uvec4(%s)%s);\n", dsts[0], dstconv, srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_F2I:
-      snprintf(buf, 255, "%s = %s(%s(ivec4(%s)));\n", dsts[0], dstconv, dtypeprefix, srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(ivec4(%s))%s);\n", dsts[0], dstconv, dtypeprefix, srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_F2U:
-      snprintf(buf, 255, "%s = %s(%s(uvec4(%s)));\n", dsts[0], dstconv, dtypeprefix, srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(uvec4(%s))%s);\n", dsts[0], dstconv, dtypeprefix, srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_NOT:
-- 
2.14.3



More information about the virglrenderer-devel mailing list