summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtin_variables.cpp
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2014-01-06 09:09:31 -0800
committerPaul Berry <[email protected]>2014-02-05 09:03:44 -0800
commit0fa74e848fd11c71bb70ea0a69650944e4f07571 (patch)
treee9b9cd5e6888095286ce703847548cdf98528f02 /src/glsl/builtin_variables.cpp
parent0398b69954eb8e73e9ae663ce200170ff70d216d (diff)
glsl/cs: Handle compute shader local_size_{x,y,z} declaration.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl/builtin_variables.cpp')
-rw-r--r--src/glsl/builtin_variables.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index 3e7a84521e9..cc423383df8 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -690,6 +690,26 @@ builtin_variable_generator::generate_constants()
state->Const.MaxComputeWorkGroupSize[0],
state->Const.MaxComputeWorkGroupSize[1],
state->Const.MaxComputeWorkGroupSize[2]);
+
+ /* From the GLSL 4.40 spec, section 7.1 (Built-In Language Variables):
+ *
+ * The built-in constant gl_WorkGroupSize is a compute-shader
+ * constant containing the local work-group size of the shader. The
+ * size of the work group in the X, Y, and Z dimensions is stored in
+ * the x, y, and z components. The constants values in
+ * gl_WorkGroupSize will match those specified in the required
+ * local_size_x, local_size_y, and local_size_z layout qualifiers
+ * for the current shader. This is a constant so that it can be
+ * used to size arrays of memory that can be shared within the local
+ * work group. It is a compile-time error to use gl_WorkGroupSize
+ * in a shader that does not declare a fixed local group size, or
+ * before that shader has declared a fixed local group size, using
+ * local_size_x, local_size_y, and local_size_z.
+ *
+ * To prevent the shader from trying to refer to gl_WorkGroupSize before
+ * the layout declaration, we don't define it here. Intead we define it
+ * in ast_cs_input_layout::hir().
+ */
}
}