Revert "glsl: move xfb BufferStride into gl_transform_feedback_info"
[mesa.git] / src / compiler / glsl / ast_array_index.cpp
index f5baeb9ea32fad96bf093369c19afee1c5aab0a0..2e36035f9f427218cda4f1b7ac0d020aab232094 100644 (file)
@@ -92,12 +92,12 @@ update_max_array_access(ir_rvalue *ir, int idx, YYLTYPE *loc,
                deref_record->record->type->field_index(deref_record->field);
             assert(field_index < deref_var->var->get_interface_type()->length);
 
-            unsigned *const max_ifc_array_access =
+            int *const max_ifc_array_access =
                deref_var->var->get_max_ifc_array_access();
 
             assert(max_ifc_array_access != NULL);
 
-            if (idx > (int)max_ifc_array_access[field_index]) {
+            if (idx > max_ifc_array_access[field_index]) {
                max_ifc_array_access[field_index] = idx;
 
                /* Check whether this access will, as a side effect, implicitly
@@ -236,14 +236,23 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
             _mesa_glsl_error(&loc, state, "unsized array index must be constant");
          }
       } else if (array->type->without_array()->is_interface()
-                 && (array->variable_referenced()->data.mode == ir_var_uniform ||
-                     array->variable_referenced()->data.mode == ir_var_shader_storage)
-                 && !state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
-        /* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
-         *
-         *     "All indices used to index a uniform or shader storage block
-         *     array must be constant integral expressions."
-         */
+                 && ((array->variable_referenced()->data.mode == ir_var_uniform
+                      && !state->is_version(400, 320)
+                      && !state->ARB_gpu_shader5_enable
+                      && !state->EXT_gpu_shader5_enable
+                      && !state->OES_gpu_shader5_enable) ||
+                     (array->variable_referenced()->data.mode == ir_var_shader_storage
+                      && !state->is_version(400, 0)
+                      && !state->ARB_gpu_shader5_enable))) {
+         /* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
+          *
+          *     "All indices used to index a uniform or shader storage block
+          *     array must be constant integral expressions."
+          *
+          * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow indexing
+          * on uniform blocks but not shader storage blocks.
+          *
+          */
         _mesa_glsl_error(&loc, state, "%s block array index must be constant",
                           array->variable_referenced()->data.mode
                           == ir_var_uniform ? "uniform" : "shader storage");
@@ -279,7 +288,10 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
        * dynamically uniform expression is undefined.
        */
       if (array->type->without_array()->is_sampler()) {
-         if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
+         if (!state->is_version(400, 320) &&
+             !state->ARB_gpu_shader5_enable &&
+             !state->EXT_gpu_shader5_enable &&
+             !state->OES_gpu_shader5_enable) {
             if (state->is_version(130, 300))
                _mesa_glsl_error(&loc, state,
                                 "sampler arrays indexed with non-constant "