On 09/08/2016 01:31 PM, Samuel Pitoiset wrote: > Compute shaders can now include a fixed local size as defined by > ARB_compute_shader or a variable size as defined by > ARB_compute_variable_group_size. > > Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> > --- > src/compiler/glsl/linker.cpp | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp > index c95edf3..e909455 100644 > --- a/src/compiler/glsl/linker.cpp > +++ b/src/compiler/glsl/linker.cpp > @@ -2074,6 +2074,7 @@ link_cs_input_layout_qualifiers(struct > gl_shader_program *prog, > { > for (int i = 0; i < 3; i++) > linked_shader->info.Comp.LocalSize[i] = 0;
Blank line here. > + linked_shader->info.Comp.LocalSizeVariable = false; > > /* This function is called for all shader stages, but it only has an > effect > * for compute shaders. > @@ -2109,6 +2110,20 @@ link_cs_input_layout_qualifiers(struct > gl_shader_program *prog, > linked_shader->info.Comp.LocalSize[i] = > shader->info.Comp.LocalSize[i]; > } > + } else if (shader->info.Comp.LocalSizeVariable) { > + if (linked_shader->info.Comp.LocalSize[0] != 0) { > + /* From the ARB_compute_variable_group_size spec: Spec quote. > + * > + * If one compute shader attached to a program declares a > + * variable local group size and a second compute shader > + * attached to the same program declares a fixed local group > + * size, a link-time error results. > + */ > + linker_error(prog, "computer shader defined with both fixed and " compute :) > + "variable local group size\n"); > + return; > + } > + linked_shader->info.Comp.LocalSizeVariable = true; > } > } > > @@ -2116,12 +2131,16 @@ link_cs_input_layout_qualifiers(struct > gl_shader_program *prog, > * since we already know we're in the right type of shader program > * for doing it. > */ > - if (linked_shader->info.Comp.LocalSize[0] == 0) { > - linker_error(prog, "compute shader didn't declare local size\n"); > + if (linked_shader->info.Comp.LocalSize[0] == 0 && > + !linked_shader->info.Comp.LocalSizeVariable) { > + linker_error(prog, "compute shader must contain a fixed or a variable " > + "local group size\n"); > return; > } > for (int i = 0; i < 3; i++) > prog->Comp.LocalSize[i] = linked_shader->info.Comp.LocalSize[i]; Blank line here. With those 4 nits fixed, this patch is Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> > + prog->Comp.LocalSizeVariable = > + linked_shader->info.Comp.LocalSizeVariable; > } > > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev