glsl: add support for AMD_vertex_shader_viewport_index
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 2 Jul 2014 16:12:51 +0000 (12:12 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 3 Jul 2014 01:59:38 +0000 (21:59 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Tested-by: Tobias Droste <tdroste@gmx.de>
src/glsl/builtin_variables.cpp
src/glsl/glcpp/glcpp-parse.y
src/glsl/glsl_parser_extras.cpp
src/glsl/glsl_parser_extras.h

index 9f9571619ba13b6958ad2165ce85343c5f23de7f..34973023fe9ddab58e8e842a8ba47c56494ebd62 100644 (file)
@@ -815,6 +815,8 @@ builtin_variable_generator::generate_vs_special_vars()
       add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, "gl_InstanceID");
    if (state->AMD_vertex_shader_layer_enable)
       add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
+   if (state->AMD_vertex_shader_viewport_index_enable)
+      add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
    if (compatibility) {
       add_input(VERT_ATTRIB_POS, vec4_t, "gl_Vertex");
       add_input(VERT_ATTRIB_NORMAL, vec3_t, "gl_Normal");
index d8c395778abfbd75b9fb8e53db3d99581d513c83..ccf8105597bab0e7eb6a6d4cb20f4fa02b54f368 100644 (file)
@@ -2133,6 +2133,9 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
              if (extensions->AMD_vertex_shader_layer)
                 add_builtin_define(parser, "GL_AMD_vertex_shader_layer", 1);
 
+             if (extensions->AMD_vertex_shader_viewport_index)
+                add_builtin_define(parser, "GL_AMD_vertex_shader_viewport_index", 1);
+
              if (extensions->ARB_shading_language_420pack)
                 add_builtin_define(parser, "GL_ARB_shading_language_420pack", 1);
 
index 0d993397e40d4ac6c358b25258ae728462c61239..b327c2b4319b3ab5bb77266837726f0ba489dc51 100644 (file)
@@ -552,6 +552,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
    EXT(AMD_shader_stencil_export,      true,  false,     ARB_shader_stencil_export),
    EXT(AMD_shader_trinary_minmax,      true,  false,     dummy_true),
    EXT(AMD_vertex_shader_layer,        true,  false,     AMD_vertex_shader_layer),
+   EXT(AMD_vertex_shader_viewport_index, true,  false,   AMD_vertex_shader_viewport_index),
    EXT(EXT_separate_shader_objects,    false, true,      dummy_true),
    EXT(EXT_shader_integer_mix,         true,  true,      EXT_shader_integer_mix),
    EXT(EXT_texture_array,              true,  false,     EXT_texture_array),
index a0af965fd233c561654d4c47f22da1373039e620..17918163e3120c9f72b8a3dd862b1e4a7c581f80 100644 (file)
@@ -461,6 +461,8 @@ struct _mesa_glsl_parse_state {
    bool AMD_shader_trinary_minmax_warn;
    bool AMD_vertex_shader_layer_enable;
    bool AMD_vertex_shader_layer_warn;
+   bool AMD_vertex_shader_viewport_index_enable;
+   bool AMD_vertex_shader_viewport_index_warn;
    bool EXT_separate_shader_objects_enable;
    bool EXT_separate_shader_objects_warn;
    bool EXT_shader_integer_mix_enable;