[Mesa-dev] [PATCH v2 8/8] ir3/nir: Correctly use both tex->texture_index and tex->sampler_index

Jason Ekstrand jason at jlekstrand.net
Sat Feb 6 19:41:47 UTC 2016


On Sat, Feb 6, 2016 at 11:14 AM, Rob Clark <robdclark at gmail.com> wrote:

> On Sat, Feb 6, 2016 at 1:19 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > Previously, NIR only provided a single sampler_index which was doubled as
> > the texture index.  Now, it provides separate sampler and texture indices
> > which we can use.  For both GLSL and TGSI they should usually be the
> same.
> > The one exception is quaries where the sampler isn't needed.
>
> hmm, for border-color we need a bit of a hack which assumes
> texture:sampler is 1:1.. since the border-color needs to be swizzled
> according to the texture format..
>
> so while hw does support specifying sampler and texture independently,
> I'm not sure it is practical in real life.. :-(
>

Alright.  I'll drop this patch so we don't end up with too many lies.
Coming out of GLSL or TGSI, you should be fine to just use texture_index as
it's the same as sampler_index for now.
--Jason


>
> BR,
> -R
>
> > Cc: Rob Clark <robclark at gmail.com>
> > ---
> >  src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
> b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
> > index 922a9a6..b1c2b2d 100644
> > --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
> > +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
> > @@ -1544,7 +1544,7 @@ emit_tex(struct ir3_compile *ctx, nir_tex_instr
> *tex)
> >                 type = TYPE_U32;
> >
> >         sam = ir3_SAM(b, opc, type, TGSI_WRITEMASK_XYZW,
> > -                       flags, tex->texture_index, tex->texture_index,
> > +                       flags, tex->sampler_index, tex->texture_index,
> >                         create_collect(b, src0, nsrc0),
> >                         create_collect(b, src1, nsrc1));
> >
> > @@ -1571,7 +1571,7 @@ emit_tex_query_levels(struct ir3_compile *ctx,
> nir_tex_instr *tex)
> >         dst = get_dst(ctx, &tex->dest, 1);
> >
> >         sam = ir3_SAM(b, OPC_GETINFO, TYPE_U32, TGSI_WRITEMASK_Z, 0,
> > -                       tex->texture_index, tex->texture_index, NULL,
> NULL);
> > +                       tex->sampler_index, tex->texture_index, NULL,
> NULL);
> >
> >         /* even though there is only one component, since it ends
> >          * up in .z rather than .x, we need a split_dest()
> > @@ -1608,7 +1608,7 @@ emit_tex_txs(struct ir3_compile *ctx,
> nir_tex_instr *tex)
> >         lod = get_src(ctx, &tex->src[0].src)[0];
> >
> >         sam = ir3_SAM(b, OPC_GETSIZE, TYPE_U32, TGSI_WRITEMASK_XYZW,
> flags,
> > -                       tex->texture_index, tex->texture_index, lod,
> NULL);
> > +                       tex->sampler_index, tex->texture_index, lod,
> NULL);
> >
> >         split_dest(b, dst, sam, 4);
> >
> > --
> > 2.5.0.400.gff86faf
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160206/c67d17f4/attachment-0001.html>


More information about the mesa-dev mailing list