[Mesa-dev] [PATCH 3/5] glsl: fall back to inexact function-match

Erik Faye-Lund erik.faye-lund at collabora.com
Thu Nov 1 09:59:59 UTC 2018


On Thu, 2018-11-01 at 07:49 +0200, Tapani Pälli wrote:
> 
> On 10/31/18 7:03 PM, Ilia Mirkin wrote:
> > On Wed, Oct 31, 2018 at 12:37 PM Erik Faye-Lund
> > <erik.faye-lund at collabora.com> wrote:
> > > 
> > > On Wed, 2018-10-31 at 12:01 -0400, Ilia Mirkin wrote:
> > > > I had to do a double (or triple) take on this logic as well.
> > > > Part of
> > > > the subtlety is that the fallback only applies for ES when
> > > > there's a
> > > > match but no exact match. Probably good to mention this.
> > > 
> > > Yeah, that makes sense. I thought I mentioneded this in the
> > > commit
> > > message, but perhaps you want that to be more explicit than the
> > > "In
> > > GLES, "-introduction?
> > > 
> > > How about I simply add something like "This fallback should only
> > > affect
> > > GLES." at the end of the commit message?
> > 
> > Yes, you did mention it in the commit message. But that's unlikely
> > to
> > be visible when reading this code. I was thinking something in this
> > function's comments would be nice.
> > 
> 
> Sounds good, I wouldn't be worried about saying it aloud, at least I 
> would love some 'spoon-feeding comments' now and then with compiler
> and 
> linker parts :)
> 
> 

OK, fair enough. How about this?

---8<---
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -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 th
e result
+    * of choose_best_inexact_overload() instead. This should only
affect
+    * GLES.
+    */
+   return sig ? sig : local_sig;
 }
 
 static ir_function_signature *
---8<---



More information about the mesa-dev mailing list