author  icculus 
Sun, 09 Mar 2008 03:08:04 0400  
branch  trunk 
changeset 11  c9bb617d9b77 
parent 9  aea1b254e6a5 
child 12  d81712dd1a46 
permissions  rwrr 
7  1 
/** 
2 
* d3d2glsl; generate GLSL programs from bytecode of compiled Direct3D shaders. 

3 
* 

4 
* Please see the file LICENSE.txt in the source's root directory. 

5 
* 

6 
* This file written by Ryan C. Gordon. 

7 
*/ 

8 

9 
// Shader bytecode format is described at MSDN: 

10 
// http://msdn2.microsoft.com/enus/library/ms800307.aspx 

11 

1  12 
#include <stdio.h> 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

13 
#include <string.h> 
1  14 
#include <stdlib.h> 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

15 
#include <stdint.h> 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

16 

9  17 
#include "d3d2glsl.h" 
18 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

19 
typedef unsigned int uint; // this is a printf() helper. don't use for code. 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

20 
typedef uint8_t uint8; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

21 
typedef uint32_t uint32; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

22 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

23 
// Context...this is state that changes as we parse through a shader... 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

24 
typedef struct D3D2GLSL_context 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

25 
{ 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

26 
const uint32 *tokens; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

27 
uint32 tokencount; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

28 
char buffers[128][5]; // scratch buffers we cycle through. 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

29 
int bufidx; // current scratch buffer. 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

30 
} D3D2GLSL_context; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

31 

c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

32 

7  33 
// Byteswap magic... 
34 

4  35 
#if ((defined __GNUC__) && (defined __POWERPC__)) 
36 
static inline uint32 SWAP32(uint32 x) 

37 
{ 

38 
__asm__ __volatile__("lwbrx %0,0,%1" : "=r" (x) : "r" (&x)); 

39 
return x; 

40 
} // SWAP32 

41 
#elif defined(__POWERPC__) 

42 
static inline uint32 SWAP32(uint32 x) 

43 
{ 

44 
return ( (((x) >> 24) & 0x000000FF)  (((x) >> 8) & 0x0000FF00)  

45 
(((x) << 8) & 0x00FF0000)  (((x) << 24) & 0xFF000000) ); 

46 
} // SWAP32 

47 
#else 

48 
# define SWAP32(x) (x) 

49 
#endif 

50 

7  51 

52 
// Specialcase return values from the parsing pipeline... 

53 

54 
#define END_OF_STREAM (2) 

55 
//#define FAIL(x) (1) 

56 
static int FAIL(const char *reason) 

57 
{ 

58 
printf("%s FAIL.\n", reason); 

59 
return 1; 

60 
} // FAIL 

61 

62 

63 
// one function for each opcode... 

64 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

65 
typedef int (*parse_instruction_function)(D3D2GLSL_context *ctx); 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

66 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

67 
static int parse_NOP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

68 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

69 
return 1; // noop is a noop. :) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

70 
} // parse_NOP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

71 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

72 
static int parse_MOV(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

73 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

74 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

75 
} // parse_MOV 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

76 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

77 
static int parse_ADD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

78 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

79 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

80 
} // parse_ADD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

81 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

82 
static int parse_SUB(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

83 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

84 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

85 
} // parse_SUB 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

86 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

87 
static int parse_MAD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

88 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

89 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

90 
} // parse_MAD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

91 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

92 
static int parse_MUL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

93 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

94 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

95 
} // parse_MUL 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

96 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

97 
static int parse_RCP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

98 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

99 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

100 
} // parse_RCP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

101 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

102 
static int parse_RSQ(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

103 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

104 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

105 
} // parse_RSQ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

106 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

107 
static int parse_DP3(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

108 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

109 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

110 
} // parse_DP3 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

111 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

112 
static int parse_DP4(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

113 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

114 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

115 
} // parse_DP4 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

116 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

117 
static int parse_MIN(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

118 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

119 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

120 
} // parse_MIN 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

121 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

122 
static int parse_MAX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

123 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

124 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

125 
} // parse_MAX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

