summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-05 02:05:08 -0700
committerCorbin Simpson <MostAwesomeDude@gmail.com>2009-04-05 02:05:08 -0700
commit36ae0766b90a1545ea3d9381974602d8e6fe8642 (patch)
treeefa5235c7e9c67953f59ea41ba268b8a5dec56e9 /src
parent84d76607ec0e43edd7dd28d1d5b6a538fd087434 (diff)
r300-gallium: vp: Moar.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
index a00abfd02f..0f9abb598f 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.c
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -61,6 +61,10 @@ static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
struct tgsi_src_register* src)
{
switch (src->File) {
+ case TGSI_FILE_NULL:
+ /* Probably a zero or one swizzle */
+ return R300_PVS_SRC_REG_INPUT;
+ break;
case TGSI_FILE_INPUT:
return R300_PVS_SRC_REG_INPUT;
break;
@@ -108,6 +112,19 @@ static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler,
return 0;
}
+static uint32_t r300_vs_op(unsigned op)
+{
+ switch (op) {
+ case TGSI_OPCODE_ADD:
+ case TGSI_OPCODE_MOV:
+ case TGSI_OPCODE_SWZ:
+ return R300_VE_ADD;
+ default:
+ break;
+ }
+ return 0;
+}
+
static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
{
if (reg->SrcRegister.Extended) {
@@ -131,9 +148,10 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
unsigned count)
{
int i = vs->instruction_count;
- vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+ vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) |
R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) |
- R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister));
+ R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) |
+ R300_PVS_DST_WE_XYZW;
switch (count) {
case 3:
vs->instructions[i].inst3 =
@@ -157,6 +175,7 @@ static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0]));
break;
}
+ vs->instruction_count++;
}
static void r300_vs_instruction(struct r300_vertex_shader* vs,
@@ -164,6 +183,11 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
struct tgsi_full_instruction* inst)
{
switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_ADD:
+ r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+ &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+ 2);
+ break;
case TGSI_OPCODE_MOV:
case TGSI_OPCODE_SWZ:
inst->FullSrcRegisters[1] = r300_constant_zero;