vkd3d-shader/hlsl: Allow KW_PIXELSHADER and KW_VERTEXSHADER as stateblock lhs.

This commit is contained in:
Francisco Casas 2024-03-20 17:11:49 -03:00 committed by Alexandre Julliard
parent ef9ae22ed0
commit e9559c394b
Notes: Alexandre Julliard 2024-04-11 17:02:42 -05:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/739
2 changed files with 19 additions and 3 deletions

View File

@ -5537,9 +5537,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
@ -6707,6 +6707,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
{
@ -6731,7 +6747,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;

View File

@ -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;