[Mesa-dev] [PATCH 5/6] i965/draw: Do resolves properly for textures used by TXF

Kenneth Graunke kenneth at whitecape.org
Wed Jan 17 00:40:36 UTC 2018


On Tuesday, January 16, 2018 4:21:57 PM PST Kenneth Graunke wrote:
> On Wednesday, January 10, 2018 11:22:39 AM PST Jason Ekstrand wrote:
> > ---
> >  src/mesa/drivers/dri/i965/brw_draw.c | 41 ++++++++++++++++++++++++++++++++++++
> >  1 file changed, 41 insertions(+)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> > index 4945dec..9fd44e4 100644
> > --- a/src/mesa/drivers/dri/i965/brw_draw.c
> > +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> > @@ -40,6 +40,7 @@
> >  #include "swrast_setup/swrast_setup.h"
> >  #include "drivers/common/meta.h"
> >  #include "util/bitscan.h"
> > +#include "util/bitset.h"
> >  
> >  #include "brw_blorp.h"
> >  #include "brw_draw.h"
> > @@ -371,6 +372,20 @@ intel_disable_rb_aux_buffer(struct brw_context *brw,
> >     return found;
> >  }
> >  
> > +static void
> > +mark_textures_used_for_txf(BITSET_WORD *used_for_txf,
> > +                           const struct gl_program *prog)
> > +{
> > +   if (!prog)
> > +      return;
> > +
> > +   unsigned mask = prog->SamplersUsed & prog->info.textures_used_by_txf;
> > +   while (mask) {
> > +      int s = u_bit_scan(&mask);
> > +      BITSET_SET(used_for_txf, prog->SamplerUnits[s]);
> > +   }
> > +}
> > +
> >  /**
> >   * \brief Resolve buffers before drawing.
> >   *
> > @@ -386,6 +401,18 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering)
> >     memset(brw->draw_aux_buffer_disabled, 0,
> >            sizeof(brw->draw_aux_buffer_disabled));
> >  
> > +   BITSET_DECLARE(used_for_txf, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
> 
> You don't need this "combined" stuff.  You just want a view of all 32
> potential GL texture units, and if any stage uses one of them for TXF,
> mark it here.
> 
> So you can just do:
> 
>     uint32_t used_for_txf;
> 
> with all the corresponding simplifications (no BITSET_* macros).
> 
> This looks good other than that.  I'll let you respin it and then offer
> a R-b.
> 
> Seems like this could be painful for bindless at some point...

Jason pointed out that the type of ctx->Texture.Unit[] is actually a
MAX_COMBINED_TEXTURE_IMAGE_UNITS array, and looking at uniform_query.cpp
line 994, it also checks against MaxCombinedTextureImageUnits here, so
I think I was just wrong.

As is,
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180116/f09698ce/attachment.sig>


More information about the mesa-dev mailing list