Found, I think, the final preshader opcodes.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 31 May 2011 00:56:00 -0400
changeset 1034 549f160533fa
parent 1033 b72073c4820e
child 1035 5855d767e4b2
Found, I think, the final preshader opcodes. I wrote a goofy program to edit a file, run it through fxc.exe /dumpbin, and diff the results to automate the search. #include <stdio.h> #include <stdlib.h> #define FNAME "test.fxc" #define OFFSET 7804 #define STARTVAL 0xA000 int main(void) { system("./fxc.exe /nologo /Tfx_2_0 /dumpbin " FNAME " >dump.txt"); int i = STARTVAL; for (i = STARTVAL; i < STARTVAL+0x100; i += 0x10) { FILE *io = fopen(FNAME, "r+b"); if (io == NULL) return 1; fseek(io, OFFSET, SEEK_SET); const unsigned short y = 0x0001; fwrite(&y, sizeof (y), 1, io); const unsigned short x = (unsigned short) i; fwrite(&x, sizeof (x), 1, io); fflush(io); fclose(io); system("./fxc.exe /nologo /Tfx_2_0 /dumpbin " FNAME " >dump2.txt"); fprintf(stderr, "0x%X ... \n", i); system("diff -u dump.txt dump2.txt 1>&2"); } return 0; }
mojoshader.c
mojoshader.h
utils/testparse.c
--- a/mojoshader.c	Mon May 30 23:39:12 2011 -0400
+++ b/mojoshader.c	Tue May 31 00:56:00 2011 -0400
@@ -7281,7 +7281,9 @@
             case 0x2060: opcode = MOJOSHADER_PRESHADEROP_ATAN2; break;
             case 0x2080: opcode = MOJOSHADER_PRESHADEROP_DIV; break;
             case 0x3000: opcode = MOJOSHADER_PRESHADEROP_CMP; break;
+            case 0x3010: opcode = MOJOSHADER_PRESHADEROP_MOVC; break;
             case 0x5000: opcode = MOJOSHADER_PRESHADEROP_DOT; break;
+            case 0x5020: opcode = MOJOSHADER_PRESHADEROP_NOISE; break;
             case 0xA000: opcode = MOJOSHADER_PRESHADEROP_MIN_SCALAR; break;
             case 0xA010: opcode = MOJOSHADER_PRESHADEROP_MAX_SCALAR; break;
             case 0xA020: opcode = MOJOSHADER_PRESHADEROP_CMPLT_SCALAR; break;
@@ -7291,6 +7293,7 @@
             case 0xA060: opcode = MOJOSHADER_PRESHADEROP_ATAN2_SCALAR; break;
             case 0xA080: opcode = MOJOSHADER_PRESHADEROP_DIV_SCALAR; break;
             case 0xD000: opcode = MOJOSHADER_PRESHADEROP_DOT_SCALAR; break;
+            case 0xD020: opcode = MOJOSHADER_PRESHADEROP_NOISE_SCALAR; break;
             default: fail(ctx, "Unknown preshader opcode."); break;
         } // switch
 
--- a/mojoshader.h	Mon May 30 23:39:12 2011 -0400
+++ b/mojoshader.h	Tue May 31 00:56:00 2011 -0400
@@ -379,7 +379,9 @@
     MOJOSHADER_PRESHADEROP_ATAN2,
     MOJOSHADER_PRESHADEROP_DIV,
     MOJOSHADER_PRESHADEROP_CMP,
+    MOJOSHADER_PRESHADEROP_MOVC,
     MOJOSHADER_PRESHADEROP_DOT,
+    MOJOSHADER_PRESHADEROP_NOISE,
     MOJOSHADER_PRESHADEROP_SCALAR_OPS,
     MOJOSHADER_PRESHADEROP_MIN_SCALAR = MOJOSHADER_PRESHADEROP_SCALAR_OPS,
     MOJOSHADER_PRESHADEROP_MAX_SCALAR,
@@ -390,6 +392,7 @@
     MOJOSHADER_PRESHADEROP_ATAN2_SCALAR,
     MOJOSHADER_PRESHADEROP_DIV_SCALAR,
     MOJOSHADER_PRESHADEROP_DOT_SCALAR,
+    MOJOSHADER_PRESHADEROP_NOISE_SCALAR,
 } MOJOSHADER_preshaderOpcode;
 
 typedef enum MOJOSHADER_preshaderOperandType
--- a/utils/testparse.c	Mon May 30 23:39:12 2011 -0400
+++ b/utils/testparse.c	Tue May 31 00:56:00 2011 -0400
@@ -115,9 +115,9 @@
 
     static const char *opcodestr[] = {
         "nop", "mov", "neg", "rcp", "frc", "exp", "log", "rsq", "sin", "cos",
-        "asin", "acos", "atan", "min", "max", "cmplt", "cmpge", "add", "mul",
-        "atan2", "div", "cmp", "dot", "min", "max", "cmplt", "cmpge", "add",
-        "mul", "atan2", "div", "dot"
+        "asin", "acos", "atan", "min", "max", "lt", "ge", "add", "mul",
+        "atan2", "div", "cmp", "movc", "dot", "noise", "min", "max", "lt",
+        "ge", "add", "mul", "atan2", "div", "dot", "noise"
     };
 
     static char mask[] = { 'x', 'y', 'z', 'w' };