glsl: check if any of the named builtins are available first
authorIlia Mirkin <imirkin@alum.mit.edu>
Mon, 3 Jul 2017 21:08:12 +0000 (17:08 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 6 Jul 2017 00:05:53 +0000 (20:05 -0400)
commit880f21f55d579fe2183255d031c23343da30f69e
tree90bed3cbfae5903ce36f47973f9d1383094ae6e2
parentab1939aea8ff10d2e8b7d579575068ec11f60030
glsl: check if any of the named builtins are available first

_mesa_glsl_has_builtin_function is used to determine whether any variant
of a builtin are available, for the purpose of enforcing the GLSL ES
3.00+ rule that overloads or overrides of builtins are disallowed.

However the builtin_builder contains information on all builtins,
irrespective of parse state, or versions, or extension enablement. As a
result we would say that a builtin existed even if it was not actually
available.

To resolve this, first check if at least one signature is available for
a builtin before returning true.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101666
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/builtin_functions.h