Zebediah Figura : vkd3d-shader/hlsl: Get rid of hlsl_type_is_void().

Alexandre Julliard julliard at winehq.org
Tue Oct 5 15:50:42 CDT 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Sun Oct  3 19:19:06 2021 -0500

vkd3d-shader/hlsl: Get rid of hlsl_type_is_void().

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

---

 libs/vkd3d-shader/hlsl.c | 7 +------
 libs/vkd3d-shader/hlsl.h | 1 -
 libs/vkd3d-shader/hlsl.y | 4 ++--
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index 66ca389..f03777a 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -640,11 +640,6 @@ struct hlsl_ir_loop *hlsl_new_loop(struct hlsl_ctx *ctx, struct vkd3d_shader_loc
     return loop;
 }
 
-bool hlsl_type_is_void(const struct hlsl_type *type)
-{
-    return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID;
-}
-
 struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type,
         struct list *parameters, const struct hlsl_semantic *semantic, struct vkd3d_shader_location loc)
 {
@@ -656,7 +651,7 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
     decl->parameters = parameters;
     decl->loc = loc;
 
-    if (!hlsl_type_is_void(return_type))
+    if (!hlsl_types_are_equal(return_type, ctx->builtin_types.Void))
     {
         struct hlsl_ir_var *return_var;
         char name[28];
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 9686a49..77b4ce9 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -683,7 +683,6 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
         unsigned int default_majority, unsigned int modifiers);
 unsigned int hlsl_type_component_count(struct hlsl_type *type);
 unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset);
-bool hlsl_type_is_void(const struct hlsl_type *type);
 bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2);
 
 unsigned int hlsl_combine_swizzles(unsigned int first, unsigned int second, unsigned int dim);
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index d1ef9eb..6f1794e 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -506,7 +506,7 @@ static struct hlsl_ir_jump *add_return(struct hlsl_ctx *ctx, struct list *instrs
             return NULL;
         list_add_after(&return_value->entry, &store->node.entry);
     }
-    else if (!hlsl_type_is_void(return_type))
+    else if (ctx->cur_function->return_var)
     {
         hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN, "Non-void function must return a value.");
         return NULL;
@@ -2210,7 +2210,7 @@ func_prototype:
                         "\"%s\" was previously declared here.", $3);
                 YYABORT;
             }
-            if (hlsl_type_is_void($2) && $7.semantic.name)
+            if (hlsl_types_are_equal($2, ctx->builtin_types.Void) && $7.semantic.name)
             {
                 hlsl_error(ctx, @7, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC,
                         "Semantics are not allowed on void functions.");




More information about the wine-cvs mailing list