Mesa (master): freedreno: a2xx: Support TEXTURE_RECT

Rob Clark robclark at kemper.freedesktop.org
Sat Mar 31 12:24:45 UTC 2018


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

Author: Wladimir J. van der Laan <laanwj at gmail.com>
Date:   Mon Jul 31 11:58:29 2017 +0000

freedreno: a2xx: Support TEXTURE_RECT

Denormalized texture coordinates are required for text rendering in
GALLIUM_HUD.

Signed-off-by: Wladimir J. van der Laan <laanwj at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Rob Clark <robdclark at gmail.com>

---

 src/gallium/drivers/freedreno/a2xx/fd2_compiler.c | 3 ++-
 src/gallium/drivers/freedreno/a2xx/ir-a2xx.c      | 1 +
 src/gallium/drivers/freedreno/a2xx/ir-a2xx.h      | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c b/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
index 2ffd8cd5a7..9f2fc6168b 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
@@ -791,6 +791,7 @@ translate_tex(struct fd2_compile_context *ctx,
 	instr = ir2_instr_create(next_exec_cf(ctx), IR2_FETCH);
 	instr->fetch.opc = TEX_FETCH;
 	instr->fetch.is_cube = (inst->Texture.Texture == TGSI_TEXTURE_3D);
+	instr->fetch.is_rect = (inst->Texture.Texture == TGSI_TEXTURE_RECT);
 	assert(inst->Texture.NumOffsets <= 1); // TODO what to do in other cases?
 
 	/* save off the tex fetch to be patched later with correct const_idx: */
@@ -802,7 +803,7 @@ translate_tex(struct fd2_compile_context *ctx,
 	reg = add_src_reg(ctx, instr, coord);
 
 	/* blob compiler always sets 3rd component to same as 1st for 2d: */
-	if (inst->Texture.Texture == TGSI_TEXTURE_2D)
+	if (inst->Texture.Texture == TGSI_TEXTURE_2D || inst->Texture.Texture == TGSI_TEXTURE_RECT)
 		reg->swizzle[2] = reg->swizzle[0];
 
 	/* dst register needs to be marked for sync: */
diff --git a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
index 163c282038..42a9ab494e 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
+++ b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
@@ -341,6 +341,7 @@ static int instr_emit_fetch(struct ir2_instruction *instr,
 		tex->use_comp_lod = 1;
 		tex->use_reg_lod = !instr->fetch.is_cube;
 		tex->sample_location = SAMPLE_CENTER;
+		tex->tx_coord_denorm = instr->fetch.is_rect;
 
 		if (instr->pred != IR2_PRED_NONE) {
 			tex->pred_select = 1;
diff --git a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h
index 36ed2043b2..c4b6c18e24 100644
--- a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h
+++ b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h
@@ -74,6 +74,7 @@ struct ir2_instruction {
 			unsigned const_idx;
 			/* texture fetch specific: */
 			bool is_cube : 1;
+			bool is_rect : 1;
 			/* vertex fetch specific: */
 			unsigned const_idx_sel;
 			enum a2xx_sq_surfaceformat fmt;




More information about the mesa-commit mailing list