Zebediah Figura : vkd3d-shader: Store the register type for reservations as a char.

Alexandre Julliard julliard at winehq.org
Fri Jun 18 14:43:57 CDT 2021


Module: vkd3d
Branch: master
Commit: bb79ca76aec7c3f416fd156288df27716881e817
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=bb79ca76aec7c3f416fd156288df27716881e817

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon May 31 21:41:13 2021 -0500

vkd3d-shader: Store the register type for reservations as a char.

Essentially because the meaning of 'b' differs between SM1-3 and SM4+.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.h |  2 +-
 libs/vkd3d-shader/hlsl.y | 22 +---------------------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 4fe90a9..906d864 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -212,7 +212,7 @@ struct hlsl_src
 
 struct hlsl_reg_reservation
 {
-    enum vkd3d_shader_register_type type;
+    char type;
     DWORD regnum;
 };
 
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index cab46ae..d8ad1f9 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -782,29 +782,9 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct list *list,
 
 static struct hlsl_reg_reservation *parse_reg_reservation(struct hlsl_ctx *ctx, const char *reg_string)
 {
-    enum vkd3d_shader_register_type type;
     struct hlsl_reg_reservation *reg_res;
     DWORD regnum = 0;
 
-    switch (reg_string[0])
-    {
-        case 'c':
-            type = VKD3DSPR_CONST;
-            break;
-        case 'i':
-            type = VKD3DSPR_CONSTINT;
-            break;
-        case 'b':
-            type = VKD3DSPR_CONSTBOOL;
-            break;
-        case 's':
-            type = VKD3DSPR_SAMPLER;
-            break;
-        default:
-            FIXME("Unsupported register type.\n");
-            return NULL;
-     }
-
     if (!sscanf(reg_string + 1, "%u", &regnum))
     {
         FIXME("Unsupported register reservation syntax.\n");
@@ -813,7 +793,7 @@ static struct hlsl_reg_reservation *parse_reg_reservation(struct hlsl_ctx *ctx,
 
     if (!(reg_res = hlsl_alloc(ctx, sizeof(*reg_res))))
         return NULL;
-    reg_res->type = type;
+    reg_res->type = reg_string[0];
     reg_res->regnum = regnum;
     return reg_res;
 }




More information about the wine-cvs mailing list