126 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

127 
static int parse_SLT(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

128 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

129 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

130 
} // parse_SLT 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

131 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

132 
static int parse_SGE(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

133 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

134 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

135 
} // parse_SGE 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

136 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

137 
static int parse_EXP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

138 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

139 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

140 
} // parse_EXP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

141 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

142 
static int parse_LOG(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

143 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

144 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

145 
} // parse_LOG 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

146 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

147 
static int parse_LIT(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

148 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

149 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

150 
} // parse_LIT 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

151 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

152 
static int parse_DST(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

153 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

154 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

155 
} // parse_DST 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

156 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

157 
static int parse_LRP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

158 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

159 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

160 
} // parse_LRP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

161 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

162 
static int parse_FRC(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

163 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

164 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

165 
} // parse_FRC 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

166 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

167 
static int parse_M4X4(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

168 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

169 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

170 
} // parse_M4X4 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

171 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

172 
static int parse_M4X3(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

173 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

174 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

175 
} // parse_M4X3 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

176 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

177 
static int parse_M3X4(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

178 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

179 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

180 
} // parse_M3X4 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

181 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

182 
static int parse_M3X3(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

183 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

184 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

185 
} // parse_M3X3 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

186 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

187 
static int parse_M3X2(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

188 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

189 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

190 
} // parse_M3X2 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

191 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

192 
static int parse_CALL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

193 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

194 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

195 
} // parse_CALL 
1  196 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

197 
static int parse_CALLNZ(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

198 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

199 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

200 
} // parse_CALLNZ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

201 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

202 
static int parse_LOOP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

203 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

204 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

205 
} // parse_LOOP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

206 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

207 
static int parse_RET(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

208 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

209 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

210 
} // parse_RET 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

211 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

212 
static int parse_ENDLOOP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

213 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

214 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

215 
} // parse_ENDLOOP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

216 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

217 
static int parse_LABEL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

218 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

219 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

220 
} // parse_LABEL 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

221 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

222 
static int parse_DCL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

223 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

224 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

225 
} // parse_DCL 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

226 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

227 
static int parse_POW(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

228 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

229 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

230 
} // parse_POW 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

231 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

232 
static int parse_CRS(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

233 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

234 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

235 
} // parse_CRS 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

236 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

237 
static int parse_SGN(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

238 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

239 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

240 
} // parse_SGN 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

241 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

242 
static int parse_ABS(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

243 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

244 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

245 
} // parse_ABS 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

246 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

247 
static int parse_NRM(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

248 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

249 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

250 
} // parse_NRM 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

251 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

252 
static int parse_SINCOS(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

253 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

254 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

255 
} // parse_SINCOS 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

256 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

257 
static int parse_REP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

258 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

259 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

260 
} // parse_REP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

261 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

262 
static int parse_ENDREP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

263 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

264 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

265 
} // parse_ENDREP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

266 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

267 
static int parse_IF(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

268 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

269 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

270 
} // parse_IF 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

271 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

272 
static int parse_IFC(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

273 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

274 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

275 
} // parse_IFC 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

276 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

277 
static int parse_ELSE(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

278 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

279 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

280 
} // parse_ELSE 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

281 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

282 
static int parse_ENDIF(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

283 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

284 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

285 
} // parse_ENDIF 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

286 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

287 
static int parse_BREAK(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

288 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

289 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

290 
} // parse_BREAK 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

291 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

292 
static int parse_BREAKC(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

293 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

294 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

295 
} // parse_BREAKC 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

296 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

297 
static int parse_MOVA(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

298 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

299 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

300 
} // parse_MOVA 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

301 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

302 
static int parse_DEFB(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

303 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

304 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

305 
} // parse_DEFB 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

306 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

307 
static int parse_DEFI(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

308 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

309 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

310 
} // parse_DEFI 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

311 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

312 
static int parse_TEXCOORD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

313 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

314 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

315 
} // parse_TEXCOORD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

316 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

317 
static int parse_TEXKILL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

318 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

319 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

320 
} // parse_TEXKILL 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

