author  icculus 
Sun, 09 Mar 2008 04:18:31 0400  
branch  trunk 
changeset 12  d81712dd1a46 
parent 11  c9bb617d9b77 
child 13  f2baea592d2a 
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> 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

17 

9  18 
#include "d3d2glsl.h" 
19 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

20 
#ifdef __GNUC__ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

21 
#define ISPRINTF(x,y) __attribute__((format (printf, x, y))) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

22 
#else 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

23 
#define ISPRINTF(x,y) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

24 
#endif 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

25 

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

26 
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

27 
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

28 
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

29 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

30 
#define D3D2GLSL_SCRATCH_BUFFER_SIZE 256 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

31 
#define D3D2GLSL_SCRATCH_BUFFERS 5 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

32 

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

33 
// 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

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

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

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

37 
uint32 tokencount; 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

38 
char *output; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

39 
uint32 output_len; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

40 
char *failstr; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

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

44 

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

45 

7  46 
// Byteswap magic... 
47 

4  48 
#if ((defined __GNUC__) && (defined __POWERPC__)) 
49 
static inline uint32 SWAP32(uint32 x) 

50 
{ 

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

52 
return x; 

53 
} // SWAP32 

54 
#elif defined(__POWERPC__) 

55 
static inline uint32 SWAP32(uint32 x) 

56 
{ 

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

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

59 
} // SWAP32 

60 
#else 

61 
# define SWAP32(x) (x) 

62 
#endif 

63 

7  64 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

65 
static inline char *get_scratch_buffer(D3D2GLSL_context *ctx) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

66 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

67 
ctx>bufidx = (ctx>bufidx + 1) % D3D2GLSL_SCRATCH_BUFFERS; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

68 
return ctx>buffers[ctx>bufidx]; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

69 
} // get_scratch_buffer 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

70 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

71 

7  72 
// Specialcase return values from the parsing pipeline... 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

73 
#define FAIL (1) 
7  74 
#define END_OF_STREAM (2) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

75 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

76 
static int failf(D3D2GLSL_context *ctx, const char *fmt, ...) ISPRINTF(2,3); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

77 
static int failf(D3D2GLSL_context *ctx, const char *fmt, ...) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

78 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

79 
if (ctx>failstr == NULL) // don't change existing error. 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

80 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

81 
char *buffer = get_scratch_buffer(ctx); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

82 
va_list ap; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

83 
va_start(ap, fmt); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

84 
vsnprintf(buffer, D3D2GLSL_SCRATCH_BUFFER_SIZE, fmt, ap); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

85 
va_end(ap); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

86 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

87 
ctx>failstr = (char *) malloc(strlen(buffer) + 1); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

88 
if (ctx>failstr != NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

89 
strcpy(ctx>failstr, buffer); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

90 
} // if 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

91 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

92 
return FAIL; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

93 
} // failf 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

94 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

95 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

96 
static inline int fail(D3D2GLSL_context *ctx, const char *reason) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

97 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

98 
return failf(ctx, "%s", reason); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

99 
} // fail 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

100 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

101 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

102 
static int output_line(D3D2GLSL_context *ctx, const char *fmt, ...) ISPRINTF(2,3); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

103 
static int output_line(D3D2GLSL_context *ctx, const char *fmt, ...) 
7  104 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

105 
if (ctx>failstr != NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

106 
return FAIL; // we failed previously, don't go on... 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

107 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

108 
char *buffer = get_scratch_buffer(ctx); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

109 
va_list ap; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

110 
va_start(ap, fmt); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

111 
const int len = vsnprintf(buffer, D3D2GLSL_SCRATCH_BUFFER_SIZE, fmt, ap); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

112 
va_end(ap); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

113 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

114 
if (len >= D3D2GLSL_SCRATCH_BUFFER_SIZE) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

115 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

116 
return failf(ctx, "Internal bugString is too big (%d vs %d bytes).", 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

117 
(int) len, (int) D3D2GLSL_SCRATCH_BUFFER_SIZE); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

118 
} // if 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

119 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

120 
const size_t newlen = ctx>output_len + len + 1; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

121 
char *ptr = (char *) realloc(ctx>output, newlen+1); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

122 
if (ptr == NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

123 
return fail(ctx, "Out of memory"); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

124 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

125 
memcpy(ptr + ctx>output_len, buffer, len); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

126 
ptr[newlen1] = '\n'; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

127 
ptr[newlen] = '\0'; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

128 
ctx>output = ptr; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

129 
ctx>output_len = newlen; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

130 
return 0; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

131 
} // output_line 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

132 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

