From: Francisco Casas <fcasas(a)codeweavers.com> --- libs/vkd3d-shader/hlsl.y | 20 ++++++++++++++++++-- tests/hlsl/state-block-syntax.shader_test | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index efb1ce631..6848ea609 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5566,9 +5566,9 @@ static bool state_block_add_entry(struct hlsl_state_block *state_block, struct h %type <name> any_identifier %type <name> var_identifier +%type <name> stateblock_lhs_identifier %type <name> name_opt - %type <parameter> parameter %type <parameters> param_list @@ -6736,6 +6736,22 @@ state_block_start: ctx->in_state_block = 1; } +stateblock_lhs_identifier: + any_identifier + { + $$ = $1; + } + | KW_PIXELSHADER + { + if (!($$ = hlsl_strdup(ctx, "pixelshader"))) + YYABORT; + } + | KW_VERTEXSHADER + { + if (!($$ = hlsl_strdup(ctx, "vertexshader"))) + YYABORT; + } + state_block_index_opt: %empty { @@ -6760,7 +6776,7 @@ state_block: if (!($$ = hlsl_alloc(ctx, sizeof(*$$)))) YYABORT; } - | state_block any_identifier state_block_index_opt '=' complex_initializer ';' + | state_block stateblock_lhs_identifier state_block_index_opt '=' complex_initializer ';' { struct hlsl_state_block_entry *entry; diff --git a/tests/hlsl/state-block-syntax.shader_test b/tests/hlsl/state-block-syntax.shader_test index 5c2d6f9b7..fb0e73122 100644 --- a/tests/hlsl/state-block-syntax.shader_test +++ b/tests/hlsl/state-block-syntax.shader_test @@ -442,7 +442,7 @@ float4 main() : sv_target { return 0; } % PixelShader and VertexShader are valid identifiers for the lhs -[pixel shader todo] +[pixel shader] sampler sam { pixelShader = 20; -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/739