OSDN Git Service

glsl/cs: Exclude gl_LocalInvocationIndex from builtin variable stripping
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 17 Aug 2015 22:49:44 +0000 (15:49 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sun, 13 Sep 2015 16:53:16 +0000 (09:53 -0700)
commit6823e12d5aa4646fc8ef0e32455104ba47f80a38
tree1a49041f7ab7e32a4a1884b762f92f8afb727fb4
parent2b6cc0395be4c3eb1c60c0d7a413e368b5ae3dbf
glsl/cs: Exclude gl_LocalInvocationIndex from builtin variable stripping

We lower gl_LocalInvocationIndex based on the extension spec formula:

    gl_LocalInvocationIndex =
        gl_LocalInvocationID.z * gl_WorkGroupSize.x * gl_WorkGroupSize.y +
        gl_LocalInvocationID.y * gl_WorkGroupSize.x +
        gl_LocalInvocationID.x;

https://www.opengl.org/registry/specs/ARB/compute_shader.txt

We need to set this variable in main(), even if gl_LocalInvocationIndex
is not referenced by the shader. (It may be used by a linked shader.)
Therefore, we can't eliminate it as a dead variable.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
src/glsl/opt_dead_builtin_variables.cpp