[Mesa-dev] [PATCH 5/5] glsl: Clarify ir_function::matching_sigature()

Chad Versace chad at chad-versace.us
Wed Jul 27 22:55:37 PDT 2011


The function used a variable named 'score', which was an outright lie.
A signature matches or it doesn't; there is no fuzzy scoring.

CC: Ian Romanick <ian.d.romanick at intel.com>
CC: Kenneth Graunke <kenneth at whitecape.org>
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
 src/glsl/ir_function.cpp |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/glsl/ir_function.cpp b/src/glsl/ir_function.cpp
index e25b094..5a2c9bb 100644
--- a/src/glsl/ir_function.cpp
+++ b/src/glsl/ir_function.cpp
@@ -134,18 +134,23 @@ ir_function::matching_signature(const exec_list *actual_parameters)
       ir_function_signature *const sig =
 	 (ir_function_signature *) iter.get();
 
-      const int score = parameter_lists_match(& sig->parameters,
-					      actual_parameters);
-
-      /* If we found an exact match, simply return it */
-      if (score == 0)
+      switch (parameter_lists_match(& sig->parameters, actual_parameters)) {
+      case 0:
+	 /* Exact match. */
 	 return sig;
-
-      if (score > 0) {
+      case 1:
+	 /* Inexact match that requires implicit conversion. */
 	 if (match == NULL)
 	    match = sig;
 	 else
 	    multiple_inexact_matches = true;
+	 continue;
+      case -1:
+	 /* Not a match. */
+	 continue;
+      default:
+	 assert(false);
+	 return NULL;
       }
    }
 
-- 
1.7.6



More information about the mesa-dev mailing list