Converts gl_VertexID to (gl_VertexIDMESA + gl_BaseVertex). gl_VertexIDMESA is backed by SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, and gl_BaseVertex is backed by SYSTEM_VALUE_BASE_VERTEX.
v2: Put the enum in struct gl_constants and propoerly resolve the scope in C++ code. Fix suggested by Marek.
v3: Reabase on Matt's foreach_in_list changes (was using foreach_list).
v4 (Ken): Use a systemvalue instead of a uniform because STATE_BASE_VERTEX has been removed.
v5: Use a boolean to select lowering, and only allow one lowering method. Suggested by Ken.
v6 (Ken): Replace strcmp against literal "gl_BaseVertex"/"gl_VertexID" with SYSTEM_VALUE enum checks, for efficiency.
v7: Rebase on context constant initialization work.
ec08b5e glsl: Add a lowering pass for gl_VertexID
src/glsl/Makefile.sources | 1 +
src/glsl/ir_optimization.h | 2 +
src/glsl/linker.cpp | 3 +
src/glsl/lower_vertex_id.cpp | 144 ++++++++++++++++++++++++++++++++++++++++++
src/mesa/main/context.c | 6 ++
src/mesa/main/mtypes.h | 9 +++
6 files changed, 165 insertions(+)
Upstream: cgit.freedesktop.org