From: Francisco Casas fcasas@codeweavers.com
--- libs/vkd3d-shader/hlsl.h | 1 + libs/vkd3d-shader/hlsl.y | 7 ++++--- tests/hlsl/fx-syntax.shader_test | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 5c5bf6531..dc738e37f 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -426,6 +426,7 @@ struct hlsl_ir_var
/* A list 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 list state_blocks;
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 5193440b2..afa33974e 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1118,7 +1118,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,7 @@ static bool add_pass(struct hlsl_ctx *ctx, const char *name, struct hlsl_scope * if (!(var = hlsl_new_var(ctx, name, type, loc, NULL, 0, NULL))) return false; var->annotations = annotations; + list_add_tail(&var->state_blocks, &state_block->entry);
if (!hlsl_add_var(ctx, var, false)) { @@ -5594,9 +5595,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/fx-syntax.shader_test b/tests/hlsl/fx-syntax.shader_test index 5422d6133..4efc53b81 100644 --- a/tests/hlsl/fx-syntax.shader_test +++ b/tests/hlsl/fx-syntax.shader_test @@ -266,7 +266,7 @@ float4 main() : sv_target { return 0; }
% Test effect groups syntax -[pixel shader todo fail(sm>=6)] +[pixel shader fail(sm>=6)] fxgroup group1 { technique10