r300-gallium: vs: Add negation, SUB.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 5 Jun 2009 05:41:33 +0000 (22:41 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 5 Jun 2009 06:27:46 +0000 (23:27 -0700)
Doesn't work. WTF.

src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_state_tcl.c
src/gallium/drivers/r300/r300_state_tcl.h

index 32fa739a1e74bacf41a7d2cd3b5a935f7fa308b9..1a8c17b28d648350626c7e12ce53803d8ca1f4c1 100644 (file)
@@ -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]);
 }
 
index 32e61bc1d72858e0b9d6d0b3365e104c7ae9ad49..30a8dab307a64f89c5ae2ee3dce8bdd267fb9c53 100644 (file)
@@ -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:
index d5d425e9d6c4df9de118444de451c1a11a8a349a..2c8b586c2f56ab7dda95b1825d4e1b10197b1c11 100644 (file)
     ((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,