mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
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:
committed by
Alexandre Julliard
parent
21fea55c2d
commit
9a70d57690
@ -1626,6 +1626,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
|
|||||||
struct hlsl_ir_function_decl *entry_func;
|
struct hlsl_ir_function_decl *entry_func;
|
||||||
const struct hlsl_profile_info *profile;
|
const struct hlsl_profile_info *profile;
|
||||||
const char *entry_point;
|
const char *entry_point;
|
||||||
|
struct hlsl_ir_var *var;
|
||||||
struct hlsl_ctx ctx;
|
struct hlsl_ctx ctx;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1668,6 +1669,14 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
|
|||||||
return VKD3D_ERROR_INVALID_SHADER;
|
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)
|
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->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,
|
||||||
|
@ -108,6 +108,19 @@ float4 main(out float4 o : sv_target)
|
|||||||
return 0;
|
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]
|
[pixel shader fail]
|
||||||
struct {float4 a;};
|
struct {float4 a;};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user