133 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

134 
static int parse_destination_token(D3D2GLSL_context *ctx) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

135 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

136 
} // parse_destination_token 
7  137 

138 

139 
// one function for each opcode... 

140 

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

141 
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

142 

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

143 
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

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

145 
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

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

147 

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

148 
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

149 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

152 

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

153 
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

154 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

157 

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

158 
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

159 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

162 

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

163 
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

164 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

167 

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

168 
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

169 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

172 

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

173 
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

174 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

177 

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

178 
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

179 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

182 

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

183 
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

184 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

187 

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

188 
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

189 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

192 

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

193 
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

194 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

197 

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

198 
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

199 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

202 

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

203 
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

204 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

207 

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

208 
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

209 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

212 

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

213 
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

214 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

217 

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

218 
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

219 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

222 

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

223 
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

224 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

227 

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

228 
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

229 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

232 

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

233 
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

234 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

237 

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

238 
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

239 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

242 

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

243 
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

244 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

247 

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

248 
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

249 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

252 

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

253 
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

254 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

257 

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

258 
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

259 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

262 

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

263 
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

264 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

267 

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

268 
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

269 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

271 
} // parse_CALL 
1  272 

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

273 
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

274 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

277 

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

278 
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

279 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

282 

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

283 
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

284 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

287 

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

288 
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

289 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

292 

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

293 
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

294 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

297 

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

298 
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

299 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

302 

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

303 
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

304 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

307 

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

308 
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

309 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

312 

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

313 
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

314 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

317 

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

318 
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

319 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

322 

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

323 
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

324 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

327 

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

328 
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

329 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

332 

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

333 
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

334 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

337 

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

338 
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

339 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

342 

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

343 
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

344 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

347 

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

348 
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

349 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

352 

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

353 
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

354 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

357 

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

358 
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

359 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

362 

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

363 
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

364 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

367 

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

368 
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

369 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

372 

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

373 
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

374 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

377 

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

378 
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

379 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

382 

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

383 
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

384 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

387 

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

388 
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

389 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

392 

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

393 
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

394 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

397 

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

398 
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

399 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

402 

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

403 
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

404 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

407 

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

408 
static int parse_TEXBEML(D3D2GLSL_context *ctx) 
1  409 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

412 

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

413 
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

414 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

417 

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

418 
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

419 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

422 

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

423 
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

424 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

427 

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

428 
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

429 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

432 

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

433 
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

434 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

437 

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

438 
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

439 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

442 

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

443 
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

444 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

447 

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

448 
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

449 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

452 

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

453 
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

454 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

457 

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

458 
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

459 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

462 

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

463 
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

464 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

467 

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

468 
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

469 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

472 

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

473 
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

474 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

477 

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

478 
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

479 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

482 

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

483 
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

484 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

487 

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

488 
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

489 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

492 

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

493 
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

494 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

497 

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

498 
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

499 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

502 

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

503 
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

504 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

507 

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

508 
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

509 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

512 

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

513 
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

514 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

517 

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

518 
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

519 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

522 

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

523 
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

524 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

527 

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

528 
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

529 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

532 

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

533 
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

534 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

537 

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

538 
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

539 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

542 

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

543 
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

544 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

547 

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

548 
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

549 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

552 

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

553 
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

