diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-03-21 17:03:09 -0500 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-03-21 18:08:39 -0500 |
commit | 6d8c5c46b96f3d2f086b81e0ba4dd0d47eb25569 (patch) | |
tree | 3209230311d8784e36d82c74997c8f81077e77ac | |
parent | 437627a4b140ef2e0786a0b21908d12b7c9fb968 (diff) |
glsl: non-constant indexes of ssbo arrays are always allowed in OpenGLssbo
ARB_shader_storage_buffer_object already says so. Actually, the language
of that extension also implicitly allows non-constant indexes for ubo
arrays, which this patch does not address. I'm not sure that it should,
since this is such a weird corner of spec lawyering.
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r-- | src/compiler/glsl/ast_array_index.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/glsl/ast_array_index.cpp b/src/compiler/glsl/ast_array_index.cpp index 69322cf111..bf8f3310ab 100644 --- a/src/compiler/glsl/ast_array_index.cpp +++ b/src/compiler/glsl/ast_array_index.cpp @@ -242,8 +242,7 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, && !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))) { + && state->es_shader))) { /* 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 @@ -252,6 +251,13 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow indexing * on uniform blocks but not shader storage blocks. * + * This restriction never applies to shader storage blocks in OpenGL, + * because the ARB_shader_storage_buffer_object spec says: + * + * "A uniform or shader storage block array can only be indexed + * with a dynamically uniform integral expression, otherwise + * results are undefined." + * */ _mesa_glsl_error(&loc, state, "%s block array index must be constant", array->variable_referenced()->data.mode |