[Mesa-dev] [PATCH 22/30] mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_INVOCATIONS constant.
Paul Berry
stereotype441 at gmail.com
Mon Feb 3 14:30:13 PST 2014
On 1 February 2014 21:25, Jordan Justen <jljusten at gmail.com> wrote:
> On Thu, Jan 9, 2014 at 6:19 PM, Paul Berry <stereotype441 at gmail.com>
> wrote:
> > ---
> > src/glsl/main.cpp | 1 +
> > src/glsl/standalone_scaffolding.cpp | 1 +
> > src/mesa/main/context.c | 1 +
> > src/mesa/main/get.c | 1 +
> > src/mesa/main/get_hash_params.py | 3 +++
> > src/mesa/main/mtypes.h | 1 +
> > 6 files changed, 8 insertions(+)
> >
> > diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
> > index bb2054f..94bc1cc 100644
> > --- a/src/glsl/main.cpp
> > +++ b/src/glsl/main.cpp
> > @@ -53,6 +53,7 @@ initialize_context(struct gl_context *ctx, gl_api api)
> > ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[2] = 64;
> > + ctx->Const.MaxComputeWorkGroupInvocations = 1024;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /*
> not used */
> > diff --git a/src/glsl/standalone_scaffolding.cpp
> b/src/glsl/standalone_scaffolding.cpp
> > index e8eb529..0c83ea3 100644
> > --- a/src/glsl/standalone_scaffolding.cpp
> > +++ b/src/glsl/standalone_scaffolding.cpp
> > @@ -143,6 +143,7 @@ void initialize_context_to_defaults(struct
> gl_context *ctx, gl_api api)
> > ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[2] = 64;
> > + ctx->Const.MaxComputeWorkGroupInvocations = 1024;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 16;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxUniformComponents = 1024;
> > ctx->Const.Program[MESA_SHADER_COMPUTE].MaxInputComponents = 0; /*
> not used */
> > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> > index ebe27b4..942f247 100644
> > --- a/src/mesa/main/context.c
> > +++ b/src/mesa/main/context.c
> > @@ -695,6 +695,7 @@ _mesa_init_constants(struct gl_context *ctx)
> > ctx->Const.MaxComputeWorkGroupSize[0] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[1] = 1024;
> > ctx->Const.MaxComputeWorkGroupSize[2] = 64;
> > + ctx->Const.MaxComputeWorkGroupInvocations = 1024;
> > }
> >
> >
> > diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> > index 6b914f4..bcbb5d5 100644
> > --- a/src/mesa/main/get.c
> > +++ b/src/mesa/main/get.c
> > @@ -382,6 +382,7 @@ EXTRA_EXT(ARB_texture_multisample);
> > EXTRA_EXT(ARB_texture_gather);
> > EXTRA_EXT(ARB_shader_atomic_counters);
> > EXTRA_EXT(ARB_draw_indirect);
> > +EXTRA_EXT(ARB_compute_shader);
> >
> > static const int
> > extra_ARB_color_buffer_float_or_glcore[] = {
> > diff --git a/src/mesa/main/get_hash_params.py
> b/src/mesa/main/get_hash_params.py
> > index 7f025a9..c18e848 100644
> > --- a/src/mesa/main/get_hash_params.py
> > +++ b/src/mesa/main/get_hash_params.py
> > @@ -742,6 +742,9 @@ descriptor=[
> > # GL_ARB_vertex_attrib_binding
> > [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET",
> "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
> > [ "MAX_VERTEX_ATTRIB_BINDINGS",
> "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
> > +
> > +# GL_ARB_compute_shader
> > + [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS",
> "CONTEXT_ENUM(Const.MaxComputeWorkGroupInvocations),
> extra_ARB_compute_shader" ],
>
> CONTEXT_ENUM and CONTEXT_INT seem to follow the same code paths, but
> would CONTEXT_INT be a better fit here?
>
You're right, CONTEXT_INT makes more sense here. I've changed it.
>
> Also, how do we decide between adding to gl_constants and just using
> CONST(1024)? My thought would be to use CONST unless we are pretty
> sure drivers will want to vary the value.
>
My reasoning for using gl_constants is that the value of the constant is
determined by a hardware limitation rather than a core Mesa software
limitation, hence it's likely to vary from one back end to the next. I had
a quick look through our uses of CONST and it looks like most of the time
we use CONST it's when we're talking about a core Mesa software limitation
(e.g. MAX_MODELVIEW_STACK_DEPTH is CONST(MAX_MODELVIEW_STACK_DEPTH) because
that's the size of the per-context data structure we use to keep track of
the modelview matrix stack.
I admit that we haven't historically been terribly consistent about this
decision, though :)
>
> 21-23 Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
>
> > ]},
> >
> > # Enums restricted to OpenGL Core profile
> > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> > index d3f3a30..6481dc1 100644
> > --- a/src/mesa/main/mtypes.h
> > +++ b/src/mesa/main/mtypes.h
> > @@ -3323,6 +3323,7 @@ struct gl_constants
> >
> > /** GL_ARB_compute_shader */
> > GLuint MaxComputeWorkGroupSize[3];
> > + GLuint MaxComputeWorkGroupInvocations;
> > };
> >
> >
> > --
> > 1.8.5.2
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140203/1be9fe65/attachment.html>
More information about the mesa-dev
mailing list