From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.y | 19 ++++++++++++++++++- tests/hlsl/fx-syntax.shader_test | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index afa33974e..a7b48d321 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5539,6 +5539,7 @@ 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 @@ -6701,6 +6702,22 @@ variable_decl: list_init(&$$->state_blocks); }
+stateblock_lhs_identifier: + any_identifier + { + $$ = $1; + } + | KW_PIXELSHADER + { + if (!($$ = hlsl_strdup(ctx, "pixelshader"))) + YYABORT; + } + | KW_VERTEXSHADER + { + if (!($$ = hlsl_strdup(ctx, "vertexshader"))) + YYABORT; + } + state_block_start: %empty { @@ -6734,7 +6751,7 @@ state_block: $$ = $1; state_block_add_entry($$, entry); } - | state_block any_identifier '=' complex_initializer ';' + | state_block stateblock_lhs_identifier '=' complex_initializer ';' { struct hlsl_state_block_entry *entry;
diff --git a/tests/hlsl/fx-syntax.shader_test b/tests/hlsl/fx-syntax.shader_test index 4efc53b81..e17b990cf 100644 --- a/tests/hlsl/fx-syntax.shader_test +++ b/tests/hlsl/fx-syntax.shader_test @@ -130,7 +130,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;