[PATCH vkd3d 3/5] vkd3d-shader/hlsl: Use get_overloaded_func() only to find exact matches.

Zebediah Figura zfigura at codeweavers.com
Wed Sep 1 17:20:53 CDT 2021


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>
---
 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 ddc429ba..2512bcc0 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)
-- 
2.33.0




More information about the wine-devel mailing list