summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_program.c
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-06-07 17:36:10 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-06-29 15:46:15 +1000
commitfaa1c02546db00f69c66db18076b5b0ac86d7138 (patch)
tree8835ceeb8de82faf947b9ca5828da9ef08be7e23 /src/gallium/drivers/nv50/nv50_program.c
parent686bc00c05094e8678747c111a6a70ad4b7063e3 (diff)
nv50: create emit_pow() - emit_lit() will need to use it
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_program.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index b013435f99..bc0a834aee 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -627,6 +627,7 @@ emit_preex2(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
emit(pc, inst);
}
+
/*XXX: inaccurate results.. why? */
#define ALLOW_SET_SWAP 0
@@ -694,6 +695,20 @@ emit_flr(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
emit(pc, inst);
}
+static void
+emit_pow(struct nv50_pc *pc, struct nv50_reg *dst,
+ struct nv50_reg *v, struct nv50_reg *e)
+{
+ struct nv50_reg *temp = alloc_temp(pc, NULL);
+
+ emit_flop(pc, 3, temp, v);
+ emit_mul(pc, temp, temp, e);
+ emit_preex2(pc, temp, temp);
+ emit_flop(pc, 6, dst, temp);
+
+ free_temp(pc, temp);
+}
+
static boolean
nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)
{
@@ -875,10 +890,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, const union tgsi_full_token *tok)
break;
case TGSI_OPCODE_POW:
temp = alloc_temp(pc, NULL);
- emit_flop(pc, 3, temp, src[0][0]);
- emit_mul(pc, temp, temp, src[1][0]);
- emit_preex2(pc, temp, temp);
- emit_flop(pc, 6, temp, temp);
+ emit_pow(pc, temp, src[0][0], src[1][0]);
for (c = 0; c < 4; c++) {
if (!(mask & (1 << c)))
continue;