321 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

322 
static int parse_TEX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

323 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

324 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

325 
} // parse_TEX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

326 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

327 
static int parse_TEXBEM(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

328 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

329 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

330 
} // parse_TEXBEM 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

331 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

332 
static int parse_TEXBEML(D3D2GLSL_context *ctx) 
1  333 
{ 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

334 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

335 
} // parse_TEXBEML 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

336 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

337 
static int parse_TEXREG2AR(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

338 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

339 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

340 
} // parse_TEXREG2AR 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

341 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

342 
static int parse_TEXREG2GB(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

343 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

344 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

345 
} // parse_TEXREG2GB 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

346 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

347 
static int parse_TEXM3X2PAD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

348 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

349 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

350 
} // parse_TEXM3X2PAD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

351 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

352 
static int parse_TEXM3X2TEX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

353 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

354 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

355 
} // parse_TEXM3X2TEX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

356 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

357 
static int parse_TEXM3X3PAD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

358 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

359 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

360 
} // parse_TEXM3X3PAD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

361 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

362 
static int parse_TEXM3X3TEX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

363 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

364 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

365 
} // parse_TEXM3X3TEX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

366 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

367 
static int parse_RESERVED0(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

368 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

369 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

370 
} // parse_RESERVED0 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

371 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

372 
static int parse_TEXM3X3SPEC(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

373 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

374 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

375 
} // parse_TEXM3X3SPEC 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

376 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

377 
static int parse_TEXM3X3VSPEC(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

378 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

379 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

380 
} // parse_TEXM3X3VSPEC 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

381 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

382 
static int parse_EXPP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

383 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

384 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

385 
} // parse_EXPP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

386 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

387 
static int parse_LOGP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

388 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

389 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

390 
} // parse_LOGP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

391 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

392 
static int parse_CND(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

393 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

394 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

395 
} // parse_CND 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

396 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

397 
static int parse_DEF(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

398 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

399 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

400 
} // parse_DEF 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

401 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

402 
static int parse_TEXREG2RGB(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

403 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

404 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

405 
} // parse_TEXREG2RGB 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

406 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

407 
static int parse_TEXDP3TEX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

408 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

409 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

410 
} // parse_TEXDP3TEX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

411 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

412 
static int parse_TEXM3X2DEPTH(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

413 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

414 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

415 
} // parse_TEXM3X2DEPTH 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

416 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

417 
static int parse_TEXDP3(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

418 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

419 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

420 
} // parse_TEXDP3 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

421 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

422 
static int parse_TEXM3X3(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

423 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

424 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

425 
} // parse_TEXM3X3 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

426 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

427 
static int parse_TEXDEPTH(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

428 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

429 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

430 
} // parse_TEXDEPTH 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

431 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

432 
static int parse_CMP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

433 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

434 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

435 
} // parse_CMP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

436 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

437 
static int parse_BEM(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

438 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

439 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

440 
} // parse_BEM 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

441 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

442 
static int parse_DP2ADD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

443 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

444 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

445 
} // parse_DP2ADD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

446 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

447 
static int parse_DSX(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

448 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

449 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

450 
} // parse_DSX 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

451 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

452 
static int parse_DSY(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

453 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

454 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

455 
} // parse_DSY 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

456 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

457 
static int parse_TEXLDD(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

458 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

459 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

460 
} // parse_TEXLDD 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

461 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

462 
static int parse_SETP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

463 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

464 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

465 
} // parse_SETP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

466 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

467 
static int parse_TEXLDL(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

468 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

469 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

470 
} // parse_TEXLDL 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

471 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

472 
static int parse_BREAKP(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

473 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

474 
return FAIL("unimplemented."); // !!! FIXME 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

475 
} // parse_BREAKP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

476 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

477 
static int parse_RESERVED(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

478 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

479 
return FAIL("Tried to use RESERVED opcode."); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

480 
} // parse_BREAKP 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

481 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

482 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

483 

7  484 
// Lookup table for instruction opcodes... 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

485 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

486 
typedef struct 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

487 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

488 
const char *opcode_string; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

