vkd3d-shader: Only mark entry point parameters as uniform, input, or output.

In fact, don't even mark them directly; only mark the synthetic variables.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura
2021-04-27 12:14:18 -05:00
committed by Alexandre Julliard
parent 16e549e579
commit 549be35c0a
4 changed files with 51 additions and 60 deletions

View File

@@ -388,7 +388,7 @@ struct hlsl_ir_expr *hlsl_new_copy(struct hlsl_ir_node *node)
}
struct hlsl_ir_var *hlsl_new_var(const char *name, struct hlsl_type *type, const struct vkd3d_shader_location loc,
const char *semantic, const struct hlsl_reg_reservation *reg_reservation)
const char *semantic, unsigned int modifiers, const struct hlsl_reg_reservation *reg_reservation)
{
struct hlsl_ir_var *var;
@@ -399,6 +399,7 @@ struct hlsl_ir_var *hlsl_new_var(const char *name, struct hlsl_type *type, const
var->data_type = type;
var->loc = loc;
var->semantic = semantic;
var->modifiers = modifiers;
var->reg_reservation = reg_reservation;
return var;
}
@@ -406,7 +407,7 @@ struct hlsl_ir_var *hlsl_new_var(const char *name, struct hlsl_type *type, const
struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type,
const struct vkd3d_shader_location loc)
{
struct hlsl_ir_var *var = hlsl_new_var(vkd3d_strdup(name), type, loc, NULL, NULL);
struct hlsl_ir_var *var = hlsl_new_var(vkd3d_strdup(name), type, loc, NULL, 0, NULL);
if (var)
list_add_tail(&ctx->globals->vars, &var->scope_entry);
@@ -571,7 +572,7 @@ 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_var(vkd3d_strdup(name), return_type, loc, semantic, NULL)))
if (!(return_var = hlsl_new_var(vkd3d_strdup(name), return_type, loc, semantic, 0, NULL)))
{
vkd3d_free(decl);
return NULL;
@@ -868,12 +869,17 @@ static void dump_src(struct vkd3d_string_buffer *buffer, const struct hlsl_src *
static void dump_ir_var(struct vkd3d_string_buffer *buffer, const struct hlsl_ir_var *var)
{
if (var->is_input_varying)
vkd3d_string_buffer_printf(buffer, "in ");
if (var->is_output_varying)
vkd3d_string_buffer_printf(buffer, "out ");
if (var->is_uniform)
vkd3d_string_buffer_printf(buffer, "uniform ");
if (var->modifiers)
{
struct vkd3d_string_buffer_cache string_buffers;
struct vkd3d_string_buffer *string;
vkd3d_string_buffer_cache_init(&string_buffers);
if ((string = hlsl_modifiers_to_string(&string_buffers, var->modifiers)))
vkd3d_string_buffer_printf(buffer, "%s ", string->buffer);
vkd3d_string_buffer_release(&string_buffers, string);
vkd3d_string_buffer_cache_cleanup(&string_buffers);
}
vkd3d_string_buffer_printf(buffer, "%s %s", debug_hlsl_type(var->data_type), var->name);
if (var->semantic)
vkd3d_string_buffer_printf(buffer, " : %s", var->semantic);
@@ -1616,7 +1622,6 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
struct hlsl_ir_function_decl *entry_func;
const struct hlsl_profile_info *profile;
const char *entry_point;
struct hlsl_ir_var *var;
struct hlsl_ctx ctx;
int ret;
@@ -1659,19 +1664,6 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
return VKD3D_ERROR_INVALID_SHADER;
}
LIST_FOR_EACH_ENTRY(var, entry_func->parameters, struct hlsl_ir_var, param_entry)
{
if (var->data_type->type != HLSL_CLASS_STRUCT && !var->semantic
&& (var->is_input_varying || var->is_output_varying))
hlsl_error(&ctx, var->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
"Parameter \"%s\" is missing a semantic.", var->name);
}
if (!hlsl_type_is_void(entry_func->return_type)
&& 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);
ret = hlsl_emit_dxbc(&ctx, entry_func, dxbc);
hlsl_ctx_cleanup(&ctx);