summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_array_index.cpp
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2015-06-16 02:43:55 +0200
committerMarek Olšák <marek.olsak@amd.com>2015-07-23 00:59:28 +0200
commitd5787e7eef7c42e4a90cbd89dee81efbf1491487 (patch)
treeba136e4f7260b22f0337060cdc1241484b34ebd0 /src/glsl/ast_array_index.cpp
parent19f46d0540d9557a4d458ceb72f27ece28fa935e (diff)
downloadexternal_mesa3d-d5787e7eef7c42e4a90cbd89dee81efbf1491487.zip
external_mesa3d-d5787e7eef7c42e4a90cbd89dee81efbf1491487.tar.gz
external_mesa3d-d5787e7eef7c42e4a90cbd89dee81efbf1491487.tar.bz2
glsl: allow indexing of gl_out with a non-const if length isn't known
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/glsl/ast_array_index.cpp')
-rw-r--r--src/glsl/ast_array_index.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/ast_array_index.cpp b/src/glsl/ast_array_index.cpp
index 50971bb..27e84d1 100644
--- a/src/glsl/ast_array_index.cpp
+++ b/src/glsl/ast_array_index.cpp
@@ -216,6 +216,16 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
if (v != NULL)
v->data.max_array_access = implicit_size - 1;
}
+ else if (state->stage == MESA_SHADER_TESS_CTRL &&
+ array->variable_referenced()->data.mode == ir_var_shader_out &&
+ !array->variable_referenced()->data.patch) {
+ /* Tessellation control shader output non-patch arrays are
+ * initially unsized. Despite that, they are allowed to be
+ * indexed with a non-constant expression (typically
+ * "gl_InvocationID"). The array size will be determined
+ * by the linker.
+ */
+ }
else {
_mesa_glsl_error(&loc, state, "unsized array index must be constant");
}