OSDN Git Service

glsl: Allow built-in functions as constant expressions in OpenGL ES 1.00
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 9 Oct 2015 21:17:32 +0000 (14:17 -0700)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 21 Oct 2015 13:23:20 +0000 (14:23 +0100)
commitcd6ff70856f939bd1c1fbe3e5fb09a114e6f164d
tree0d42096a06f63a50a4d992bb85e051aa82309056
parent2ee32ffe7c2f64f40baffc0464d54ea3e974a74a
glsl: Allow built-in functions as constant expressions in OpenGL ES 1.00

In d4a24745 (August 2012), Paul made functions calls not be constant
expressions in GLSL ES 1.00.  Since this feature was added in desktop
GLSL 1.20, we believed that it was added in GLSL ES 3.00.  That turns
out to be completely wrong.  Built-in functions have always been allowed
as constant expressions in GLSL ES, and the patch adds the (many) spec
quotations to prove it.

While we never previously encountered this, a later patch enforces a GLSL
ES 1.00 rule that global variable initializers must be constant
expressions.  Without this fix, several dEQP tests fail.

Fixes:

    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.0 10.1 10.2 10.3 10.4 10.5 10.6 11.0" <mesa-stable@lists.freedesktop.org>
Yes, I know we don't maintain stable branches that far back, but that
*is* how far back this bug goes!

(cherry picked from commit 43b07eb60faba1c65fc6f7a99087d051b00e9c0f)
src/glsl/ast_function.cpp