[virglrenderer-devel] [PATCH 1/3] shader: gather some destination info in a struct.

Dave Airlie airlied at gmail.com
Fri Jun 1 01:40:58 UTC 2018


From: Dave Airlie <airlied at redhat.com>

This will make adding doubles a bit easier.
---
 src/vrend_shader.c | 140 +++++++++++++++++++++++++++--------------------------
 1 file changed, 72 insertions(+), 68 deletions(-)

diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 19e5a4b..8068576 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -1213,11 +1213,11 @@ static int emit_clip_dist_movs(struct dump_ctx *ctx)
    return 0;
 }
 
-#define emit_arit_op2(op) snprintf(buf, 255, "%s = %s(%s((%s %s %s))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], op, srcs[1], writemask)
-#define emit_op1(op) snprintf(buf, 255, "%s = %s(%s(%s(%s))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), op, srcs[0], writemask)
-#define emit_compare(op) snprintf(buf, 255, "%s = %s(%s((%s(%s(%s), %s(%s))))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), op, get_string(svec4), srcs[0], get_string(svec4), srcs[1], writemask)
+#define emit_arit_op2(op) snprintf(buf, 255, "%s = %s(%s((%s %s %s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], op, srcs[1], writemask)
+#define emit_op1(op) snprintf(buf, 255, "%s = %s(%s(%s(%s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), op, srcs[0], writemask)
+#define emit_compare(op) snprintf(buf, 255, "%s = %s(%s((%s(%s(%s), %s(%s))))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), op, get_string(svec4), srcs[0], get_string(svec4), srcs[1], writemask)
 
