[Mesa-dev] [PATCH] compiler/glsl: Fix uniform location counting.

Manolova, Plamena plamena.manolova at intel.com
Thu Feb 11 18:25:24 UTC 2016


Thanks for reviewing. I was actually hesitant about which list
implementation to use since the changes affect src/mesa/main/mtypes.h too.
Thank you for clearing this up.

On Thu, Feb 11, 2016 at 8:02 PM, Matt Turner <mattst88 at gmail.com> wrote:

> On Thu, Feb 11, 2016 at 8:31 AM, Plamena Manolova
> <plamena.manolova at intel.com> wrote:
> > This patch moves the calculation of current uniforms to
> > link_uniforms, which makes use of UniformRemapTable which
> > stores all the reserved uniform locations.
> >
> > Location assignment for implicit uniforms now tries to use
> > any gaps left in the table after the location assignment
> > for explicit uniforms. This gives us more space to store more
> > uniforms.
> >
> > Patch is based on earlier patch with following changes/additions:
> >
> >    1: Move the counting of explicit locations to
> >       check_explicit_uniform_locations and then pass
> >       the number to link_assign_uniform_locations.
> >    2: Count the number of empty slots in UniformRemapTable
> >       and store them in a list_head.
> >    3: Try to find an empty slot for implicit locations from
> >       the list, if that fails resize UniformRemapTable.
> >
> > Fixes following CTS tests:
> >    ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
> >
> ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array
> >
> > Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> > Signed-off-by: Plamena Manolova <plamena.manolova at intel.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696
> > ---
> >  src/compiler/glsl/link_uniforms.cpp | 79
> ++++++++++++++++++++++++++++++++-----
> >  src/compiler/glsl/linker.cpp        | 78
> +++++++++++++++++++++++++-----------
> >  src/compiler/glsl/linker.h          | 17 +++++++-
> >  src/mesa/main/mtypes.h              |  8 ++++
> >  4 files changed, 147 insertions(+), 35 deletions(-)
> >
> > diff --git a/src/compiler/glsl/link_uniforms.cpp
> b/src/compiler/glsl/link_uniforms.cpp
> > index 7072c16..8192c21 100644
> > --- a/src/compiler/glsl/link_uniforms.cpp
> > +++ b/src/compiler/glsl/link_uniforms.cpp
> > @@ -1038,9 +1038,36 @@ assign_hidden_uniform_slot_id(const char *name,
> unsigned hidden_id,
> >     uniform_size->map->put(hidden_uniform_start + hidden_id, name);
> >  }
> >
> > +/**
> > + * Search through the list of empty blocks to find one that fits the
> current
> > + * uniform.
> > + */
> > +static int
> > +find_empty_block(struct gl_shader_program *prog,
> > +                 struct gl_uniform_storage *uniform)
> > +{
> > +   const unsigned entries = MAX2(1, uniform->array_elements);
> > +
> > +   list_for_each_entry_safe(struct empty_uniform_block, block,
> > +                            &prog->EmptyUniformLocations, link) {
>
> Please use exec_list in glsl code. That means embedding a "struct
> exec_node link" in empty_uniform_block instead of a head_link and
> iterating with  foreach_list_typed.
> ---------------------------------------------------------------------
> Intel Corporation (UK) Limited
> Registered No. 1134945 (England)
> Registered Office: Pipers Way, Swindon SN3 1RJ
> VAT No: 860 2173 47
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160211/676548c8/attachment.html>


More information about the mesa-dev mailing list