489 
int arg_tokens; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

490 
//uint32 shader_requirements; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

491 
parse_instruction_function parser; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

492 
} Instruction; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

493 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

494 
// These have to be in the right order! This array is indexed by the value 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

495 
// of the instruction token. 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

496 
static Instruction instructions[] = { 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

497 
#define INSTRUCTION(op, args) { #op, args, parse_##op } 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

498 
INSTRUCTION(NOP, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

499 
INSTRUCTION(MOV, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

500 
INSTRUCTION(ADD, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

501 
INSTRUCTION(SUB, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

502 
INSTRUCTION(MAD, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

503 
INSTRUCTION(MUL, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

504 
INSTRUCTION(RCP, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

505 
INSTRUCTION(RSQ, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

506 
INSTRUCTION(DP3, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

507 
INSTRUCTION(DP4, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

508 
INSTRUCTION(MIN, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

509 
INSTRUCTION(MAX, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

510 
INSTRUCTION(SLT, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

511 
INSTRUCTION(SGE, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

512 
INSTRUCTION(EXP, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

513 
INSTRUCTION(LOG, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

514 
INSTRUCTION(LIT, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

515 
INSTRUCTION(DST, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

516 
INSTRUCTION(LRP, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

517 
INSTRUCTION(FRC, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

518 
INSTRUCTION(M4X4, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

519 
INSTRUCTION(M4X3, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

520 
INSTRUCTION(M3X4, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

521 
INSTRUCTION(M3X3, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

522 
INSTRUCTION(M3X2, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

523 
INSTRUCTION(CALL, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

524 
INSTRUCTION(CALLNZ, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

525 
INSTRUCTION(LOOP, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

526 
INSTRUCTION(RET, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

527 
INSTRUCTION(ENDLOOP, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

528 
INSTRUCTION(LABEL, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

529 
INSTRUCTION(DCL, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

530 
INSTRUCTION(POW, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

531 
INSTRUCTION(CRS, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

532 
INSTRUCTION(SGN, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

533 
INSTRUCTION(ABS, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

534 
INSTRUCTION(NRM, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

535 
INSTRUCTION(SINCOS, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

536 
INSTRUCTION(REP, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

537 
INSTRUCTION(ENDREP, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

538 
INSTRUCTION(IF, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

539 
INSTRUCTION(IFC, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

540 
INSTRUCTION(ELSE, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

541 
INSTRUCTION(ENDIF, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

542 
INSTRUCTION(BREAK, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

543 
INSTRUCTION(BREAKC, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

544 
INSTRUCTION(MOVA, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

545 
INSTRUCTION(DEFB, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

546 
INSTRUCTION(DEFI, 5), 
6  547 
INSTRUCTION(RESERVED, 0), 
548 
INSTRUCTION(RESERVED, 0), 

549 
INSTRUCTION(RESERVED, 0), 

550 
INSTRUCTION(RESERVED, 0), 

551 
INSTRUCTION(RESERVED, 0), 

552 
INSTRUCTION(RESERVED, 0), 

553 
INSTRUCTION(RESERVED, 0), 

554 
INSTRUCTION(RESERVED, 0), 

555 
INSTRUCTION(RESERVED, 0), 

556 
INSTRUCTION(RESERVED, 0), 

557 
INSTRUCTION(RESERVED, 0), 

558 
INSTRUCTION(RESERVED, 0), 

559 
INSTRUCTION(RESERVED, 0), 

560 
INSTRUCTION(RESERVED, 0), 

561 
INSTRUCTION(RESERVED, 0), 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

562 
INSTRUCTION(TEXCOORD, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

563 
INSTRUCTION(TEXKILL, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

564 
INSTRUCTION(TEX, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

565 
INSTRUCTION(TEXBEM, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

566 
INSTRUCTION(TEXBEML, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

567 
INSTRUCTION(TEXREG2AR, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

568 
INSTRUCTION(TEXREG2GB, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

569 
INSTRUCTION(TEXM3X2PAD, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

570 
INSTRUCTION(TEXM3X2TEX, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

571 
INSTRUCTION(TEXM3X3PAD, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

572 
INSTRUCTION(TEXM3X3TEX, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

573 
INSTRUCTION(RESERVED, 0), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

574 
INSTRUCTION(TEXM3X3SPEC, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

575 
INSTRUCTION(TEXM3X3VSPEC, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

576 
INSTRUCTION(EXPP, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

577 
INSTRUCTION(LOGP, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

578 
INSTRUCTION(CND, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

579 
INSTRUCTION(DEF, 5), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

580 
INSTRUCTION(TEXREG2RGB, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

581 
INSTRUCTION(TEXDP3TEX, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

582 
INSTRUCTION(TEXM3X2DEPTH, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

583 
INSTRUCTION(TEXDP3, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

584 
INSTRUCTION(TEXM3X3, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

585 
INSTRUCTION(TEXDEPTH, 1), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

586 
INSTRUCTION(CMP, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

587 
INSTRUCTION(BEM, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

588 
INSTRUCTION(DP2ADD, 4), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

589 
INSTRUCTION(DSX, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

590 
INSTRUCTION(DSY, 2), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

591 
INSTRUCTION(TEXLDD, 5), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

592 
INSTRUCTION(SETP, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

593 
INSTRUCTION(TEXLDL, 3), 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

594 
INSTRUCTION(BREAKP, 1), // src 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

595 
#undef INSTRUCTION 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

596 
}; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

597 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

598 

7  599 
// parse various token types... 
600 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

601 
static int parse_instruction_token(D3D2GLSL_context *ctx) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

602 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

603 
const uint32 token = SWAP32(*(ctx>tokens)); 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

604 
const uint32 opcode = (token & 0xFFFF); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

605 
const uint32 controls = ((token >> 16) & 0xFF); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

606 
const uint32 insttoks = ((token >> 24) & 0x0F); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

607 
const int coissue = (token & 0x40000000) ? 1 : 0; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

608 
const int predicated = (token & 0x10000000) ? 1 : 0; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

609 
const Instruction *instruction = &instructions[opcode]; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

610 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

611 
if ( opcode >= (sizeof (instructions) / sizeof (instructions[0])) ) 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

612 
return 0; // not an instruction token, or just not handled here. 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

613 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

614 
if ((token & 0x80000000) != 0) 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

615 
return FAIL("instruction token high bit must be zero."); // so says msdn. 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

616 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

617 
printf("%s\n", instruction>opcode_string); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

618 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

619 
if (instruction>arg_tokens >= 0) 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

620 
{ 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

621 
if (instruction>arg_tokens != insttoks) 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

622 
return FAIL("unexpected number of tokens for instruction."); 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

623 
else if (ctx>tokencount <= instruction>arg_tokens) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

624 
return FAIL("not enough tokens left in shader for instruction."); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

625 
} // if 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

626 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

627 
return insttoks + 1; 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

628 
// return instruction>parser(ctx, tokens + 1); 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

629 
} // parse_instruction_token 
1  630 

631 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

632 
static int parse_version_token(D3D2GLSL_context *ctx) 
1  633 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

634 
if (ctx>tokencount == 0) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

635 
return FAIL("Expected version token, got none at all."); 
1  636 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

637 
const uint32 token = SWAP32(*(ctx>tokens)); 
1  638 
const uint32 shadertype = ((token >> 16) & 0xFFFF); 
639 
const uint32 major = ((token >> 8) & 0xFF); 

640 
const uint32 minor = (token & 0xFF); 

641 

642 
if (shadertype == 0xFFFF) 

643 
printf("Pixel shader\n"); 

644 
else if (shadertype == 0xFFFE) 

645 
printf("Vertex shader\n"); 

646 
else 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

647 
return FAIL("geometry shader? Unsupported at the moment."); 
1  648 

649 
printf("Version %u.%u\n", (uint) major, (uint) minor); 

650 

651 
return 1; // ate one token. 

652 
} // parse_version_token 

653 

654 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

655 
static int parse_comment_token(D3D2GLSL_context *ctx) 
1  656 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

657 
const uint32 token = SWAP32(*(ctx>tokens)); 
1  658 
if ((token & 0xFFFF) != 0xFFFE) 
659 
return 0; // not a comment token. 

660 
else if ((token & 0x80000000) != 0) 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

661 
return FAIL("comment token high bit must be zero."); // so says msdn. 
1  662 

663 
const uint32 commenttoks = ((token >> 16) & 0xFFFF); 

664 
const uint32 commentlen = commenttoks * sizeof (uint32); 

665 
printf("Comment (%u tokens, %u bytes): ", 

666 
(uint) commenttoks, (uint) commentlen); 

667 

668 
uint32 i = 0; 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

669 
const char *comment = (const char *) (ctx>tokens+1); 
1  670 
while (i < commentlen) 
671 
fputc(comment[i++], stdout); 

672 

673 
printf("\n"); 

674 

675 
return commenttoks + 1; // comment data plus the initial token. 

676 
} // parse_comment_token 

677 

678 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

679 
static int parse_end_token(D3D2GLSL_context *ctx) 
1  680 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

681 
if (SWAP32(*(ctx>tokens)) != 0x0000FFFF) // end token always 0x0000FFFF. 
1  682 
return 0; // not us, eat no tokens. 
683 

684 
printf("END\n"); 

685 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

686 
if (ctx>tokencount != 1) // we _must_ be last. If not: FAIL. 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

687 
return FAIL("end token before end of stream"); 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

688 

c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

689 
return END_OF_STREAM; 
1  690 
} // parse_end_token 
691 

692 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

693 
static int parse_phase_token(D3D2GLSL_context *ctx) 
1  694 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

695 
if (SWAP32(*(ctx>tokens)) != 0x0000FFFD) // phase token always 0x0000FFFD. 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

696 
return 0; // not us, eat no tokens. 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

697 
return FAIL("not sure what this thing is yet."); 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

698 
} // parse_phase_token 
1  699 

700 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

701 
static int parse_token(D3D2GLSL_context *ctx) 
1  702 
{ 
703 
int rc = 0; 

704 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

705 
if (ctx>tokencount == 0) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

706 
return FAIL("unexpected end of shader."); 
1  707 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

708 
if ((rc = parse_comment_token(ctx)) != 0) 
1  709 
return rc; 
710 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

711 
if ((rc = parse_end_token(ctx)) != 0) 
1  712 
return rc; 
713 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

714 
if ((rc = parse_phase_token(ctx)) != 0) 
2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

715 
return rc; 
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

716 

11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

717 
if ((rc = parse_instruction_token(ctx)) != 0) 
1  718 
return rc; 
719 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

720 
return FAIL("unknown token"); 
1  721 
} // parse_token 
722 

723 

7  724 
// API entry point... 
725 

9  726 
int D3D2GLSL_parse(const unsigned char *tokenbuf, const unsigned int bufsize) 
1  727 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

728 
D3D2GLSL_context ctx; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

729 
int rc = 0; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

730 

c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

731 
memset(&ctx, '\0', sizeof (D3D2GLSL_context)); 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

732 
ctx.tokens = (const uint32 *) tokenbuf; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

733 
ctx.tokencount = bufsize / sizeof (uint32); 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

734 
rc = parse_version_token(&ctx); 
1  735 

736 
// parse out the rest of the tokens after the version token... 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

737 
while (rc > 0) 
1  738 
{ 
11
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

739 
ctx.tokens += rc; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

740 
ctx.tokencount = rc; 
c9bb617d9b77
[svn] Pass around a context struct, so we can start tracking state, etc.
icculus
parents:
9
diff
changeset

741 
rc = parse_token(&ctx); 
1  742 
} // while 
743 

2
c37210f5e87b
[svn] Bunch More Work. Parse out instruction tokens, fail in a bunch of new stubs.
icculus
parents:
1
diff
changeset

744 
return (rc == END_OF_STREAM); 
1  745 
} // D3D2GLSL_parse 
746 

747 
// end of parse.c ... 

748 