Zebediah Figura : vkd3d-shader/hlsl: Merge the "type" and "base_type" rules.

Alexandre Julliard julliard at winehq.org
Wed Sep 1 15:43:27 CDT 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon Aug 30 12:21:25 2021 -0500

vkd3d-shader/hlsl: Merge the "type" and "base_type" rules.

It's certainly invalid to declare a vector of non-scalars, but it doesn't need
to result in a syntax error. Indeed native d3dcompiler does not emit a syntax
error in this case.

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: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.y | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 7906356..6a472c1 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1731,7 +1731,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
 
 %type <semantic> semantic
 
-%type <type> base_type
 %type <type> field_type
 %type <type> named_struct_spec
 %type <type> unnamed_struct_spec
@@ -2145,11 +2144,7 @@ input_mod:
         }
 
 type:
-      base_type
-        {
-            $$ = $1;
-        }
-    | KW_VECTOR '<' base_type ',' C_INTEGER '>'
+      KW_VECTOR '<' type ',' C_INTEGER '>'
         {
             if ($3->type != HLSL_CLASS_SCALAR)
             {
@@ -2171,7 +2166,7 @@ type:
 
             $$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
         }
-    | KW_MATRIX '<' base_type ',' C_INTEGER ',' C_INTEGER '>'
+    | KW_MATRIX '<' type ',' C_INTEGER ',' C_INTEGER '>'
         {
             if ($3->type != HLSL_CLASS_SCALAR)
             {
@@ -2199,9 +2194,7 @@ type:
 
             $$ = hlsl_new_type(ctx, NULL, HLSL_CLASS_MATRIX, $3->base_type, $7, $5);
         }
-
-base_type:
-      KW_VOID
+    | KW_VOID
         {
             $$ = ctx->builtin_types.Void;
         }




More information about the wine-cvs mailing list