diff options
author | Paul Berry <[email protected]> | 2014-01-06 13:31:58 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2014-02-05 09:01:54 -0800 |
commit | 347dde82e65663562d6d2930bf861ec8c8079362 (patch) | |
tree | 5d01ef522b21bf323892375a5d3cd406efcc1b38 /src/glsl/builtin_variables.cpp | |
parent | 47d480e3e4850ef8934775570444feea503295d7 (diff) |
mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_SIZE constant.
v2: Document that the 3-element array MaxComputeWorkGroupSize is
indexed by dimension.
Reviewed-by: Matt Turner <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/glsl/builtin_variables.cpp')
-rw-r--r-- | src/glsl/builtin_variables.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index df560fbbf65..f96d4895d5f 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -390,6 +390,7 @@ private: enum ir_variable_mode mode, int slot); ir_variable *add_uniform(const glsl_type *type, const char *name); ir_variable *add_const(const char *name, int value); + ir_variable *add_const_ivec3(const char *name, int x, int y, int z); void add_varying(int slot, const glsl_type *type, const char *name, const char *name_as_gs_input); @@ -530,6 +531,25 @@ builtin_variable_generator::add_const(const char *name, int value) } +ir_variable * +builtin_variable_generator::add_const_ivec3(const char *name, int x, int y, + int z) +{ + ir_variable *const var = add_variable(name, glsl_type::ivec3_type, + ir_var_auto, -1); + ir_constant_data data; + memset(&data, 0, sizeof(data)); + data.i[0] = x; + data.i[1] = y; + data.i[2] = z; + var->constant_value = new(var) ir_constant(glsl_type::ivec3_type, &data); + var->constant_initializer = + new(var) ir_constant(glsl_type::ivec3_type, &data); + var->data.has_initializer = true; + return var; +} + + void builtin_variable_generator::generate_constants() { @@ -660,6 +680,13 @@ builtin_variable_generator::generate_constants() add_const("gl_MaxTessControlAtomicCounters", 0); add_const("gl_MaxTessEvaluationAtomicCounters", 0); } + + if (state->is_version(430, 0) || state->ARB_compute_shader_enable) { + add_const_ivec3("gl_MaxComputeWorkGroupSize", + state->Const.MaxComputeWorkGroupSize[0], + state->Const.MaxComputeWorkGroupSize[1], + state->Const.MaxComputeWorkGroupSize[2]); + } } |