vkd3d-shader/hlsl: Forbid declaring parameters as both out and const.

Note that inout const parameters are allowed.
This commit is contained in:
Shaun Ren 2025-01-20 14:01:36 -05:00 committed by Henri Verbeet
parent 22d0841412
commit a9d7c65eb8
Notes: Henri Verbeet 2025-01-21 14:13:49 +01:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1347

View File

@ -1323,6 +1323,11 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
"Parameter '%s' is declared as both \"out\" and \"uniform\".", param->name);
if ((param->modifiers & HLSL_STORAGE_OUT) && !(param->modifiers & HLSL_STORAGE_IN)
&& (param->type->modifiers & HLSL_MODIFIER_CONST))
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
"Parameter '%s' is declared as both \"out\" and \"const\".", param->name);
if (param->reg_reservation.offset_type)
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION,
"packoffset() is not allowed on function parameters.");