glsl: fall back to inexact function-match
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 30 Oct 2018 14:15:58 +0000 (15:15 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 2 Nov 2018 10:10:36 +0000 (11:10 +0100)
In GLES, we currently either need an exact match with a local function,
or an exact match with a builtin.

However, if we add support for implicit conversions for GLES shaders,
we also need to fall back to a non-exact match in the case where there
were no builtin match either.

Luckily, we already have a variable ready with this, so let's just
return it if the builtin-search failed.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/compiler/glsl/ast_function.cpp

index 1fa3f7561aee16348f8d6d6b5b00f37857865f3a..ee68d0e17e7518b08283afe8f1d9ac95ff7a5694 100644 (file)
@@ -667,7 +667,12 @@ match_function_by_name(const char *name,
    /* Local shader has no exact candidates; check the built-ins. */
    _mesa_glsl_initialize_builtin_functions();
    sig = _mesa_glsl_find_builtin_function(state, name, actual_parameters);
-   return sig;
+
+   /* if _mesa_glsl_find_builtin_function failed, fall back to the result
+    * of choose_best_inexact_overload() instead. This should only affect
+    * GLES.
+    */
+   return sig ? sig : local_sig;
 }
 
 static ir_function_signature *