Zebediah Figura : vkd3d-shader: Store the function return semantic in the return variable.

Alexandre Julliard julliard at winehq.org
Tue Mar 30 14:57:57 CDT 2021


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Sun Mar 28 21:46:58 2021 +0200

vkd3d-shader: Store the function return semantic in the return variable.

Signed-off-by: Zebediah Figura <zfigura 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 | 9 +++------
 libs/vkd3d-shader/hlsl.h | 1 -
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index daf354d..53b9db3 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -563,7 +563,6 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
         return NULL;
     decl->return_type = return_type;
     decl->parameters = parameters;
-    decl->semantic = semantic;
     decl->loc = loc;
 
     if (!hlsl_type_is_void(return_type))
@@ -572,11 +571,12 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
         char name[28];
 
         sprintf(name, "<retval-%p>", decl);
-        if (!(return_var = hlsl_new_synthetic_var(ctx, name, return_type, loc)))
+        if (!(return_var = hlsl_new_var(vkd3d_strdup(name), return_type, loc, semantic, NULL)))
         {
             vkd3d_free(decl);
             return NULL;
         }
+        list_add_tail(&ctx->globals->vars, &return_var->scope_entry);
         decl->return_var = return_var;
     }
 
@@ -1161,8 +1161,6 @@ void hlsl_dump_function(const struct hlsl_ir_function_decl *func)
         dump_ir_var(&buffer, param);
         vkd3d_string_buffer_printf(&buffer, "\n");
     }
-    if (func->semantic)
-        vkd3d_string_buffer_printf(&buffer, "Function semantic: %s\n", func->semantic);
     if (func->body)
         dump_instr_list(&buffer, func->body);
 
@@ -1302,7 +1300,6 @@ void hlsl_free_instr(struct hlsl_ir_node *node)
 
 static void free_function_decl(struct hlsl_ir_function_decl *decl)
 {
-    vkd3d_free((void *)decl->semantic);
     vkd3d_free(decl->parameters);
     hlsl_free_instr_list(decl->body);
     vkd3d_free(decl);
@@ -1678,7 +1675,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
     }
 
     if (!hlsl_type_is_void(entry_func->return_type)
-            && entry_func->return_type->type != HLSL_CLASS_STRUCT && !entry_func->semantic)
+            && entry_func->return_type->type != HLSL_CLASS_STRUCT && !entry_func->return_var->semantic)
         hlsl_error(&ctx, entry_func->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
                 "Entry point \"%s\" is missing a return value semantic.", entry_point);
 
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index cc740ea..cf12f63 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -229,7 +229,6 @@ struct hlsl_ir_function_decl
     struct vkd3d_shader_location loc;
     struct rb_entry entry;
     struct hlsl_ir_function *func;
-    const char *semantic;
     struct list *parameters;
     struct list *body;
 };




More information about the wine-cvs mailing list