mesa: make compute maximums reflect driver-provided values
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 20 Jan 2016 08:06:53 +0000 (03:06 -0500)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sat, 13 Feb 2016 14:51:17 +0000 (15:51 +0100)
Looks like the various max's were never plumbed through.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/builtin_variables.cpp
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h
src/compiler/glsl/main.cpp
src/mesa/main/config.h
src/mesa/main/get_hash_params.py

index 6db74f1c634f638fad128273edfaac8ec42a7ccf..d20fc4a816cc694417c0a866469175efaafb87e6 100644 (file)
@@ -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],
index f020e8002af6ea3aba403ad11a556ec9ad0b1bb9..fbac8366bd100943398a7d6eba849f84777eec32 100644 (file)
@@ -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 */
index 4dacc2ac62beb8f86ac63de9e05fe710e9db8981..5f6ca6a03f5d3caeb53fcea9d73bff3cda64175b 100644 (file)
@@ -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];
 
index df93a013edeb6622abac656b044f0b094e00b3e5..ff705dc74d6c7062b71eae4472dca1257dd23fdb 100644 (file)
@@ -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:
index 2d53e2fa72f54f3ee7a8af79f3d601ab7351e426..1261b7b943f470c4b31b884933af0822f764858f 100644 (file)
 
 /** For GL_ARB_compute_shader */
 /*@{*/
-#define MAX_COMPUTE_UNIFORM_BLOCKS          12
-#define MAX_COMPUTE_TEXTURE_IMAGE_UNITS     16
-#define MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS  8
-#define MAX_COMPUTE_ATOMIC_COUNTERS         8
 #define MAX_COMPUTE_SHARED_MEMORY_SIZE      32768
-#define MAX_COMPUTE_UNIFORM_COMPONENTS      512
-#define MAX_COMPUTE_IMAGE_UNIFORMS          8
 /*@}*/
 
 /** For GL_ARB_pipeline_statistics_query */
index 164095c103c72412b95ea621370eb217e9cb0096..2a34b7ca710bf2702930dbc4678e2bd1ca35742c 100644 (file)
@@ -455,13 +455,13 @@ descriptor=[
 
 # GL_ARB_compute_shader / GLES 3.1
   [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "CONTEXT_INT(Const.MaxComputeWorkGroupInvocations), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_UNIFORM_BLOCKS", "CONST(MAX_COMPUTE_UNIFORM_BLOCKS), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_TEXTURE_IMAGE_UNITS", "CONST(MAX_COMPUTE_TEXTURE_IMAGE_UNITS), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS", "CONST(MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_ATOMIC_COUNTERS", "CONST(MAX_COMPUTE_ATOMIC_COUNTERS), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxUniformBlocks), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_TEXTURE_IMAGE_UNITS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxAtomicBuffers), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxAtomicCounters), extra_ARB_compute_shader_es31" ],
   [ "MAX_COMPUTE_SHARED_MEMORY_SIZE", "CONST(MAX_COMPUTE_SHARED_MEMORY_SIZE), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_UNIFORM_COMPONENTS", "CONST(MAX_COMPUTE_UNIFORM_COMPONENTS), extra_ARB_compute_shader_es31" ],
-  [ "MAX_COMPUTE_IMAGE_UNIFORMS", "CONST(MAX_COMPUTE_IMAGE_UNIFORMS), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents), extra_ARB_compute_shader_es31" ],
+  [ "MAX_COMPUTE_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxImageUniforms), extra_ARB_compute_shader_es31" ],
   [ "DISPATCH_INDIRECT_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_compute_shader_es31" ],
   [ "MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxCombinedUniformComponents), extra_ARB_compute_shader_es31" ],