Zebediah Figura : vkd3d-shader/hlsl: Use get_overloaded_func() only to find exact matches.

Alexandre Julliard julliard at winehq.org
Wed Sep 8 15:11:20 CDT 2021


Module: vkd3d
Branch: master
Commit: f86e4d6b92fac2154de96bbed021d4fc754dddf0
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=f86e4d6b92fac2154de96bbed021d4fc754dddf0

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Wed Sep  1 17:20:53 2021 -0500

vkd3d-shader/hlsl: Use get_overloaded_func() only to find exact matches.

The parameters are specified as a list of hlsl_ir_var structures, but
add_call() is given an array of hlsl_ir_node pointers. Even if the former were
changed to use an array instead, it's not worth trying to reuse the same
function for both cases.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/hlsl.y | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index ddc429b..2512bcc 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -790,25 +790,17 @@ static struct hlsl_reg_reservation parse_reg_reservation(const char *reg_string)
     return reservation;
 }
 
-static const struct hlsl_ir_function_decl *get_overloaded_func(struct rb_tree *funcs, char *name,
-        struct list *params, bool exact_signature)
+static const struct hlsl_ir_function_decl *get_func_decl(struct rb_tree *funcs, char *name, struct list *params)
 {
     struct hlsl_ir_function *func;
     struct rb_entry *entry;
 
-    entry = rb_get(funcs, name);
-    if (entry)
+    if ((entry = rb_get(funcs, name)))
     {
         func = RB_ENTRY_VALUE(entry, struct hlsl_ir_function, entry);
 
-        entry = rb_get(&func->overloads, params);
-        if (!entry)
-        {
-            if (!exact_signature)
-                FIXME("No exact match, search for a compatible overloaded function (if any).\n");
-            return NULL;
-        }
-        return RB_ENTRY_VALUE(entry, struct hlsl_ir_function_decl, entry);
+        if ((entry = rb_get(&func->overloads, params)))
+            return RB_ENTRY_VALUE(entry, struct hlsl_ir_function_decl, entry);
     }
     return NULL;
 }
@@ -1813,7 +1805,7 @@ hlsl_prog:
         {
             const struct hlsl_ir_function_decl *decl;
 
-            decl = get_overloaded_func(&ctx->functions, $2.name, $2.decl->parameters, true);
+            decl = get_func_decl(&ctx->functions, $2.name, $2.decl->parameters);
             if (decl && !decl->func->intrinsic)
             {
                 if (decl->body && $2.decl->body)




More information about the wine-cvs mailing list