summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Justen <[email protected]>2014-10-10 08:28:24 -0700
committerJordan Justen <[email protected]>2015-09-13 09:53:16 -0700
commitbf8d6e501c58b3d6c06056b663ec99b9c7eeb9cf (patch)
treedd9ddba6459f321d2300f05b787399eafa816e6c
parent08ceb5e076328bf6ccceed3a8e5de205dcaf63b0 (diff)
glsl/cs: Add gl_LocalInvocationID variable
Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Iago Toral Quiroga <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
-rw-r--r--src/glsl/builtin_variables.cpp4
-rw-r--r--src/glsl/shader_enums.h9
2 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index cf1be037525..f185d939444 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -402,6 +402,7 @@ private:
const glsl_type * const vec2_t;
const glsl_type * const vec3_t;
const glsl_type * const vec4_t;
+ const glsl_type * const uvec3_t;
const glsl_type * const mat3_t;
const glsl_type * const mat4_t;
@@ -417,6 +418,7 @@ builtin_variable_generator::builtin_variable_generator(
bool_t(glsl_type::bool_type), int_t(glsl_type::int_type),
float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type),
vec3_t(glsl_type::vec3_type), vec4_t(glsl_type::vec4_type),
+ uvec3_t(glsl_type::uvec3_type),
mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type)
{
}
@@ -1051,6 +1053,8 @@ builtin_variable_generator::generate_fs_special_vars()
void
builtin_variable_generator::generate_cs_special_vars()
{
+ add_system_value(SYSTEM_VALUE_LOCAL_INVOCATION_ID, uvec3_t,
+ "gl_LocalInvocationID");
/* TODO: finish this. */
}
diff --git a/src/glsl/shader_enums.h b/src/glsl/shader_enums.h
index 9bb163f3bb0..3b80a1dd4ce 100644
--- a/src/glsl/shader_enums.h
+++ b/src/glsl/shader_enums.h
@@ -238,6 +238,8 @@ typedef enum
#define SYSTEM_BIT_SAMPLE_ID ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_ID)
#define SYSTEM_BIT_SAMPLE_POS ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_POS)
#define SYSTEM_BIT_SAMPLE_MASK_IN ((uint64_t)1 << SYSTEM_VALUE_SAMPLE_MASK_IN)
+#define SYSTEM_BIT_LOCAL_INVOCATION_ID ((uint64_t)1 << SYSTEM_VALUE_LOCAL_INVOCATION_ID)
+
/**
* If the gl_register_file is PROGRAM_SYSTEM_VALUE, the register index will be
* one of these values. If a NIR variable's mode is nir_var_system_value, it
@@ -363,6 +365,13 @@ typedef enum
SYSTEM_VALUE_TESS_LEVEL_INNER, /**< TES input */
/*@}*/
+ /**
+ * \name Compute shader system values
+ */
+ /*@{*/
+ SYSTEM_VALUE_LOCAL_INVOCATION_ID,
+ /*@}*/
+
SYSTEM_VALUE_MAX /**< Number of values */
} gl_system_value;