554 
{ 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

557 

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

558 

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

559 

7  560 
// 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

561 

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

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

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

564 
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

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

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

567 
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

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

569 

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

570 
// 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

571 
// 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

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

573 
#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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

622 
INSTRUCTION(DEFI, 5), 
6  623 
INSTRUCTION(RESERVED, 0), 
624 
INSTRUCTION(RESERVED, 0), 

625 
INSTRUCTION(RESERVED, 0), 

626 
INSTRUCTION(RESERVED, 0), 

627 
INSTRUCTION(RESERVED, 0), 

628 
INSTRUCTION(RESERVED, 0), 

629 
INSTRUCTION(RESERVED, 0), 

630 
INSTRUCTION(RESERVED, 0), 

631 
INSTRUCTION(RESERVED, 0), 

632 
INSTRUCTION(RESERVED, 0), 

633 
INSTRUCTION(RESERVED, 0), 

634 
INSTRUCTION(RESERVED, 0), 

635 
INSTRUCTION(RESERVED, 0), 

636 
INSTRUCTION(RESERVED, 0), 

637 
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

670 
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

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

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

673 

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

674 

7  675 
// parse various token types... 
676 

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

677 
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

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

679 
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

680 
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

681 
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

682 
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

683 
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

684 
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

685 
const Instruction *instruction = &instructions[opcode]; 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

687 

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

688 
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

689 
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

690 

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

691 
if ((token & 0x80000000) != 0) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

693 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

694 
// this isn't right. 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

696 

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

697 
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

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

699 
if (instruction>arg_tokens != insttoks) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

700 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

701 
return failf(ctx, 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

702 
"unexpected number of tokens (%u) for instruction '%s'.", 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

703 
(uint) insttoks, instruction>opcode_string); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

705 
else if (ctx>tokencount <= instruction>arg_tokens) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

706 
{ 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

707 
return failf(ctx, 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

708 
"need more tokens (need %u, got %u) for instruction '%s'.", 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

709 
(uint) instruction>arg_tokens, (uint) ctx>tokencount, 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

710 
instruction>opcode_string); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

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

713 

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

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

715 
// 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

716 
} // parse_instruction_token 
1  717 

718 

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

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

721 
if (ctx>tokencount == 0) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

722 
return fail(ctx, "Expected version token, got none at all."); 
1  723 

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

724 
const uint32 token = SWAP32(*(ctx>tokens)); 
1  725 
const uint32 shadertype = ((token >> 16) & 0xFFFF); 
726 
const uint32 major = ((token >> 8) & 0xFF); 

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

728 

729 
if (shadertype == 0xFFFF) 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

730 
output_line(ctx, "Pixel shader"); 
1  731 
else if (shadertype == 0xFFFE) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

732 
output_line(ctx, "Vertex shader"); 
1  733 
else 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

734 
return fail(ctx, "geometry shader? Unsupported at the moment."); 
1  735 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

736 
output_line(ctx, "Version %u.%u", (uint) major, (uint) minor); 
1  737 

738 
return 1; // ate one token. 

739 
} // parse_version_token 

740 

741 

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

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

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

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

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

748 
return fail(ctx, "comment token high bit must be zero."); // so says msdn. 
1  749 

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

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

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

752 
output_line(ctx, "Comment (%u tokens, %u bytes): ", 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

753 
(uint) commenttoks, (uint) commentlen); 
1  754 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

755 
// uint32 i = 0; 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

756 
// const char *comment = (const char *) (ctx>tokens+1); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

757 
// while (i < commentlen) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

758 
// fputc(comment[i++], stdout); 
1  759 

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

761 
} // parse_comment_token 

762 

763 

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

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

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

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

769 
output_line(ctx, "END"); 
1  770 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

771 
if (ctx>tokencount != 1) // we _must_ be last. If not: fail. 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

772 
return fail(ctx, "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

773 

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

774 
return END_OF_STREAM; 
1  775 
} // parse_end_token 
776 

777 

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

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

780 
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

781 
return 0; // not us, eat no tokens. 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

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

783 
} // parse_phase_token 
1  784 

785 

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

786 
static int parse_token(D3D2GLSL_context *ctx) 
1  787 
{ 
788 
int rc = 0; 

789 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

790 
if (ctx>failstr != NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

791 
return FAIL; // just in case...catch previously unhandled fails here. 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

792 

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

793 
if (ctx>tokencount == 0) 
12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

794 
return fail(ctx, "unexpected end of shader."); 
1  795 

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

796 
if ((rc = parse_comment_token(ctx)) != 0) 
1  797 
return rc; 
798 

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

799 
if ((rc = parse_end_token(ctx)) != 0) 
1  800 
return rc; 
801 

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

802 
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

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

804 

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

805 
if ((rc = parse_instruction_token(ctx)) != 0) 
1  806 
return rc; 
807 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

808 
return failf(ctx, "unknown token (%u)", (uint) *ctx>tokens); 
1  809 
} // parse_token 
810 

811 

7  812 
// API entry point... 
813 

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

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

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

818 

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

819 
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

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

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

822 
rc = parse_version_token(&ctx); 
1  823 

824 
// 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

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

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

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

829 
rc = parse_token(&ctx); 
1  830 
} // while 
831 

12
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

832 
// !!! FIXME: temp 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

833 
if (ctx.output != NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

834 
printf("%s\n", ctx.output); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

835 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

836 
if (ctx.failstr != NULL) 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

837 
printf("FAIL: %s\n", ctx.failstr); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

838 

d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

839 
free(ctx.failstr); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

840 
free(ctx.output); 
d81712dd1a46
[svn] Cleaned up and improved output and fail state.
icculus
parents:
11
diff
changeset

841 

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

842 
return (rc == END_OF_STREAM); 
1  843 
} // D3D2GLSL_parse 
844 

845 
// end of parse.c ... 

846 