From: Zebediah Figura zfigura@codeweavers.com
--- libs/vkd3d-shader/hlsl.y | 20 ++++++++++++++------ tests/hlsl-function.shader_test | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 3bad2acc..7caba3e0 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -3721,6 +3721,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl %type <type> unnamed_struct_spec %type <type> struct_spec %type <type> type +%type <type> type_no_void %type <type> typedef_type
%type <variable_def> type_spec @@ -4233,6 +4234,10 @@ parameters: { memset(&$$, 0, sizeof($$)); } + | scope_start KW_VOID + { + memset(&$$, 0, sizeof($$)); + } | scope_start param_list { $$ = $2; @@ -4260,7 +4265,7 @@ param_list: }
parameter: - var_modifiers type any_identifier colon_attribute + var_modifiers type_no_void any_identifier colon_attribute { struct hlsl_type *type; unsigned int modifiers = $1; @@ -4321,7 +4326,7 @@ uav_type: $$ = HLSL_SAMPLER_DIM_3D; }
-type: +type_no_void: KW_VECTOR '<' type ',' C_INTEGER '>' { if ($3->type != HLSL_CLASS_SCALAR) @@ -4382,10 +4387,6 @@ type: { $$ = hlsl_get_matrix_type(ctx, HLSL_TYPE_FLOAT, 4, 4); } - | KW_VOID - { - $$ = ctx->builtin_types.Void; - } | KW_SAMPLER { $$ = ctx->builtin_types.sampler[HLSL_SAMPLER_DIM_GENERIC]; @@ -4467,6 +4468,13 @@ type: vkd3d_free($2); }
+type: + type_no_void + | KW_VOID + { + $$ = ctx->builtin_types.Void; + } + declaration_statement: declaration | struct_declaration diff --git a/tests/hlsl-function.shader_test b/tests/hlsl-function.shader_test index 80412727..75521d4d 100644 --- a/tests/hlsl-function.shader_test +++ b/tests/hlsl-function.shader_test @@ -149,7 +149,7 @@ void func() { }
-[pixel shader todo] +[pixel shader]
/* This is something of an internal test: we need to make sure that we use the * correct variables for a function's arguments and returns regardless of @@ -176,7 +176,7 @@ float4 main() : sv_target }
[test] -todo draw quad +draw quad todo probe all rgba (0.1, 0.2, 0.3, 0.4)
[pixel shader]
From: Zebediah Figura zfigura@codeweavers.com
Fixes: 4c46075d864c2959a0c042c6bc7201fc40c414ba --- libs/vkd3d-shader/hlsl.y | 3 ++- tests/hlsl-function.shader_test | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 7caba3e0..95c1c0fa 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -4138,12 +4138,13 @@ func_prototype_no_attrs: { if (!($$.decl = hlsl_new_func_decl(ctx, type, &$5, &$7.semantic, &@3))) YYABORT; - ctx->cur_function = $$.decl;
hlsl_add_function(ctx, $3, $$.decl);
$$.first = true; } + + ctx->cur_function = $$.decl; }
func_prototype: diff --git a/tests/hlsl-function.shader_test b/tests/hlsl-function.shader_test index 75521d4d..c836808d 100644 --- a/tests/hlsl-function.shader_test +++ b/tests/hlsl-function.shader_test @@ -177,7 +177,7 @@ float4 main() : sv_target
[test] draw quad -todo probe all rgba (0.1, 0.2, 0.3, 0.4) +probe all rgba (0.1, 0.2, 0.3, 0.4)
[pixel shader]
This merge request was approved by Giovanni Mascellani.
This merge request was approved by Francisco Casas.
This merge request was approved by Henri Verbeet.