-#define emit_ucompare(op) snprintf(buf, 255, "%s = %s(uintBitsToFloat(%s(%s(%s(%s), %s(%s))%s) * %s(0xffffffff)));\n", dsts[0], get_string(dstconv), get_string(udstconv), op, get_string(svec4), srcs[0], get_string(svec4), srcs[1], writemask, get_string(udstconv))
+#define emit_ucompare(op) snprintf(buf, 255, "%s = %s(uintBitsToFloat(%s(%s(%s(%s), %s(%s))%s) * %s(0xffffffff)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.udstconv), op, get_string(svec4), srcs[0], get_string(svec4), srcs[1], writemask, get_string(dinfo.udstconv))
 
 static int emit_buf(struct dump_ctx *ctx, const char *buf)
 {
@@ -1763,13 +1763,18 @@ create_swizzled_clipdist(struct dump_ctx *ctx,
    snprintf(result, 255, "%s(vec4(%s,%s,%s,%s))", stypeprefix, clipdistvec[0], clipdistvec[1], clipdistvec[2], clipdistvec[3]);
 }
 
+struct dest_info {
+  enum vrend_type_qualifier dtypeprefix;
+  enum vrend_type_qualifier dstconv;
+  enum vrend_type_qualifier udstconv;
+  bool dst_override_no_wm[2];
+};
+
 static int
 get_destination_info(struct dump_ctx *ctx,
                      const struct tgsi_full_instruction *inst,
-                     enum vrend_type_qualifier *dtypeprefix,
-                     enum vrend_type_qualifier *dstconv,
-                     enum vrend_type_qualifier *udstconv,
-                     bool dst_override_no_wm[2], char dsts[3][255],
+                     struct dest_info *dinfo,
+                     char dsts[3][255],
                      char *writemask)
 {
    const struct tgsi_full_dst_register *dst_reg;
@@ -1779,14 +1784,14 @@ get_destination_info(struct dump_ctx *ctx,
       ctx->shader_req_bits |= SHADER_REQ_INTS;
 
    if (inst->Instruction.Opcode == TGSI_OPCODE_TXQ) {
-      *dtypeprefix = INT_BITS_TO_FLOAT;
+      dinfo->dtypeprefix = INT_BITS_TO_FLOAT;
    } else {
       switch (dtype) {
       case TGSI_TYPE_UNSIGNED:
-         *dtypeprefix = UINT_BITS_TO_FLOAT;
+         dinfo->dtypeprefix = UINT_BITS_TO_FLOAT;
          break;
       case TGSI_TYPE_SIGNED:
-         *dtypeprefix = INT_BITS_TO_FLOAT;
+         dinfo->dtypeprefix = INT_BITS_TO_FLOAT;
          break;
       default:
          break;
@@ -1795,7 +1800,7 @@ get_destination_info(struct dump_ctx *ctx,
 
    for (uint32_t i = 0; i < inst->Instruction.NumDstRegs; i++) {
       dst_reg = &inst->Dst[i];
-      dst_override_no_wm[i] = false;
+      dinfo->dst_override_no_wm[i] = false;
       if (dst_reg->Register.WriteMask != TGSI_WRITEMASK_XYZW) {
          int wm_idx = 0;
          writemask[wm_idx++] = '.';
@@ -1808,11 +1813,11 @@ get_destination_info(struct dump_ctx *ctx,
          if (dst_reg->Register.WriteMask & 0x8)
             writemask[wm_idx++] = 'w';
 
-         *dstconv = FLOAT + wm_idx - 2;
-         *udstconv = UINT + wm_idx - 2;
+         dinfo->dstconv = FLOAT + wm_idx - 2;
+         dinfo->udstconv = UINT + wm_idx - 2;
       } else {
-         *dstconv = VEC4;
-         *udstconv = UVEC4;
+         dinfo->dstconv = VEC4;
+         dinfo->udstconv = UVEC4;
       }
 
       if (dst_reg->Register.File == TGSI_FILE_OUTPUT) {
@@ -1835,19 +1840,19 @@ get_destination_info(struct dump_ctx *ctx,
                   }
                   snprintf(dsts[i], 255, "%s[%d]", ctx->outputs[j].glsl_name, idx);
                   if (ctx->outputs[j].is_int) {
-                     *dtypeprefix = FLOAT_BITS_TO_INT;
-                     *dstconv = INT;
+                     dinfo->dtypeprefix = FLOAT_BITS_TO_INT;
+                     dinfo->dstconv = INT;
                   }
                } else {
                   snprintf(dsts[i], 255, "%s%s", ctx->outputs[j].glsl_name, ctx->outputs[j].override_no_wm ? "" : writemask);
-                  dst_override_no_wm[i] = ctx->outputs[j].override_no_wm;
+                  dinfo->dst_override_no_wm[i] = ctx->outputs[j].override_no_wm;
                   if (ctx->outputs[j].is_int) {
-                     if (*dtypeprefix == TYPE_CONVERSION_NONE)
-                        *dtypeprefix = FLOAT_BITS_TO_INT;
-                     *dstconv = INT;
+                     if (dinfo->dtypeprefix == TYPE_CONVERSION_NONE)
+                        dinfo->dtypeprefix = FLOAT_BITS_TO_INT;
+                     dinfo->dstconv = INT;
                   }
                   if (ctx->outputs[j].name == TGSI_SEMANTIC_PSIZE) {
-                     *dstconv = FLOAT;
+                     dinfo->dstconv = FLOAT;
                      break;
                   }
                }
@@ -2155,19 +2160,18 @@ iter_instruction(struct tgsi_iterate_context *iter,
                  struct tgsi_full_instruction *inst)
 {
    struct dump_ctx *ctx = (struct dump_ctx *)iter;
+   struct dest_info dinfo = { 0 };
    char srcs[4][255], dsts[3][255], buf[512];
    uint instno = ctx->instno++;
    int sreg_index = 0;
    char writemask[6] = {0};
    bool override_no_wm[3];
-   bool dst_override_no_wm[2];
    char *sret;
    int ret;
    char src_swizzle0[10];
    bool tg4_has_component = false;
 
-   enum vrend_type_qualifier dtypeprefix, dstconv, udstconv, svec4;
-   dtypeprefix = dstconv = udstconv = TYPE_CONVERSION_NONE;
+   enum vrend_type_qualifier svec4;
    svec4 = VEC4;
 
    if (ctx->prog_type == -1)
@@ -2186,7 +2190,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
          prepare_so_movs(ctx);
    }
 
-   ret = get_destination_info(ctx, inst, &dtypeprefix, &dstconv, &udstconv, dst_override_no_wm, dsts, writemask);
+   ret = get_destination_info(ctx, inst, &dinfo, dsts, writemask);
    if (ret)
       return FALSE;
 
@@ -2204,31 +2208,31 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_DP2:
-      snprintf(buf, 255, "%s = %s(dot(vec2(%s), vec2(%s)));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(dot(vec2(%s), vec2(%s)));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_DP3:
-      snprintf(buf, 255, "%s = %s(dot(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(dot(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_DP4:
-      snprintf(buf, 255, "%s = %s(dot(vec4(%s), vec4(%s)));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(dot(vec4(%s), vec4(%s)));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_DPH:
-      snprintf(buf, 255, "%s = %s(dot(vec4(vec3(%s), 1.0), vec4(%s)));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(dot(vec4(vec3(%s), 1.0), vec4(%s)));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_MAX:
    case TGSI_OPCODE_IMAX:
    case TGSI_OPCODE_UMAX:
-      snprintf(buf, 255, "%s = %s(%s(max(%s, %s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(%s(max(%s, %s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_MIN:
    case TGSI_OPCODE_IMIN:
    case TGSI_OPCODE_UMIN:
-      snprintf(buf, 255, "%s = %s(%s(min(%s, %s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(%s(min(%s, %s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_ABS:
@@ -2267,7 +2271,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_LIT:
-      snprintf(buf, 512, "%s = %s(vec4(1.0, max(%s.x, 0.0), step(0.0, %s.x) * pow(max(0.0, %s.y), clamp(%s.w, -128.0, 128.0)), 1.0)%s);\n", dsts[0], get_string(dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
+      snprintf(buf, 512, "%s = %s(vec4(1.0, max(%s.x, 0.0), step(0.0, %s.x) * pow(max(0.0, %s.y), clamp(%s.w, -128.0, 128.0)), 1.0)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_EX2:
@@ -2279,11 +2283,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_EXP:
-      snprintf(buf, 512, "%s = %s(vec4(pow(2.0, floor(%s.x)), %s.x - floor(%s.x), exp2(%s.x), 1.0)%s);\n", dsts[0], get_string(dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
+      snprintf(buf, 512, "%s = %s(vec4(pow(2.0, floor(%s.x)), %s.x - floor(%s.x), exp2(%s.x), 1.0)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_LOG:
-      snprintf(buf, 512, "%s = %s(vec4(floor(log2(%s.x)), %s.x / pow(2.0, floor(log2(%s.x))), log2(%s.x), 1.0)%s);\n", dsts[0], get_string(dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
+      snprintf(buf, 512, "%s = %s(vec4(floor(log2(%s.x)), %s.x / pow(2.0, floor(log2(%s.x))), log2(%s.x), 1.0)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[0], srcs[0], srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_COS:
@@ -2295,7 +2299,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_SCS:
-      snprintf(buf, 255, "%s = %s(vec4(cos(%s.x), sin(%s.x), 0, 1)%s);\n", dsts[0], get_string(dstconv),
+      snprintf(buf, 255, "%s = %s(vec4(cos(%s.x), sin(%s.x), 0, 1)%s);\n", dsts[0], get_string(dinfo.dstconv),
                srcs[0], srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
@@ -2318,7 +2322,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_RCP:
-      snprintf(buf, 255, "%s = %s(1.0/(%s));\n", dsts[0], get_string(dstconv), srcs[0]);
+      snprintf(buf, 255, "%s = %s(1.0/(%s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_FLR:
@@ -2350,11 +2354,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_RSQ:
-      snprintf(buf, 255, "%s = %s(inversesqrt(%s.x));\n", dsts[0], get_string(dstconv), srcs[0]);
+      snprintf(buf, 255, "%s = %s(inversesqrt(%s.x));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_MOV:
-      snprintf(buf, 255, "%s = %s(%s(%s%s));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], override_no_wm[0] ? "" : writemask);
+      snprintf(buf, 255, "%s = %s(%s(%s%s));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], override_no_wm[0] ? "" : writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_ADD:
@@ -2362,7 +2366,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_UADD:
-      snprintf(buf, 255, "%s = %s(%s(ivec4((uvec4(%s) + uvec4(%s))))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], writemask);
+      snprintf(buf, 255, "%s = %s(%s(ivec4((uvec4(%s) + uvec4(%s))))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_SUB:
@@ -2378,19 +2382,19 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_UMUL:
-      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) * uvec4(%s)))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], writemask);
+      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) * uvec4(%s)))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_UMOD:
-      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) %% uvec4(%s)))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], writemask);
+      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) %% uvec4(%s)))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_IDIV:
-      snprintf(buf, 255, "%s = %s(%s((ivec4(%s) / ivec4(%s)))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], writemask);
+      snprintf(buf, 255, "%s = %s(%s((ivec4(%s) / ivec4(%s)))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_UDIV:
-      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) / uvec4(%s)))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], writemask);
+      snprintf(buf, 255, "%s = %s(%s((uvec4(%s) / uvec4(%s)))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_ISHR:
@@ -2403,11 +2407,11 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_MAD:
-      snprintf(buf, 255, "%s = %s((%s * %s + %s)%s);\n", dsts[0], get_string(dstconv), srcs[0], srcs[1], srcs[2], writemask);
+      snprintf(buf, 255, "%s = %s((%s * %s + %s)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1], srcs[2], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_UMAD:
-      snprintf(buf, 255, "%s = %s(%s((%s * %s + %s)%s));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], srcs[2], writemask);
+      snprintf(buf, 255, "%s = %s(%s((%s * %s + %s)%s));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], srcs[2], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_OR:
@@ -2438,32 +2442,32 @@ iter_instruction(struct tgsi_iterate_context *iter,
    case TGSI_OPCODE_TXP:
    case TGSI_OPCODE_TXQ:
    case TGSI_OPCODE_LODQ:
-      ret = translate_tex(ctx, inst, sreg_index, srcs, dsts, writemask, get_string(dstconv), dst_override_no_wm[0], tg4_has_component);
+      ret = translate_tex(ctx, inst, sreg_index, srcs, dsts, writemask, get_string(dinfo.dstconv), dinfo.dst_override_no_wm[0], tg4_has_component);
       if (ret)
          return FALSE;
       break;
    case TGSI_OPCODE_I2F:
-      snprintf(buf, 255, "%s = %s(ivec4(%s)%s);\n", dsts[0], get_string(dstconv), srcs[0], writemask);
+      snprintf(buf, 255, "%s = %s(ivec4(%s)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_U2F:
-      snprintf(buf, 255, "%s = %s(uvec4(%s)%s);\n", dsts[0], get_string(dstconv), srcs[0], writemask);
+      snprintf(buf, 255, "%s = %s(uvec4(%s)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_F2I:
-      snprintf(buf, 255, "%s = %s(%s(ivec4(%s))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], writemask);
+      snprintf(buf, 255, "%s = %s(%s(ivec4(%s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_F2U:
-      snprintf(buf, 255, "%s = %s(%s(uvec4(%s))%s);\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], writemask);
+      snprintf(buf, 255, "%s = %s(%s(uvec4(%s))%s);\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], writemask);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_NOT:
-      snprintf(buf, 255, "%s = %s(uintBitsToFloat(~(uvec4(%s))));\n", dsts[0], get_string(dstconv), srcs[0]);
+      snprintf(buf, 255, "%s = %s(uintBitsToFloat(~(uvec4(%s))));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_INEG:
-      snprintf(buf, 255, "%s = %s(intBitsToFloat(-(ivec4(%s))));\n", dsts[0], get_string(dstconv), srcs[0]);
+      snprintf(buf, 255, "%s = %s(intBitsToFloat(-(ivec4(%s))));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_SEQ:
@@ -2505,7 +2509,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_POW:
-      snprintf(buf, 255, "%s = %s(pow(%s, %s));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(pow(%s, %s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_CMP:
@@ -2547,7 +2551,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_XPD:
-      snprintf(buf, 255, "%s = %s(cross(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1]);
+      snprintf(buf, 255, "%s = %s(cross(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
       break;
    case TGSI_OPCODE_BGNLOOP:
@@ -2594,24 +2598,24 @@ iter_instruction(struct tgsi_iterate_context *iter,
       break;
    }
    case TGSI_OPCODE_INTERP_CENTROID:
-      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtCentroid(%s))%s));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], src_swizzle0);
+      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtCentroid(%s))%s));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], src_swizzle0);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_INTERP_SAMPLE:
-      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtSample(%s, %s.x))%s));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], src_swizzle0);
+      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtSample(%s, %s.x))%s));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], src_swizzle0);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_INTERP_OFFSET:
-      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtOffset(%s, %s.xy))%s));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], src_swizzle0);
+      snprintf(buf, 255, "%s = %s(%s(vec4(interpolateAtOffset(%s, %s.xy))%s));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], src_swizzle0);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_UMUL_HI:
       snprintf(buf, 255, "umulExtended(%s, %s, umul_temp, mul_temp);\n", srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
-      snprintf(buf, 255, "%s = %s(%s(umul_temp));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix));
+      snprintf(buf, 255, "%s = %s(%s(umul_temp));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix));
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       ctx->write_mul_temp = true;
@@ -2619,45 +2623,45 @@ iter_instruction(struct tgsi_iterate_context *iter,
    case TGSI_OPCODE_IMUL_HI:
       snprintf(buf, 255, "imulExtended(%s, %s, imul_temp, mul_temp);\n", srcs[0], srcs[1]);
       EMIT_BUF_WITH_RET(ctx, buf);
-      snprintf(buf, 255, "%s = %s(%s(imul_temp));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix));
+      snprintf(buf, 255, "%s = %s(%s(imul_temp));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix));
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       ctx->write_mul_temp = true;
       break;
 
    case TGSI_OPCODE_IBFE:
-      snprintf(buf, 255, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], srcs[2]);
+      snprintf(buf, 255, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], srcs[2]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_UBFE:
-      snprintf(buf, 255, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0], srcs[1], srcs[2]);
+      snprintf(buf, 255, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0], srcs[1], srcs[2]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_BFI:
-      snprintf(buf, 255, "%s = %s(uintBitsToFloat(bitfieldInsert(%s, %s, int(%s), int(%s))));\n", dsts[0], get_string(dstconv), srcs[0], srcs[1], srcs[2], srcs[3]);
+      snprintf(buf, 255, "%s = %s(uintBitsToFloat(bitfieldInsert(%s, %s, int(%s), int(%s))));\n", dsts[0], get_string(dinfo.dstconv), srcs[0], srcs[1], srcs[2], srcs[3]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_BREV:
-      snprintf(buf, 255, "%s = %s(%s(bitfieldReverse(%s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(bitfieldReverse(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_POPC:
-      snprintf(buf, 255, "%s = %s(%s(bitCount(%s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(bitCount(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_LSB:
-      snprintf(buf, 255, "%s = %s(%s(findLSB(%s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(findLSB(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
    case TGSI_OPCODE_IMSB:
    case TGSI_OPCODE_UMSB:
-      snprintf(buf, 255, "%s = %s(%s(findMSB(%s)));\n", dsts[0], get_string(dstconv), get_string(dtypeprefix), srcs[0]);
+      snprintf(buf, 255, "%s = %s(%s(findMSB(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_string(dinfo.dtypeprefix), srcs[0]);
       EMIT_BUF_WITH_RET(ctx, buf);
       ctx->shader_req_bits |= SHADER_REQ_GPU_SHADER5;
       break;
-- 
2.14.3



More information about the virglrenderer-devel mailing list