Added DIV preshader opcode.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 30 May 2011 23:39:12 -0400
changeset 1033 b72073c4820e
parent 1032 464f38a2fb70
child 1034 549f160533fa
Added DIV preshader opcode. After poking around with a hex editor and fxc.exe /dumpbin, I _think_ this is everything from the 0x1000, 0x2000, and 0xA000 blocks. There might be some 0x3000 or 0x5000 opcodes out there still.
mojoshader.c
mojoshader.h
utils/testparse.c
--- a/mojoshader.c	Mon May 30 19:56:41 2011 -0400
+++ b/mojoshader.c	Mon May 30 23:39:12 2011 -0400
@@ -7279,6 +7279,7 @@
             case 0x2040: opcode = MOJOSHADER_PRESHADEROP_ADD; break;
             case 0x2050: opcode = MOJOSHADER_PRESHADEROP_MUL; break;
             case 0x2060: opcode = MOJOSHADER_PRESHADEROP_ATAN2; break;
+            case 0x2080: opcode = MOJOSHADER_PRESHADEROP_DIV; break;
             case 0x3000: opcode = MOJOSHADER_PRESHADEROP_CMP; break;
             case 0x5000: opcode = MOJOSHADER_PRESHADEROP_DOT; break;
             case 0xA000: opcode = MOJOSHADER_PRESHADEROP_MIN_SCALAR; break;
@@ -7288,6 +7289,7 @@
             case 0xA040: opcode = MOJOSHADER_PRESHADEROP_ADD_SCALAR; break;
             case 0xA050: opcode = MOJOSHADER_PRESHADEROP_MUL_SCALAR; break;
             case 0xA060: opcode = MOJOSHADER_PRESHADEROP_ATAN2_SCALAR; break;
+            case 0xA080: opcode = MOJOSHADER_PRESHADEROP_DIV_SCALAR; break;
             case 0xD000: opcode = MOJOSHADER_PRESHADEROP_DOT_SCALAR; break;
             default: fail(ctx, "Unknown preshader opcode."); break;
         } // switch
--- a/mojoshader.h	Mon May 30 19:56:41 2011 -0400
+++ b/mojoshader.h	Mon May 30 23:39:12 2011 -0400
@@ -377,6 +377,7 @@
     MOJOSHADER_PRESHADEROP_ADD,
     MOJOSHADER_PRESHADEROP_MUL,
     MOJOSHADER_PRESHADEROP_ATAN2,
+    MOJOSHADER_PRESHADEROP_DIV,
     MOJOSHADER_PRESHADEROP_CMP,
     MOJOSHADER_PRESHADEROP_DOT,
     MOJOSHADER_PRESHADEROP_SCALAR_OPS,
@@ -387,6 +388,7 @@
     MOJOSHADER_PRESHADEROP_ADD_SCALAR,
     MOJOSHADER_PRESHADEROP_MUL_SCALAR,
     MOJOSHADER_PRESHADEROP_ATAN2_SCALAR,
+    MOJOSHADER_PRESHADEROP_DIV_SCALAR,
     MOJOSHADER_PRESHADEROP_DOT_SCALAR,
 } MOJOSHADER_preshaderOpcode;
 
--- a/utils/testparse.c	Mon May 30 19:56:41 2011 -0400
+++ b/utils/testparse.c	Mon May 30 23:39:12 2011 -0400
@@ -116,8 +116,8 @@
     static const char *opcodestr[] = {
         "nop", "mov", "neg", "rcp", "frc", "exp", "log", "rsq", "sin", "cos",
         "asin", "acos", "atan", "min", "max", "cmplt", "cmpge", "add", "mul",
-        "atan2", "cmp", "dot", "min", "max", "cmplt", "cmpge", "add", "mul",
-        "atan2", "dot"
+        "atan2", "div", "cmp", "dot", "min", "max", "cmplt", "cmpge", "add",
+        "mul", "atan2", "div", "dot"
     };
 
     static char mask[] = { 'x', 'y', 'z', 'w' };