Zebediah Figura : d3dcompiler: Also check the type class when checking for void.

Alexandre Julliard julliard at winehq.org
Wed Jun 3 16:40:59 CDT 2020


Module: wine
Branch: master
Commit: 2b77cfb7be73c08a406046bc3d0ea250c4743388
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2b77cfb7be73c08a406046bc3d0ea250c4743388

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun  1 17:58:45 2020 -0500

d3dcompiler: Also check the type class when checking for void.

As of 867fe22346, non-void types may have a base_type of HLSL_TYPE_VOID.

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

---

 dlls/d3dcompiler_43/hlsl.y | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index bf0160e369..70ffa70fe1 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -278,6 +278,11 @@ static void declare_predefined_types(struct hlsl_scope *scope)
     add_type_to_scope(scope, type);
 }
 
+static BOOL type_is_void(const struct hlsl_type *type)
+{
+    return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID;
+}
+
 static BOOL append_conditional_break(struct list *cond_list)
 {
     struct hlsl_ir_node *condition, *not;
@@ -521,7 +526,7 @@ static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source
             return NULL;
         }
     }
-    else if (return_type->base_type != HLSL_TYPE_VOID)
+    else if (!type_is_void(return_type))
     {
         hlsl_report_message(loc, HLSL_LEVEL_ERROR, "non-void function must return a value");
         d3dcompiler_free(jump);
@@ -1482,7 +1487,7 @@ hlsl_prog:                /* empty */
                                     }
                                 }
 
-                                if ($2.decl->return_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
+                                if (type_is_void($2.decl->return_type) && $2.decl->semantic)
                                 {
                                     hlsl_report_message($2.decl->loc, HLSL_LEVEL_ERROR,
                                             "void function with a semantic");
@@ -1651,7 +1656,7 @@ func_prototype:           var_modifiers type var_identifier '(' parameters ')' c
                                             HLSL_LEVEL_ERROR, "redefinition of '%s'\n", $3);
                                     YYABORT;
                                 }
-                                if ($2->base_type == HLSL_TYPE_VOID && $7.semantic)
+                                if (type_is_void($2) && $7.semantic)
                                 {
                                     hlsl_report_message(get_location(&@7),
                                             HLSL_LEVEL_ERROR, "void function with a semantic");




More information about the wine-cvs mailing list