glsl: add OES_viewport_array enables and use them to expose gl_ViewportIndex
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 16 Sep 2016 17:59:27 +0000 (13:59 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Fri, 23 Sep 2016 00:42:30 +0000 (20:42 -0400)
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl/glsl_parser_extras.h

index b66ad00d7ad3618bbf55075b6986de7016b62545..36a8667e2af12f3eb01f1a1a24418424c34a1711 100644 (file)
@@ -876,7 +876,8 @@ builtin_variable_generator::generate_constants()
    }
 
    if (state->is_version(410, 0) ||
-       state->ARB_viewport_array_enable)
+       state->ARB_viewport_array_enable ||
+       state->OES_viewport_array_enable)
       add_const("gl_MaxViewports", state->Const.MaxViewports);
 
    if (state->has_tessellation_shader()) {
@@ -1096,7 +1097,8 @@ builtin_variable_generator::generate_gs_special_vars()
 
    var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
    var->data.interpolation = INTERP_MODE_FLAT;
-   if (state->is_version(410, 0) || state->ARB_viewport_array_enable) {
+   if (state->is_version(410, 0) || state->ARB_viewport_array_enable ||
+       state->OES_viewport_array_enable) {
       var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
       var->data.interpolation = INTERP_MODE_FLAT;
    }
@@ -1226,7 +1228,8 @@ builtin_variable_generator::generate_fs_special_vars()
    }
 
    if (state->is_version(430, 0) ||
-       state->ARB_fragment_layer_viewport_enable) {
+       state->ARB_fragment_layer_viewport_enable ||
+       state->OES_viewport_array_enable) {
       var = add_input(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
       var->data.interpolation = INTERP_MODE_FLAT;
    }
index e19f6ade59a2ed991023ae2695cc78803d7dab3c..f4050e37de1196ca3572b2b0006e961b0bc21d94 100644 (file)
@@ -698,6 +698,8 @@ struct _mesa_glsl_parse_state {
    bool OES_texture_cube_map_array_warn;
    bool OES_texture_storage_multisample_2d_array_enable;
    bool OES_texture_storage_multisample_2d_array_warn;
+   bool OES_viewport_array_enable;
+   bool OES_viewport_array_warn;
 
    /* All other extensions go here, sorted alphabetically.
     */