[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 18:19:52 UTC 2016


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.

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



More information about the mesa-dev mailing list