glsl: A shader cannot redefine or overload built-in functions in GLSL ES 3.00
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Tue, 25 Nov 2014 15:36:53 +0000 (16:36 +0100)
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Thu, 19 Feb 2015 09:05:33 +0000 (10:05 +0100)
commit187ace73a93d87122a977e4afade237be159ab04
treeac3e79cdf5a2163186cd065a6293eeb372de8ce6
parent19252fee46b835cb4f6b1cce18d7737d62b64a2e
glsl: A shader cannot redefine or overload built-in functions in GLSL ES 3.00

Create a new search function to look for matching built-in functions by name
and use it for built-in function redefinition or overload in GLSL ES 3.00.

GLSL ES 3.0 spec, chapter 6.1 "Function Definitions", page 71

  "A shader cannot redefine or overload built-in functions."

While in GLSL ES 1.0 specification, chapter 8 "Built-in Functions"

  "User code can overload the built-in functions but cannot redefine them."

So this check is specific to GLSL ES 3.00.

This patch fixes the following dEQP tests:

dEQP-GLES3.functional.shaders.functions.invalid.overload_builtin_function_vertex
dEQP-GLES3.functional.shaders.functions.invalid.overload_builtin_function_fragment
dEQP-GLES3.functional.shaders.functions.invalid.redefine_builtin_function_vertex
dEQP-GLES3.functional.shaders.functions.invalid.redefine_builtin_function_fragment

No piglit regressions.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp
src/glsl/builtin_functions.cpp
src/glsl/ir.h