summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-01-20 03:06:53 -0500
committerSamuel Pitoiset <[email protected]>2016-02-13 15:51:17 +0100
commitf2547883cfcc7c7629e09cb38c162ad7f5d77611 (patch)
tree476db9272e537ab408be847f6eb2b23cc40dba05 /src/compiler
parentf709a0845792540544982740fa47be672825ee8a (diff)
mesa: make compute maximums reflect driver-provided values
Looks like the various max's were never plumbed through. Signed-off-by: Ilia Mirkin <[email protected]> Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/builtin_variables.cpp15
-rw-r--r--src/compiler/glsl/glsl_parser_extras.cpp7
-rw-r--r--src/compiler/glsl/glsl_parser_extras.h5
-rw-r--r--src/compiler/glsl/main.cpp4
4 files changed, 26 insertions, 5 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index 6db74f1c634..d20fc4a816c 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -770,11 +770,16 @@ builtin_variable_generator::generate_constants()
}
if (state->is_version(430, 310) || state->ARB_compute_shader_enable) {
- add_const("gl_MaxComputeAtomicCounterBuffers", MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS);
- add_const("gl_MaxComputeAtomicCounters", MAX_COMPUTE_ATOMIC_COUNTERS);
- add_const("gl_MaxComputeImageUniforms", MAX_COMPUTE_IMAGE_UNIFORMS);
- add_const("gl_MaxComputeTextureImageUnits", MAX_COMPUTE_TEXTURE_IMAGE_UNITS);
- add_const("gl_MaxComputeUniformComponents", MAX_COMPUTE_UNIFORM_COMPONENTS);
+ add_const("gl_MaxComputeAtomicCounterBuffers",
+ state->Const.MaxComputeAtomicCounterBuffers);
+ add_const("gl_MaxComputeAtomicCounters",
+ state->Const.MaxComputeAtomicCounters);
+ add_const("gl_MaxComputeImageUniforms",
+ state->Const.MaxComputeImageUniforms);
+ add_const("gl_MaxComputeTextureImageUnits",
+ state->Const.MaxComputeTextureImageUnits);
+ add_const("gl_MaxComputeUniformComponents",
+ state->Const.MaxComputeUniformComponents);
add_const_ivec3("gl_MaxComputeWorkGroupCount",
state->Const.MaxComputeWorkGroupCount[0],
diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
index f020e8002af..fbac8366bd1 100644
--- a/src/compiler/glsl/glsl_parser_extras.cpp
+++ b/src/compiler/glsl/glsl_parser_extras.cpp
@@ -118,6 +118,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxTessEvaluationAtomicCounters = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxAtomicCounters;
this->Const.MaxGeometryAtomicCounters = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters;
this->Const.MaxFragmentAtomicCounters = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters;
+ this->Const.MaxComputeAtomicCounters = ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicCounters;
this->Const.MaxCombinedAtomicCounters = ctx->Const.MaxCombinedAtomicCounters;
this->Const.MaxAtomicBufferBindings = ctx->Const.MaxAtomicBufferBindings;
this->Const.MaxVertexAtomicCounterBuffers =
@@ -130,6 +131,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers;
this->Const.MaxFragmentAtomicCounterBuffers =
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers;
+ this->Const.MaxComputeAtomicCounterBuffers =
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicBuffers;
this->Const.MaxCombinedAtomicCounterBuffers =
ctx->Const.MaxCombinedAtomicBuffers;
this->Const.MaxAtomicCounterBufferSize =
@@ -141,6 +144,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
for (unsigned i = 0; i < ARRAY_SIZE(this->Const.MaxComputeWorkGroupSize); i++)
this->Const.MaxComputeWorkGroupSize[i] = ctx->Const.MaxComputeWorkGroupSize[i];
+ this->Const.MaxComputeTextureImageUnits = ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits;
+ this->Const.MaxComputeUniformComponents = ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents;
+
this->Const.MaxImageUnits = ctx->Const.MaxImageUnits;
this->Const.MaxCombinedShaderOutputResources = ctx->Const.MaxCombinedShaderOutputResources;
this->Const.MaxImageSamples = ctx->Const.MaxImageSamples;
@@ -149,6 +155,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->Const.MaxTessEvaluationImageUniforms = ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxImageUniforms;
this->Const.MaxGeometryImageUniforms = ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms;
this->Const.MaxFragmentImageUniforms = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
+ this->Const.MaxComputeImageUniforms = ctx->Const.Program[MESA_SHADER_COMPUTE].MaxImageUniforms;
this->Const.MaxCombinedImageUniforms = ctx->Const.MaxCombinedImageUniforms;
/* ARB_viewport_array */
diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h
index 4dacc2ac62b..5f6ca6a03f5 100644
--- a/src/compiler/glsl/glsl_parser_extras.h
+++ b/src/compiler/glsl/glsl_parser_extras.h
@@ -422,6 +422,11 @@ struct _mesa_glsl_parse_state {
unsigned MaxAtomicCounterBufferSize;
/* ARB_compute_shader */
+ unsigned MaxComputeAtomicCounterBuffers;
+ unsigned MaxComputeAtomicCounters;
+ unsigned MaxComputeImageUniforms;
+ unsigned MaxComputeTextureImageUnits;
+ unsigned MaxComputeUniformComponents;
unsigned MaxComputeWorkGroupCount[3];
unsigned MaxComputeWorkGroupSize[3];
diff --git a/src/compiler/glsl/main.cpp b/src/compiler/glsl/main.cpp
index df93a013ede..ff705dc74d6 100644
--- a/src/compiler/glsl/main.cpp
+++ b/src/compiler/glsl/main.cpp
@@ -62,6 +62,10 @@ initialize_context(struct gl_context *ctx, gl_api api)
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /* not used */
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxOutputComponents = 0; /* not used */
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicBuffers = 8;
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicCounters = 8;
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxImageUniforms = 8;
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformBlocks = 12;
switch (ctx->Const.GLSLVersion) {
case 100: