summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-06-04 22:41:33 -0700
committerCorbin Simpson <[email protected]>2009-06-04 23:27:46 -0700
commit31609acbe9d80daea49e98f026196023a20258a0 (patch)
tree9ae82778a90ed5ec9e68819aac66360673381017 /src/gallium/drivers/r300
parentfb7d1fb0f0ce4137b6cb84198997241d190d13a8 (diff)
r300-gallium: vs: Add negation, SUB.
Doesn't work. WTF.
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_debug.c6
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.c17
-rw-r--r--src/gallium/drivers/r300/r300_state_tcl.h7
3 files changed, 25 insertions, 5 deletions
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index 32fa739a1e7..1a8c17b28d6 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -167,10 +167,14 @@ static void r300_vs_op_dump(uint32_t op)
void r300_vs_src_dump(uint32_t src)
{
- debug_printf(" %s/%s/%s/%s\n",
+ debug_printf(" %s%s/%s%s/%s%s/%s%s\n",
+ src & (1 << 25) ? "-" : " ",
r300_vs_swiz_debug[(src >> 13) & 0x7],
+ src & (1 << 26) ? "-" : " ",
r300_vs_swiz_debug[(src >> 16) & 0x7],
+ src & (1 << 27) ? "-" : " ",
r300_vs_swiz_debug[(src >> 19) & 0x7],
+ src & (1 << 28) ? "-" : " ",
r300_vs_swiz_debug[(src >> 22) & 0x7]);
}
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
index 32e61bc1d72..30a8dab307a 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.c
+++ b/src/gallium/drivers/r300/r300_state_tcl.c
@@ -144,6 +144,7 @@ static uint32_t r300_vs_op(unsigned op)
return R300_VE_MULTIPLY;
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_MOV:
+ case TGSI_OPCODE_SUB:
case TGSI_OPCODE_SWZ:
return R300_VE_ADD;
case TGSI_OPCODE_MAX:
@@ -163,12 +164,14 @@ static uint32_t r300_vs_op(unsigned op)
static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
{
if (reg->SrcRegister.Extended) {
- return reg->SrcRegisterExtSwz.ExtSwizzleX |
+ return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) |
+ reg->SrcRegisterExtSwz.ExtSwizzleX |
(reg->SrcRegisterExtSwz.ExtSwizzleY << 3) |
(reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) |
(reg->SrcRegisterExtSwz.ExtSwizzleW << 9);
} else {
- return reg->SrcRegister.SwizzleX |
+ return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) |
+ reg->SrcRegister.SwizzleX |
(reg->SrcRegister.SwizzleY << 3) |
(reg->SrcRegister.SwizzleZ << 6) |
(reg->SrcRegister.SwizzleW << 9);
@@ -179,12 +182,14 @@ static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
static uint32_t r300_vs_scalar_swiz(struct tgsi_full_src_register* reg)
{
if (reg->SrcRegister.Extended) {
- return reg->SrcRegisterExtSwz.ExtSwizzleX |
+ return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) |
+ reg->SrcRegisterExtSwz.ExtSwizzleX |
(reg->SrcRegisterExtSwz.ExtSwizzleX << 3) |
(reg->SrcRegisterExtSwz.ExtSwizzleX << 6) |
(reg->SrcRegisterExtSwz.ExtSwizzleX << 9);
} else {
- return reg->SrcRegister.SwizzleX |
+ return (reg->SrcRegister.Negate ? R300_PVS_NEGATE_XYZW : 0) |
+ reg->SrcRegister.SwizzleX |
(reg->SrcRegister.SwizzleX << 3) |
(reg->SrcRegister.SwizzleX << 6) |
(reg->SrcRegister.SwizzleX << 9);
@@ -246,6 +251,10 @@ static void r300_vs_instruction(struct r300_vertex_shader* vs,
&inst->FullDstRegisters[0], inst->Instruction.Opcode,
1, TRUE);
break;
+ case TGSI_OPCODE_SUB:
+ inst->FullSrcRegisters[1].SrcRegister.Negate =
+ !inst->FullSrcRegisters[1].SrcRegister.Negate;
+ /* Fall through */
case TGSI_OPCODE_ADD:
case TGSI_OPCODE_MUL:
case TGSI_OPCODE_MAX:
diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
index d5d425e9d6c..2c8b586c2f5 100644
--- a/src/gallium/drivers/r300/r300_state_tcl.h
+++ b/src/gallium/drivers/r300/r300_state_tcl.h
@@ -76,6 +76,13 @@
((R300_PVS_SRC_SELECT_FORCE_1 | (R300_PVS_SRC_SELECT_FORCE_1 << 3) | \
(R300_PVS_SRC_SELECT_FORCE_1 << 6) | \
(R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13)
+#define R300_PVS_MODIFIER_X (1 << 25)
+#define R300_PVS_MODIFIER_Y (1 << 26)
+#define R300_PVS_MODIFIER_Z (1 << 27)
+#define R300_PVS_MODIFIER_W (1 << 28)
+#define R300_PVS_NEGATE_XYZW \
+ (R300_PVS_MODIFIER_X | R300_PVS_MODIFIER_Y | \
+ R300_PVS_MODIFIER_Z | R300_PVS_MODIFIER_W)
static const struct tgsi_full_src_register r300_constant_zero = {
.SrcRegister.Extended = TRUE,