From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.h | 1 + libs/vkd3d-shader/hlsl.y | 11 ++++++++--- tests/hlsl/fxgroup-syntax.shader_test | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index e8acc7552..ab1d5e47e 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -425,6 +425,7 @@ struct hlsl_ir_var
/* A dynamic array containing the state block on the variable's declaration, if any. * An array variable may contain multiple state blocks. + * A technique pass will always contain one. * These are only really used for effect profiles. */ struct hlsl_state_block **state_blocks; unsigned int state_block_count; diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index d0f74ceea..2486f7542 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1132,7 +1132,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; @@ -1142,6 +1142,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); @@ -5627,9 +5632,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; }
diff --git a/tests/hlsl/fxgroup-syntax.shader_test b/tests/hlsl/fxgroup-syntax.shader_test index e8e5fbf59..aedbbfb11 100644 --- a/tests/hlsl/fxgroup-syntax.shader_test +++ b/tests/hlsl/fxgroup-syntax.shader_test @@ -1,5 +1,5 @@ % Test complex effect groups syntax -[pixel shader fail(sm>=6) todo] +[pixel shader fail(sm>=6)] fxgroup group1 { technique10