mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-shader: Store the function return semantic in the return variable.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
committed by
Alexandre Julliard
parent
a6e47e1552
commit
5ad94644ec
@@ -563,7 +563,6 @@ struct hlsl_ir_function_decl *hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hl
|
|||||||
return NULL;
|
return NULL;
|
||||||
decl->return_type = return_type;
|
decl->return_type = return_type;
|
||||||
decl->parameters = parameters;
|
decl->parameters = parameters;
|
||||||
decl->semantic = semantic;
|
|
||||||
decl->loc = loc;
|
decl->loc = loc;
|
||||||
|
|
||||||
if (!hlsl_type_is_void(return_type))
|
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];
|
char name[28];
|
||||||
|
|
||||||
sprintf(name, "<retval-%p>", decl);
|
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);
|
vkd3d_free(decl);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
list_add_tail(&ctx->globals->vars, &return_var->scope_entry);
|
||||||
decl->return_var = return_var;
|
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);
|
dump_ir_var(&buffer, param);
|
||||||
vkd3d_string_buffer_printf(&buffer, "\n");
|
vkd3d_string_buffer_printf(&buffer, "\n");
|
||||||
}
|
}
|
||||||
if (func->semantic)
|
|
||||||
vkd3d_string_buffer_printf(&buffer, "Function semantic: %s\n", func->semantic);
|
|
||||||
if (func->body)
|
if (func->body)
|
||||||
dump_instr_list(&buffer, 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)
|
static void free_function_decl(struct hlsl_ir_function_decl *decl)
|
||||||
{
|
{
|
||||||
vkd3d_free((void *)decl->semantic);
|
|
||||||
vkd3d_free(decl->parameters);
|
vkd3d_free(decl->parameters);
|
||||||
hlsl_free_instr_list(decl->body);
|
hlsl_free_instr_list(decl->body);
|
||||||
vkd3d_free(decl);
|
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)
|
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,
|
hlsl_error(&ctx, entry_func->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
|
||||||
"Entry point \"%s\" is missing a return value semantic.", entry_point);
|
"Entry point \"%s\" is missing a return value semantic.", entry_point);
|
||||||
|
|
||||||
|
@@ -229,7 +229,6 @@ struct hlsl_ir_function_decl
|
|||||||
struct vkd3d_shader_location loc;
|
struct vkd3d_shader_location loc;
|
||||||
struct rb_entry entry;
|
struct rb_entry entry;
|
||||||
struct hlsl_ir_function *func;
|
struct hlsl_ir_function *func;
|
||||||
const char *semantic;
|
|
||||||
struct list *parameters;
|
struct list *parameters;
|
||||||
struct list *body;
|
struct list *body;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user