vkd3d-shader: Check for missing semantics on entry function parameters.

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:
Zebediah Figura 2021-03-28 21:46:56 +02:00 committed by Alexandre Julliard
parent 21fea55c2d
commit 9a70d57690
2 changed files with 22 additions and 0 deletions

View File

@ -1626,6 +1626,7 @@ 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;
@ -1668,6 +1669,14 @@ 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->semantic)
hlsl_error(&ctx, entry_func->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,

View File

@ -108,6 +108,19 @@ float4 main(out float4 o : sv_target)
return 0;
}
[pixel shader fail]
float4 main(out float4 o) : sv_target
{
o = 1;
return 0;
}
[pixel shader fail]
float4 main(in float4 i) : sv_target
{
return 0;
}
[pixel shader fail]
struct {float4 a;};