Zebediah Figura : d3dcompiler: Don't set the node type for return instructions.

Alexandre Julliard julliard at winehq.org
Tue Mar 3 16:24:53 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Mar  1 22:55:27 2020 -0600

d3dcompiler: Don't set the node type for return instructions.

Essentially just because it doesn't make sense to do so; a return instruction
is not an expression usable as a source to other instructions.

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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dcompiler_43/hlsl.y b/dlls/d3dcompiler_43/hlsl.y
index 34adab2855..3d04677f2e 100644
--- a/dlls/d3dcompiler_43/hlsl.y
+++ b/dlls/d3dcompiler_43/hlsl.y
@@ -483,6 +483,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
 
 static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source_location loc)
 {
+    struct hlsl_type *return_type = hlsl_ctx.cur_function->return_type;
     struct hlsl_ir_jump *jump = d3dcompiler_alloc(sizeof(*jump));
     if (!jump)
     {
@@ -492,16 +493,15 @@ static struct hlsl_ir_jump *new_return(struct hlsl_ir_node *value, struct source
     jump->node.type = HLSL_IR_JUMP;
     jump->node.loc = loc;
     jump->type = HLSL_IR_JUMP_RETURN;
-    jump->node.data_type = hlsl_ctx.cur_function->return_type;
     if (value)
     {
-        if (!(jump->return_value = implicit_conversion(value, jump->node.data_type, &loc)))
+        if (!(jump->return_value = implicit_conversion(value, return_type, &loc)))
         {
             d3dcompiler_free(jump);
             return NULL;
         }
     }
-    else if (jump->node.data_type->base_type != HLSL_TYPE_VOID)
+    else if (return_type->base_type != HLSL_TYPE_VOID)
     {
         hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
                 "non-void function must return a value");




More information about the wine-cvs mailing list