vkd3d-shader/hlsl: Store state block on pass variables.

This commit is contained in:
Francisco Casas
2024-03-19 15:35:59 -03:00
committed by Alexandre Julliard
parent a99bcb1196
commit ef9ae22ed0
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
5 changed files with 15 additions and 6 deletions

View File

@@ -1117,7 +1117,7 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
}
static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *annotations,
const struct vkd3d_shader_location *loc)
struct hlsl_state_block *state_block, const struct vkd3d_shader_location *loc)
{
struct hlsl_ir_var *var;
struct hlsl_type *type;
@@ -1127,6 +1127,11 @@ static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope *
return false;
var->annotations = annotations;
var->state_blocks = hlsl_alloc(ctx, sizeof(*var->state_blocks));
var->state_blocks[0] = state_block;
var->state_block_count = 1;
var->state_block_capacity = 1;
if (!hlsl_add_var(ctx, var, false))
{
struct hlsl_ir_var *old = hlsl_get_var(ctx->cur_scope, var->name);
@@ -5592,9 +5597,9 @@ name_opt:
| any_identifier
pass:
KW_PASS name_opt annotations_opt '{' '}'
KW_PASS name_opt annotations_opt '{' state_block_start state_block '}'
{
if (!add_pass(ctx, $2, $3, &@1))
if (!add_pass(ctx, $2, $3, $6, &@1))
YYABORT;
}