summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/glsl/builtin_variables.cpp4
-rw-r--r--src/glsl/glsl_parser_extras.cpp2
-rw-r--r--src/glsl/glsl_parser_extras.h1
-rw-r--r--src/glsl/main.cpp3
-rw-r--r--src/glsl/standalone_scaffolding.cpp3
-rw-r--r--src/mesa/main/context.c3
-rw-r--r--src/mesa/main/get.c8
-rw-r--r--src/mesa/main/mtypes.h1
8 files changed, 25 insertions, 0 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
index f96d4895d5f..3e7a84521e9 100644
--- a/src/glsl/builtin_variables.cpp
+++ b/src/glsl/builtin_variables.cpp
@@ -682,6 +682,10 @@ builtin_variable_generator::generate_constants()
}
if (state->is_version(430, 0) || state->ARB_compute_shader_enable) {
+ add_const_ivec3("gl_MaxComputeWorkGroupCount",
+ state->Const.MaxComputeWorkGroupCount[0],
+ state->Const.MaxComputeWorkGroupCount[1],
+ state->Const.MaxComputeWorkGroupCount[2]);
add_const_ivec3("gl_MaxComputeWorkGroupSize",
state->Const.MaxComputeWorkGroupSize[0],
state->Const.MaxComputeWorkGroupSize[1],
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index d256680e8ea..d45e63f9d2f 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -124,6 +124,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
/* Compute shader constants */
+ for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupCount); i++)
+ this->Const.MaxComputeWorkGroupCount[i] = ctx->Const.MaxComputeWorkGroupCount[i];
for (unsigned i = 0; i < Elements(this->Const.MaxComputeWorkGroupSize); i++)
this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 802e0f0e635..20ed2cfddc6 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -252,6 +252,7 @@ struct _mesa_glsl_parse_state {
unsigned MaxAtomicBufferBindings;
/* ARB_compute_shader */
+ unsigned MaxComputeWorkGroupCount[3];
unsigned MaxComputeWorkGroupSize[3];
} Const;
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 94bc1cc5e91..5ea57d53a88 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -50,6 +50,9 @@ initialize_context(struct gl_context *ctx, gl_api api)
*/
ctx->Const.GLSLVersion = glsl_version;
ctx->Extensions.ARB_ES3_compatibility = true;
+ ctx->Const.MaxComputeWorkGroupCount[0] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[1] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[2] = 65535;
ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
ctx->Const.MaxComputeWorkGroupSize[2] = 64;
diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index 475fbd8edc8..6c25010b7d9 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -141,6 +141,9 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 32;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxComputeWorkGroupCount[0] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[1] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[2] = 65535;
ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
ctx->Const.MaxComputeWorkGroupSize[2] = 64;
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 4cf86bc5150..f2f9bb3ed5c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -702,6 +702,9 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxVertexAttribBindings = MAX_VERTEX_GENERIC_ATTRIBS;
/* GL_ARB_compute_shader */
+ ctx->Const.MaxComputeWorkGroupCount[0] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[1] = 65535;
+ ctx->Const.MaxComputeWorkGroupCount[2] = 65535;
ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
ctx->Const.MaxComputeWorkGroupSize[2] = 64;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 2833a15a433..32aa7364a91 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1929,6 +1929,14 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
v->value_int = ctx->ImageUnits[index].Format;
return TYPE_INT;
+ case GL_MAX_COMPUTE_WORK_GROUP_COUNT:
+ if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader)
+ goto invalid_enum;
+ if (index >= 3)
+ goto invalid_value;
+ v->value_int = ctx->Const.MaxComputeWorkGroupCount[index];
+ return TYPE_INT;
+
case GL_MAX_COMPUTE_WORK_GROUP_SIZE:
if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader)
goto invalid_enum;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 40e2e68f2d7..bd22d5003fd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3380,6 +3380,7 @@ struct gl_constants
GLuint MaxCombinedImageUniforms;
/** GL_ARB_compute_shader */
+ GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */
GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */
GLuint MaxComputeWorkGroupInvocations;
};