vkd3d-shader/hlsl: Allow the final expression in a for loop initializer to be omitted.

This commit is contained in:
Zebediah Figura 2021-09-13 22:40:09 -05:00 committed by Alexandre Julliard
parent 38964214cd
commit 58445da64b
Notes: Alexandre Julliard 2023-02-13 22:20:34 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/85
2 changed files with 10 additions and 6 deletions

View File

@ -3647,6 +3647,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
%type <list> declaration_statement
%type <list> equality_expr
%type <list> expr
%type <list> expr_optional
%type <list> expr_statement
%type <list> initializer_expr
%type <list> jump_statement
@ -4875,24 +4876,27 @@ loop_statement:
{
$$ = create_loop(ctx, LOOP_DO_WHILE, NULL, $5, NULL, $2, @1);
}
| KW_FOR '(' scope_start expr_statement expr_statement expr ')' statement
| KW_FOR '(' scope_start expr_statement expr_statement expr_optional ')' statement
{
$$ = create_loop(ctx, LOOP_FOR, $4, $5, $6, $8, @1);
hlsl_pop_scope(ctx);
}
| KW_FOR '(' scope_start declaration expr_statement expr ')' statement
| KW_FOR '(' scope_start declaration expr_statement expr_optional ')' statement
{
$$ = create_loop(ctx, LOOP_FOR, $4, $5, $6, $8, @1);
hlsl_pop_scope(ctx);
}
expr_statement:
';'
expr_optional:
%empty
{
if (!($$ = make_empty_list(ctx)))
YYABORT;
}
| expr ';'
| expr
expr_statement:
expr_optional ';'
{
$$ = $1;
}

View File

@ -215,7 +215,7 @@ todo draw quad
todo probe all rgba (0.2, 0.2, 0.2, 0.2)
uniform 0 float 0.8
todo draw quad
todo probe all rgba (0.5, 0.5, 0.5, 0.5)
probe all rgba (0.5, 0.5, 0.5, 0.5)
[pixel shader todo]