Mesa (master): r600g: texture offsets for non-TXF instructions

Marek Olšák mareko at kemper.freedesktop.org
Fri Oct 4 20:45:04 UTC 2013


Module: Mesa
Branch: master
Commit: 8419c5c3ce1489222268bf840c1d165ea8bc53ce
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8419c5c3ce1489222268bf840c1d165ea8bc53ce

Author: Grigori Goronzy <greg at chown.ath.cx>
Date:   Thu Oct  3 00:12:55 2013 +0200

r600g: texture offsets for non-TXF instructions

All texture instructions can use offsets, not just TXF. Offsets into
the literals array were wrong, too.

Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/r600/r600_shader.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 206db04..d17d670 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -3782,16 +3782,16 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
 		}
 	}
 
-	if (inst->Instruction.Opcode == TGSI_OPCODE_TXF) {
-		/* get offset values */
-		if (inst->Texture.NumOffsets) {
-			assert(inst->Texture.NumOffsets == 1);
-
-			offset_x = ctx->literals[inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleX] << 1;
-			offset_y = ctx->literals[inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleY] << 1;
-			offset_z = ctx->literals[inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleZ] << 1;
-		}
-	} else if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
+	/* get offset values */
+	if (inst->Texture.NumOffsets) {
+		assert(inst->Texture.NumOffsets == 1);
+
+		offset_x = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleX] << 1;
+		offset_y = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleY] << 1;
+		offset_z = ctx->literals[4 * inst->TexOffsets[0].Index + inst->TexOffsets[0].SwizzleZ] << 1;
+	}
+
+	if (inst->Instruction.Opcode == TGSI_OPCODE_TXD) {
 		/* TGSI moves the sampler to src reg 3 for TXD */
 		sampler_src_reg = 3;
 




More information about the mesa-commit mailing list