[Mesa-dev] [PATCH 1/2] r600g: added literals where needed for POW instruction

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Sun Aug 29 02:19:22 PDT 2010


Fixes size calculation for the bytecode buffer.
---
 src/gallium/drivers/r600/r600_shader.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index ebcf19c..bf5f28f 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1071,6 +1071,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
 	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;
 	/* b * LOG2(a) */
 	memset(&alu, 0, sizeof(struct r600_bc_alu));
 	alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE;
@@ -1085,6 +1088,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
 	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;
 	/* POW(a,b) = EXP2(b * LOG2(a))*/
 	memset(&alu, 0, sizeof(struct r600_bc_alu));
 	alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
@@ -1095,6 +1101,9 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
 	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 tgsi_helper_tempx_replicate(ctx);
 }
 
-- 
1.7.1



More information about the mesa-dev mailing list