[virglrenderer-devel] [PATCH 8/9] shader: convert txfi to string conversion

Dave Airlie airlied at gmail.com
Tue Jun 5 02:30:19 UTC 2018


From: Dave Airlie <airlied at redhat.com>

---
 src/vrend_shader.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 01e3af8..1872768 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -1505,7 +1505,7 @@ static int translate_tex(struct dump_ctx *ctx,
                          bool dst0_override_no_wm,
                          bool tg4_has_component)
 {
-   const char *txfi;
+   enum vrend_type_qualifier txfi = TYPE_CONVERSION_NONE;
    enum vrend_writemask twm = WRITEMASK_NONE, gwm = WRITEMASK_NONE;
    enum vrend_type_qualifier dtypeprefix = TYPE_CONVERSION_NONE;
    bool is_shad = false;
@@ -1545,11 +1545,11 @@ static int translate_tex(struct dump_ctx *ctx,
          twm = WRITEMASK_NONE;
       else
          twm = WRITEMASK_X;
-      txfi = "int";
+      txfi = INT;
       break;
    case TGSI_TEXTURE_1D_ARRAY:
       twm = WRITEMASK_XY;
-      txfi = "ivec2";
+      txfi = IVEC2;
       break;
    case TGSI_TEXTURE_2D:
    case TGSI_TEXTURE_RECT:
@@ -1557,7 +1557,7 @@ static int translate_tex(struct dump_ctx *ctx,
          twm = WRITEMASK_NONE;
       else
          twm = WRITEMASK_XY;
-      txfi = "ivec2";
+      txfi = IVEC2;
       break;
    case TGSI_TEXTURE_SHADOW1D:
    case TGSI_TEXTURE_SHADOW2D:
@@ -1570,20 +1570,20 @@ static int translate_tex(struct dump_ctx *ctx,
          twm = WRITEMASK_XY;
       else
          twm = WRITEMASK_XYZ;
-      txfi = "ivec3";
+      txfi = IVEC3;
       break;
    case TGSI_TEXTURE_CUBE:
    case TGSI_TEXTURE_2D_ARRAY:
       twm = WRITEMASK_XYZ;
-      txfi = "ivec3";
+      txfi = IVEC3;
       break;
    case TGSI_TEXTURE_2D_MSAA:
       twm = WRITEMASK_XY;
-      txfi = "ivec2";
+      txfi = IVEC2;
       break;
    case TGSI_TEXTURE_2D_ARRAY_MSAA:
       twm = WRITEMASK_XYZ;
-      txfi = "ivec3";
+      txfi = IVEC3;
       break;
 
    case TGSI_TEXTURE_SHADOWCUBE:
@@ -1597,7 +1597,7 @@ static int translate_tex(struct dump_ctx *ctx,
          twm = WRITEMASK_XYZ;
       else
          twm = WRITEMASK_NONE;
-      txfi = "";
+      txfi = TYPE_CONVERSION_NONE;
       break;
    }
 
@@ -1764,7 +1764,7 @@ static int translate_tex(struct dump_ctx *ctx,
       }
    }
    if (inst->Instruction.Opcode == TGSI_OPCODE_TXF) {
-      snprintf(buf, 255, "%s = %s(%s(texelFetch%s(%s, %s(%s%s)%s%s)%s));\n", dsts[0], dstconv, get_string(dtypeprefix), tex_ext, srcs[sampler_index], txfi, srcs[0], get_wm_string(twm), bias, offbuf, dst0_override_no_wm ? "" : writemask);
+      snprintf(buf, 255, "%s = %s(%s(texelFetch%s(%s, %s(%s%s)%s%s)%s));\n", dsts[0], dstconv, get_string(dtypeprefix), tex_ext, srcs[sampler_index], get_string(txfi), srcs[0], get_wm_string(twm), bias, offbuf, dst0_override_no_wm ? "" : writemask);
    } else if (ctx->cfg->glsl_version < 140 && (ctx->shader_req_bits & SHADER_REQ_SAMPLER_RECT)) {
       /* rect is special in GLSL 1.30 */
       if (inst->Texture.Texture == TGSI_TEXTURE_RECT)
-- 
2.14.3



More information about the virglrenderer-devel mailing list