Mesa (master): r600g: Implemented the Z and W component write for the SCS opcode.

Tilman Sauerbeck tilman at kemper.freedesktop.org
Mon Sep 20 19:44:46 UTC 2010


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

Author: Tilman Sauerbeck <tilman at code-monkey.de>
Date:   Mon Sep 20 21:27:59 2010 +0200

r600g: Implemented the Z and W component write for the SCS opcode.

Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>

---

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

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 523b6d2..1702475 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -967,6 +967,55 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
 			return r;
 	}
 
+	/* dst.z = 0.0; */
+	if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) {
+		fprintf(stderr, "writing z\n");
+		memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+		alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+
+		r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst);
+		if (r)
+			return r;
+
+		alu.src[0].sel = V_SQ_ALU_SRC_0;
+		alu.src[0].chan = 0;
+
+		alu.last = 1;
+
+		r = r600_bc_add_alu(ctx->bc, &alu);
+		if (r)
+			return r;
+
+		r = r600_bc_add_literal(ctx->bc, ctx->value);
+		if (r)
+			return r;
+	}
+
+	/* dst.w = 1.0; */
+	if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) {
+		memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+		alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+
+		r = tgsi_dst(ctx, &inst->Dst[0], 3, &alu.dst);
+		if (r)
+			return r;
+
+		alu.src[0].sel = V_SQ_ALU_SRC_1;
+		alu.src[0].chan = 0;
+
+		alu.last = 1;
+
+		r = r600_bc_add_alu(ctx->bc, &alu);
+		if (r)
+			return r;
+
+		r = r600_bc_add_literal(ctx->bc, ctx->value);
+		if (r)
+			return r;
+	}
+
 	return 0;
 }
 




More information about the mesa-commit mailing list