diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 60aade73..a1ac594b 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -2965,6 +2965,30 @@ static struct hlsl_block *initialize_vars(struct hlsl_ctx *ctx, struct list *var return initializers; } +static bool func_is_exact_match(const struct hlsl_ir_function_decl *decl, + bool is_compile, const struct parse_initializer *args) +{ + unsigned int i, k; + + k = 0; + for (i = 0; i < decl->parameters.count; ++i) + { + if (is_compile && !(decl->parameters.vars[i]->storage_modifiers & HLSL_STORAGE_UNIFORM)) + continue; + + if (k >= args->args_count) + return false; + + if (!hlsl_types_are_equal(decl->parameters.vars[i]->data_type, args->args[i]->data_type)) + return false; + + ++k; + } + if (k < args->args_count) + return false; + return true; +} + static bool func_is_compatible_match(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *decl, bool is_compile, const struct parse_initializer *args) { @@ -3007,6 +3031,9 @@ static struct hlsl_ir_function_decl *find_function_call(struct hlsl_ctx *ctx, LIST_FOR_EACH_ENTRY(decl, &func->overloads, struct hlsl_ir_function_decl, entry) { + if (func_is_exact_match(decl, is_compile, args)) + return decl; + if (func_is_compatible_match(ctx, decl, is_compile, args)) { if (compatible_match) diff --git a/tests/hlsl/function-overload.shader_test b/tests/hlsl/function-overload.shader_test index 2be46a4d..7c9cf797 100644 --- a/tests/hlsl/function-overload.shader_test +++ b/tests/hlsl/function-overload.shader_test @@ -58,7 +58,7 @@ float4 main() : sv_target } -[pixel shader todo] +[pixel shader] float func(int arg) { return 1.0; @@ -78,8 +78,8 @@ float4 main() : sv_target } [test] -todo(sm<6) draw quad -todo(sm<6) probe (0,0) rgba (1.0, 2.0, 2.0, 2.0) +draw quad +probe (0,0) rgba (1.0, 2.0, 2.0, 2.0) % float and float1 can be defined separately... diff --git a/tests/hlsl/refract.shader_test b/tests/hlsl/refract.shader_test index 7ebc3d77..4520d8c6 100644 --- a/tests/hlsl/refract.shader_test +++ b/tests/hlsl/refract.shader_test @@ -204,7 +204,7 @@ float4 main() : sv_target return refract(r, n, i); } -[pixel shader todo(sm<6)] +[pixel shader] float4 r; float4 n; float i; @@ -228,6 +228,6 @@ float4 main() : sv_target } [test] -todo(sm<6) draw quad +draw quad if(sm<6) probe (0,0) rgba (2.0, 1.0, 1.0, 1.0) if(sm>=6) probe (0,0) rgba (1.0, 1.0, 1.0, 1.0)