summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-22 13:59:11 -0600
committerBrian Paul <[email protected]>2008-10-22 13:59:11 -0600
commitda63edd720fc154820fcbf699e1056ac9357a03f (patch)
treef3c8b8fd38bb013eb34937b0dc4a9d8c785bce38
parentebdc399d83d6bd2f4e3594874483dbca5f9f5c0e (diff)
gallium: fix broken TGSI_FILE_CONSTANT case, use ppc_reserver_register()
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_ppc.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c
index 112e7365233..dbf215c0d57 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c
@@ -1108,10 +1108,15 @@ emit_fetch(struct gen_context *gen,
int offset_reg = ppc_allocate_register(gen->f);
int offset = (reg->SrcRegister.Index * 4 + swizzle) * 4;
ppc_li(gen->f, offset_reg, offset);
- /* load vector word */
+ /* Load 4-byte word into vector register.
+ * The vector slot depends on the effective address we load from.
+ * We know that our constants start at a 16-byte boundary so we
+ * know that 'swizzle' tells us which vector slot will have the
+ * loaded word. The other vector slots will be undefined.
+ */
ppc_lvewx(gen->f, vec_reg, gen->const_reg, offset_reg);
- /* splat word[0] across vector */
- ppc_vspltw(gen->f, vec_reg, vec_reg, 0);
+ /* splat word[swizzle] across the vector reg */
+ ppc_vspltw(gen->f, vec_reg, vec_reg, swizzle);
ppc_release_register(gen->f, offset_reg);
}
break;
@@ -2635,11 +2640,11 @@ tgsi_emit_ppc(const struct tgsi_token *tokens,
tgsi_parse_init( &parse, tokens );
gen.f = func;
- gen.inputs_reg = 3; /* first function param */
- gen.outputs_reg = 4; /* second function param */
- gen.temps_reg = 5; /* ... */
- gen.immed_reg = 6;
- gen.const_reg = 7;
+ gen.inputs_reg = ppc_reserve_register(func, 3); /* first function param */
+ gen.outputs_reg = ppc_reserve_register(func, 4); /* second function param */
+ gen.temps_reg = ppc_reserve_register(func, 5); /* ... */
+ gen.immed_reg = ppc_reserve_register(func, 6);
+ gen.const_reg = ppc_reserve_register(func, 7);
emit_prologue(func);