From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.y | 19 +++++++++++++++++-- tests/hlsl/technique-fx_5.shader_test | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 07662bf9..8b0a7c21 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -445,7 +445,7 @@ struct hlsl_effect_group struct list entry; char *name; struct hlsl_technique **techniques; - unsigned int count; + size_t count, capacity; };
/* Sized array of variables representing a function's parameters. */ diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 82ed99e6..e4c97d78 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -5042,6 +5042,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls
%type <switch_case> switch_case
+%type <technique> default_group_technique %type <technique> technique %type <technique> technique9 %type <technique> technique10 @@ -5074,7 +5075,7 @@ hlsl_prog: destroy_block($2); } | hlsl_prog preproc_directive - | hlsl_prog technique + | hlsl_prog default_group_technique | hlsl_prog effect_group | hlsl_prog ';'
@@ -5114,9 +5115,23 @@ technique11: $$ = create_technique(ctx, $2, &@2); }
-technique: +default_group_technique: technique9 | technique10 + | technique11 + { + struct hlsl_effect_group *group = &ctx->default_effect_group; + + if (!hlsl_array_reserve(ctx, (void **)&group->techniques, &group->capacity, + group->count + 1, sizeof(*group->techniques))) + { + YYABORT; + } + group->techniques[group->count++] = $1; + } + +technique: + technique10 | technique11 { $$ = $1; diff --git a/tests/hlsl/technique-fx_5.shader_test b/tests/hlsl/technique-fx_5.shader_test index 0ef88cd0..0826c20b 100644 --- a/tests/hlsl/technique-fx_5.shader_test +++ b/tests/hlsl/technique-fx_5.shader_test @@ -184,3 +184,17 @@ fxgroup group2 { technique11 tech0 {} } + +% fx_4_x techniques are allowed in explicit groups, fx_2_0 ones are not +[effect fail] +fxgroup group +{ + technique t1 {} + technique10 t2 {} +} + +[effect todo] +fxgroup group +{ + technique10 {} +}