[Mesa-dev] [PATCH V2] glsl: fix atomic buffer index for bindings other than 0

Timothy Arceri t_arceri at yahoo.com.au
Sun Jul 26 01:48:11 PDT 2015


On Sun, 2015-07-26 at 03:04 +0200, Erik Faye-Lund wrote:
> On Sat, Jul 25, 2015 at 4:24 PM, Timothy Arceri <t_arceri at yahoo.com.au> 
> wrote:
> > Since commit c0cd5b var->data.binding was being used as a replacement
> > for atomic buffer index, but they don't have to be the same value they
> > just happen to end up the same when binding is 0.
> > 
> > Now we store atomic buffer index in the unused var->data.index
> > to avoid the extra memory of putting back the atmoic buffer index field.
> > 
> > V2: store buffer index in var->data.index and uniform slot in
> > var->data.location to avoid issues when linking more than 2 shaders.
> > Also some small tidy ups.
> > 
> > Cc: Alejandro PiƱeiro <apinheiro at igalia.com>
> > Cc: Ian Romanick <idr at freedesktop.org>
> > Cc: 10.4, 10.5 <mesa-stable at lists.freedesktop.org>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
> > ---
> >  src/glsl/ir.h                                  |  3 +++
> >  src/glsl/link_atomics.cpp                      | 18 +++++++-----------
> >  src/glsl/link_uniforms.cpp                     |  4 ++++
> >  src/glsl/nir/glsl_to_nir.cpp                   |  2 --
> >  src/glsl/nir/nir.h                             |  6 ++++--
> >  src/glsl/nir/nir_lower_atomics.c               |  2 +-
> >  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |  2 +-
> >  7 files changed, 20 insertions(+), 17 deletions(-)
> > 
> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> > index 62cdbd4..d97db68 100644
> > --- a/src/glsl/nir/nir.h
> > +++ b/src/glsl/nir/nir.h
> > @@ -307,7 +310,6 @@ typedef struct {
> >         * Location an atomic counter is stored at.
> >         */
> >        struct {
> > -         unsigned buffer_index;
> >           unsigned offset;
> >        } atomic;
> 
> This smells a bit like the struct should be nuked all together...

Yep, but it should be in a separate patch as this is aimed at stable. I don't
have time for that clean-up right now but feel free to take it on. The struct
in ir.h should go too.


More information about the mesa-dev mailing list