Mesa (master): freedreno/a3xx/compiler: fix RECT textures

Rob Clark robclark at kemper.freedesktop.org
Sun Mar 30 16:11:28 UTC 2014


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

Author: Rob Clark <robclark at freedesktop.org>
Date:   Sun Mar 30 12:06:35 2014 -0400

freedreno/a3xx/compiler: fix RECT textures

Whether or not the coords are normalized is handled in the texture
state.  But we otherwise need to treat RECT sample instructions as 2D.

Signed-off-by: Rob Clark <robclark at freedesktop.org>

---

 src/gallium/drivers/freedreno/a3xx/fd3_compiler.c |   31 ++++++++++++++++-----
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
index 9b64474..1d99e5c 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_compiler.c
@@ -1090,21 +1090,41 @@ trans_samp(const struct instr_translater *t,
 
 	switch (t->arg) {
 	case TGSI_OPCODE_TEX:
-		if (tex == TGSI_TEXTURE_2D) {
+		switch (tex) {
+		case TGSI_TEXTURE_2D:
+		case TGSI_TEXTURE_RECT:
 			order = (int8_t[4]){ 0,  1, -1, -1 };
 			src_wrmask = TGSI_WRITEMASK_XY;
-		} else {
+			break;
+		case TGSI_TEXTURE_3D:
+		case TGSI_TEXTURE_CUBE:
 			order = (int8_t[4]){ 0,  1,  2, -1 };
 			src_wrmask = TGSI_WRITEMASK_XYZ;
+			flags |= IR3_INSTR_3D;
+			break;
+		default:
+			compile_error(ctx, "unknown texture type: %s\n",
+					tgsi_texture_names[tex]);
+			break;
 		}
 		break;
 	case TGSI_OPCODE_TXP:
-		if (tex == TGSI_TEXTURE_2D) {
+		switch (tex) {
+		case TGSI_TEXTURE_2D:
+		case TGSI_TEXTURE_RECT:
 			order = (int8_t[4]){ 0,  1,  3, -1 };
 			src_wrmask = TGSI_WRITEMASK_XYZ;
-		} else {
+			break;
+		case TGSI_TEXTURE_3D:
+		case TGSI_TEXTURE_CUBE:
 			order = (int8_t[4]){ 0,  1,  2,  3 };
 			src_wrmask = TGSI_WRITEMASK_XYZW;
+			flags |= IR3_INSTR_3D;
+			break;
+		default:
+			compile_error(ctx, "unknown texture type: %s\n",
+					tgsi_texture_names[tex]);
+			break;
 		}
 		flags |= IR3_INSTR_P;
 		break;
@@ -1113,9 +1133,6 @@ trans_samp(const struct instr_translater *t,
 		break;
 	}
 
-	if ((tex == TGSI_TEXTURE_3D) || (tex == TGSI_TEXTURE_CUBE))
-		flags |= IR3_INSTR_3D;
-
 	/* cat5 instruction cannot seem to handle const or relative: */
 	if (is_rel_or_const(coord))
 		needs_mov = true;




More information about the mesa-commit mailing list