[Mesa-dev] [PATCH 14/18] mesa: Add gl_ViewportIndex variable to GLSL

Courtney Goeltzenleuchter courtney at lunarg.com
Wed Nov 20 14:59:30 PST 2013


Signed-off-by: Courtney Goeltzenleuchter <courtney at LunarG.com>
---
 src/glsl/builtin_variables.cpp | 2 ++
 src/glsl/glsl_parser_extras.h  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 4d44104..862d255 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -778,6 +778,8 @@ void
 builtin_variable_generator::generate_gs_special_vars()
 {
    add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
+   if (state->ARB_viewport_array_enable)
+      add_output(VARYING_SLOT_LAYER, int_t, "gl_ViewportIndex");
 
    /* Although gl_PrimitiveID appears in tessellation control and tessellation
     * evaluation shaders, it has a different function there than it has in
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index d232bb3..5257a84 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -356,6 +356,7 @@ struct _mesa_glsl_parse_state {
    bool EXT_shader_integer_mix_warn;
    bool ARB_shader_atomic_counters_enable;
    bool ARB_shader_atomic_counters_warn;
+   bool ARB_viewport_array_enable;
    /*@}*/
 
    /** Extensions supported by the OpenGL implementation. */
-- 
1.8.1.2



More information about the mesa-dev mailing list