author  Ryan C. Gordon <icculus@icculus.org> 
Tue, 03 Feb 2009 09:03:25 0500  
changeset 544  f829f48e5214 
parent 542  a56d3bfd2e36 
child 551  217200672d64 
permissions  rwrr 
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

1 
#ifndef _INCLUDE_MOJOSHADER_INTERNAL_H_ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

2 
#define _INCLUDE_MOJOSHADER_INTERNAL_H_ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

3 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

4 
#ifndef __MOJOSHADER_INTERNAL__ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

5 
#error Do not include this header from your applications. 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

6 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

7 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

8 
// Shader bytecode format is described at MSDN: 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

9 
// http://msdn2.microsoft.com/enus/library/ms800307.aspx 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

10 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

11 
#include <stdio.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

12 
#include <string.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

13 
#include <stdlib.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

14 
#include <stdarg.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

15 
#include <assert.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

16 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

17 
#include "mojoshader.h" 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

18 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

19 
#if (defined(__APPLE__) && defined(__MACH__)) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

20 
#define PLATFORM_MACOSX 1 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

21 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

22 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

23 
// This is the highest shader version we currently support. 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

24 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

25 
#define MAX_SHADER_MAJOR 3 
493
e2c930ab84b5
Allow SM3 shaders that are vs_3_x or vs_3_sw.
Ryan C. Gordon <icculus@icculus.org>
parents:
491
diff
changeset

26 
#define MAX_SHADER_MINOR 255 // vs_3_sw 
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

27 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

28 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

29 
// If SUPPORT_PROFILE_* isn't defined, we assume an implicit desire to support. 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

30 
// You get all the profiles unless you go out of your way to disable them. 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

31 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

32 
#ifndef SUPPORT_PROFILE_D3D 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

33 
#define SUPPORT_PROFILE_D3D 1 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

34 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

35 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

36 
#ifndef SUPPORT_PROFILE_PASSTHROUGH 
484
dfce8e965115
s/PASSTHROUGH/BYTECODE that I missed.
Ryan C. Gordon <icculus@icculus.org>
parents:
470
diff
changeset

37 
#define SUPPORT_PROFILE_BYTECODE 1 
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

38 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

39 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

40 
#ifndef SUPPORT_PROFILE_GLSL 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

41 
#define SUPPORT_PROFILE_GLSL 1 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

42 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

43 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

44 
#ifndef SUPPORT_PROFILE_ARB1 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

45 
#define SUPPORT_PROFILE_ARB1 1 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

46 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

47 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

48 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

49 
// Get basic wankery out of the way here... 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

50 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

51 
#ifdef _WINDOWS 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

52 
#define ENDLINE_STR "\r\n" 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

53 
#else 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

54 
#define ENDLINE_STR "\n"; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

55 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

56 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

57 
typedef unsigned int uint; // this is a printf() helper. don't use for code. 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

58 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

59 
#ifdef _MSC_VER 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

60 
#include <malloc.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

61 
#define snprintf _snprintf 
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

62 
#define strcasecmp stricmp 
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

63 
typedef unsigned __int8 uint8; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

64 
typedef unsigned __int16 uint16; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

65 
typedef unsigned __int32 uint32; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

66 
typedef __int32 int32; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

67 
// Warning Level 4 considered harmful. :) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

68 
#pragma warning(disable: 4100) // "unreferenced formal parameter" 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

69 
#pragma warning(disable: 4389) // "signed/unsigned mismatch" 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

70 
#else 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

71 
#include <stdint.h> 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

72 
typedef uint8_t uint8; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

73 
typedef uint16_t uint16; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

74 
typedef uint32_t uint32; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

75 
typedef int32_t int32; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

76 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

77 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

78 
#ifdef __GNUC__ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

79 
#define ISPRINTF(x,y) __attribute__((format (printf, x, y))) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

80 
#else 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

81 
#define ISPRINTF(x,y) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

82 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

83 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

84 
#define STATICARRAYLEN(x) ( (sizeof ((x))) / (sizeof ((x)[0])) ) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

85 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

86 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

87 
// Byteswap magic... 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

88 

eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

89 
#if ((defined __GNUC__) && (defined __POWERPC__)) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

90 
static inline uint32 SWAP32(uint32 x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

91 
{ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

92 
__asm__ __volatile__("lwbrx %0,0,%1" : "=r" (x) : "r" (&x)); 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

93 
return x; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

94 
} // SWAP32 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

95 
static inline uint16 SWAP16(uint16 x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

96 
{ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

97 
__asm__ __volatile__("lhbrx %0,0,%1" : "=r" (x) : "r" (&x)); 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

98 
return x; 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

99 
} // SWAP16 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

100 
#elif defined(__POWERPC__) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

101 
static inline uint32 SWAP32(uint32 x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

102 
{ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

103 
return ( (((x) >> 24) & 0x000000FF)  (((x) >> 8) & 0x0000FF00)  
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

104 
(((x) << 8) & 0x00FF0000)  (((x) << 24) & 0xFF000000) ); 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

105 
} // SWAP32 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

106 
static inline uint16 SWAP16(uint16 x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

107 
{ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

108 
return ( (((x) >> 8) & 0x00FF)  (((x) << 8) & 0xFF00) ); 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

109 
} // SWAP16 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

110 
#else 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

111 
# define SWAP16(x) (x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

112 
# define SWAP32(x) (x) 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

113 
#endif 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

114 

524
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

115 
// This is the ID for a D3DXSHADER_CONSTANTTABLE in the bytecode comments. 
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

116 
#define CTAB_ID 0x42415443 // 0x42415443 == 'CTAB' 
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

117 
#define CTAB_SIZE 28 // sizeof (D3DXSHADER_CONSTANTTABLE). 
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

118 
#define CINFO_SIZE 20 // sizeof (D3DXSHADER_CONSTANTINFO). 
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

119 
#define CTYPEINFO_SIZE 16 // sizeof (D3DXSHADER_TYPEINFO). 
03eea2f0762c
First (incomplete!) shot at more robust CTAB support.
Ryan C. Gordon <icculus@icculus.org>
parents:
523
diff
changeset

120 
#define CMEMBERINFO_SIZE 8 // sizeof (D3DXSHADER_STRUCTMEMBERINFO) 
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

121 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

122 
// we need to reference these by explicit value occasionally... 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

123 
#define OPCODE_RET 28 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

124 
#define OPCODE_IFC 41 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

125 
#define OPCODE_BREAKC 45 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

126 

519
c9b27381c971
Added TEXLDP/TEXLDP support to the assembler, cleaned up constants.
Ryan C. Gordon <icculus@icculus.org>
parents:
493
diff
changeset

127 
// TEXLD becomes a different instruction with these instruction controls. 
c9b27381c971
Added TEXLDP/TEXLDP support to the assembler, cleaned up constants.
Ryan C. Gordon <icculus@icculus.org>
parents:
493
diff
changeset

128 
#define CONTROL_TEXLD 0 
c9b27381c971
Added TEXLDP/TEXLDP support to the assembler, cleaned up constants.
Ryan C. Gordon <icculus@icculus.org>
parents:
493
diff
changeset

129 
#define CONTROL_TEXLDP 1 
c9b27381c971
Added TEXLDP/TEXLDP support to the assembler, cleaned up constants.
Ryan C. Gordon <icculus@icculus.org>
parents:
493
diff
changeset

130 
#define CONTROL_TEXLDB 2 
c9b27381c971
Added TEXLDP/TEXLDP support to the assembler, cleaned up constants.
Ryan C. Gordon <icculus@icculus.org>
parents:
493
diff
changeset

131 

465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

132 
// #define this to force app to supply an allocator, so there's no reference 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

133 
// to the C runtime's malloc() and free()... 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

134 
#if MOJOSHADER_FORCE_ALLOCATOR 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

135 
#define internal_malloc NULL 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

136 
#define internal_free NULL 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

137 
#else 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

138 
static void *internal_malloc(int bytes, void *d) { return malloc(bytes); } 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

139 
static void internal_free(void *ptr, void *d) { free(ptr); } 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

140 
#endif 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

141 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

142 
// result modifiers. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

143 
// !!! FIXME: why isn't this an enum? 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

144 
#define MOD_SATURATE 0x01 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

145 
#define MOD_PP 0x02 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

146 
#define MOD_CENTROID 0x04 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

147 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

148 
typedef enum 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

149 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

150 
REG_TYPE_TEMP = 0, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

151 
REG_TYPE_INPUT = 1, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

152 
REG_TYPE_CONST = 2, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

153 
REG_TYPE_ADDRESS = 3, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

154 
REG_TYPE_TEXTURE = 3, // ALSO 3! 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

155 
REG_TYPE_RASTOUT = 4, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

156 
REG_TYPE_ATTROUT = 5, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

157 
REG_TYPE_TEXCRDOUT = 6, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

158 
REG_TYPE_OUTPUT = 6, // ALSO 6! 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

159 
REG_TYPE_CONSTINT = 7, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

160 
REG_TYPE_COLOROUT = 8, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

161 
REG_TYPE_DEPTHOUT = 9, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

162 
REG_TYPE_SAMPLER = 10, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

163 
REG_TYPE_CONST2 = 11, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

164 
REG_TYPE_CONST3 = 12, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

165 
REG_TYPE_CONST4 = 13, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

166 
REG_TYPE_CONSTBOOL = 14, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

167 
REG_TYPE_LOOP = 15, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

168 
REG_TYPE_TEMPFLOAT16 = 16, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

169 
REG_TYPE_MISCTYPE = 17, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

170 
REG_TYPE_LABEL = 18, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

171 
REG_TYPE_PREDICATE = 19, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

172 
REG_TYPE_MAX = 19 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

173 
} RegisterType; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

174 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

175 
typedef enum 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

176 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

177 
TEXTURE_TYPE_2D = 2, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

178 
TEXTURE_TYPE_CUBE = 3, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

179 
TEXTURE_TYPE_VOLUME = 4, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

180 
} TextureType; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

181 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

182 
typedef enum 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

183 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

184 
RASTOUT_TYPE_POSITION = 0, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

185 
RASTOUT_TYPE_FOG = 1, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

186 
RASTOUT_TYPE_POINT_SIZE = 2, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

187 
RASTOUT_TYPE_MAX = 2 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

188 
} RastOutType; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

189 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

190 
typedef enum 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

191 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

192 
MISCTYPE_TYPE_POSITION = 0, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

193 
MISCTYPE_TYPE_FACE = 1, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

194 
MISCTYPE_TYPE_MAX = 1 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

195 
} MiscTypeType; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

196 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

197 
// source modifiers. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

198 
typedef enum 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

199 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

200 
SRCMOD_NONE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

201 
SRCMOD_NEGATE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

202 
SRCMOD_BIAS, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

203 
SRCMOD_BIASNEGATE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

204 
SRCMOD_SIGN, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

205 
SRCMOD_SIGNNEGATE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

206 
SRCMOD_COMPLEMENT, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

207 
SRCMOD_X2, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

208 
SRCMOD_X2NEGATE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

209 
SRCMOD_DZ, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

210 
SRCMOD_DW, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

211 
SRCMOD_ABS, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

212 
SRCMOD_ABSNEGATE, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

213 
SRCMOD_NOT, 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

214 
SRCMOD_TOTAL 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

215 
} SourceMod; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

216 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

217 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

218 
typedef struct 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

219 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

220 
const uint32 *token; // this is the unmolested token in the stream. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

221 
int regnum; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

222 
int relative; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

223 
int writemask; // xyzw or rgba (all four, not split out). 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

224 
int writemask0; // x or red 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

225 
int writemask1; // y or green 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

226 
int writemask2; // z or blue 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

227 
int writemask3; // w or alpha 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

228 
int orig_writemask; // writemask before mojoshader tweaks it. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

229 
int result_mod; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

230 
int result_shift; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

231 
RegisterType regtype; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

232 
} DestArgInfo; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

233 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

234 

491
bcc3c215807a
Fixed wrong data from scalar_register().
Ryan C. Gordon <icculus@icculus.org>
parents:
484
diff
changeset

235 
static inline int scalar_register(const MOJOSHADER_shaderType shader_type, 
bcc3c215807a
Fixed wrong data from scalar_register().
Ryan C. Gordon <icculus@icculus.org>
parents:
484
diff
changeset

236 
const RegisterType regtype, const int regnum) 
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

237 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

238 
switch (regtype) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

239 
{ 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

240 
case REG_TYPE_DEPTHOUT: 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

241 
case REG_TYPE_CONSTBOOL: 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

242 
case REG_TYPE_LOOP: 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

243 
return 1; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

244 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

245 
case REG_TYPE_MISCTYPE: 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

246 
if ( ((const MiscTypeType) regnum) == MISCTYPE_TYPE_FACE ) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

247 
return 1; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

248 
return 0; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

249 

491
bcc3c215807a
Fixed wrong data from scalar_register().
Ryan C. Gordon <icculus@icculus.org>
parents:
484
diff
changeset

250 
case REG_TYPE_PREDICATE: 
bcc3c215807a
Fixed wrong data from scalar_register().
Ryan C. Gordon <icculus@icculus.org>
parents:
484
diff
changeset

251 
return (shader_type == MOJOSHADER_TYPE_PIXEL) ? 1 : 0; 
bcc3c215807a
Fixed wrong data from scalar_register().
Ryan C. Gordon <icculus@icculus.org>
parents:
484
diff
changeset

252 

465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

253 
default: break; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

254 
} // switch 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

255 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

256 
return 0; 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

257 
} // scalar_register 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

258 

523
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

259 
typedef enum 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

260 
{ 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

261 
MOJOSHADER_PARSEPHASE_NOTSTARTED, 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

262 
MOJOSHADER_PARSEPHASE_WORKING, 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

263 
MOJOSHADER_PARSEPHASE_DONE, 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

264 
} MOJOSHADER_parsePhase; 
699696afd731
Allow errors to specify postprocessing problems.
Ryan C. Gordon <icculus@icculus.org>
parents:
520
diff
changeset

265 

470
7d84d3452125
Bunch More Work on the assembler.
Ryan C. Gordon <icculus@icculus.org>
parents:
468
diff
changeset

266 
extern MOJOSHADER_parseData out_of_mem_data; 
542
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

267 

a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

268 
typedef struct ErrorList 
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

269 
{ 
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

270 
MOJOSHADER_error error; 
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

271 
struct ErrorList *next; 
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

272 
} ErrorList; 
a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

273 

a56d3bfd2e36
More work on multiple error messages.
Ryan C. Gordon <icculus@icculus.org>
parents:
524
diff
changeset

274 

470
7d84d3452125
Bunch More Work on the assembler.
Ryan C. Gordon <icculus@icculus.org>
parents:
468
diff
changeset

275 

464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

276 
#endif // _INCLUDE_MOJOSHADER_INTERNAL_H_ 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

277 

465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

278 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

279 
#if MOJOSHADER_DO_INSTRUCTION_TABLE 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

280 
// These have to be in the right order! Arrays are indexed by the value 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

281 
// of the instruction token. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

282 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

283 
// INSTRUCTION_STATE means this opcode has to update the state machine 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

284 
// (we're entering an ELSE block, etc). INSTRUCTION means there's no 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

285 
// state, just go straight to the emitters. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

286 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

287 
// !!! FIXME: Some of these MOJOSHADER_TYPE_ANYs need to have their scope 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

288 
// !!! FIXME: reduced to just PIXEL or VERTEX. 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

289 

0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

290 
INSTRUCTION(NOP, "NOP", 1, NULL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

291 
INSTRUCTION(MOV, "MOV", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

292 
INSTRUCTION(ADD, "ADD", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

293 
INSTRUCTION(SUB, "SUB", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

294 
INSTRUCTION(MAD, "MAD", 1, DSSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

295 
INSTRUCTION(MUL, "MUL", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

296 
INSTRUCTION_STATE(RCP, "RCP", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

297 
INSTRUCTION(RSQ, "RSQ", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

298 
INSTRUCTION(DP3, "DP3", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

299 
INSTRUCTION_STATE(DP4, "DP4", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

300 
INSTRUCTION(MIN, "MIN", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

301 
INSTRUCTION(MAX, "MAX", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

302 
INSTRUCTION(SLT, "SLT", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

303 
INSTRUCTION(SGE, "SGE", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

304 
INSTRUCTION(EXP, "EXP", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

305 
INSTRUCTION_STATE(LOG, "LOG", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

306 
INSTRUCTION(LIT, "LIT", 3, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

307 
INSTRUCTION(DST, "DST", 1, DSS, MOJOSHADER_TYPE_VERTEX) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

308 
INSTRUCTION(LRP, "LRP", 2, DSSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

309 
INSTRUCTION_STATE(FRC, "FRC", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

310 
INSTRUCTION_STATE(M4X4, "M4X4", 4, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

311 
INSTRUCTION_STATE(M4X3, "M4X3", 3, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

312 
INSTRUCTION_STATE(M3X4, "M3X4", 4, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

313 
INSTRUCTION_STATE(M3X3, "M3X3", 3, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

314 
INSTRUCTION_STATE(M3X2, "M3X2", 2, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

315 
INSTRUCTION_STATE(CALL, "CALL", 2, S, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

316 
INSTRUCTION_STATE(CALLNZ, "CALLNZ", 3, SS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

317 
INSTRUCTION_STATE(LOOP, "LOOP", 3, SS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

318 
INSTRUCTION_STATE(RET, "RET", 1, NULL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

319 
INSTRUCTION_STATE(ENDLOOP, "ENDLOOP", 2, NULL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

320 
INSTRUCTION_STATE(LABEL, "LABEL", 0, S, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

321 
INSTRUCTION_STATE(DCL, "DCL", 0, DCL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

322 
INSTRUCTION_STATE(POW, "POW", 3, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

323 
INSTRUCTION(CRS, "CRS", 2, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

324 
INSTRUCTION(SGN, "SGN", 3, DSSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

325 
INSTRUCTION(ABS, "ABS", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

326 
INSTRUCTION(NRM, "NRM", 3, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

327 
INSTRUCTION_STATE(SINCOS, "SINCOS", 8, SINCOS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

328 
INSTRUCTION_STATE(REP, "REP", 3, S, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

329 
INSTRUCTION_STATE(ENDREP, "ENDREP", 2, NULL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

330 
INSTRUCTION_STATE(IF, "IF", 3, S, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

331 
INSTRUCTION_STATE(IFC, "IF", 3, SS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

332 
INSTRUCTION(ELSE, "ELSE", 1, NULL, MOJOSHADER_TYPE_ANY) // !!! FIXME: state! 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

333 
INSTRUCTION(ENDIF, "ENDIF", 1, NULL, MOJOSHADER_TYPE_ANY) // !!! FIXME: state! 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

334 
INSTRUCTION_STATE(BREAK, "BREAK", 1, NULL, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

335 
INSTRUCTION_STATE(BREAKC, "BREAK", 3, SS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

336 
INSTRUCTION_STATE(MOVA, "MOVA", 1, DS, MOJOSHADER_TYPE_VERTEX) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

337 
INSTRUCTION_STATE(DEFB, "DEFB", 0, DEFB, MOJOSHADER_TYPE_ANY) 
467
577a9d07b6bf
DEFI has its own parse_args() now.
Ryan C. Gordon <icculus@icculus.org>
parents:
465
diff
changeset

338 
INSTRUCTION_STATE(DEFI, "DEFI", 0, DEFI, MOJOSHADER_TYPE_ANY) 
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

339 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

340 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

341 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

342 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

343 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

344 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

345 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

346 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

347 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

348 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

349 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

350 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

351 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

352 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

353 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

354 
INSTRUCTION_STATE(TEXCRD, "TEXCRD", 1, TEXCRD, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

355 
INSTRUCTION_STATE(TEXKILL, "TEXKILL", 2, D, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

356 
INSTRUCTION_STATE(TEXLD, "TEXLD", 1, TEXLD, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

357 
INSTRUCTION(TEXBEM, "TEXBEM", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

358 
INSTRUCTION(TEXBEML, "TEXBEML", 2, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

359 
INSTRUCTION(TEXREG2AR, "TEXREG2AR", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

360 
INSTRUCTION(TEXREG2GB, "TEXREG2GB", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

361 
INSTRUCTION(TEXM3X2PAD, "TEXM3X2PAD", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

362 
INSTRUCTION(TEXM3X2TEX, "TEXM3X2TEX", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

363 
INSTRUCTION(TEXM3X3PAD, "TEXM3X3PAD", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

364 
INSTRUCTION(TEXM3X3TEX, "TEXM3X3TEX", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

365 
INSTRUCTION(RESERVED, 0, 0, NULL, MOJOSHADER_TYPE_UNKNOWN) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

366 
INSTRUCTION(TEXM3X3SPEC, "TEXM3X3SPEC", 1, DSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

367 
INSTRUCTION(TEXM3X3VSPEC, "TEXM3X3VSPEC", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

368 
INSTRUCTION(EXPP, "EXPP", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

369 
INSTRUCTION_STATE(LOGP, "LOGP", 1, DS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

370 
INSTRUCTION_STATE(CND, "CND", 1, DSSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

371 
INSTRUCTION_STATE(DEF, "DEF", 0, DEF, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

372 
INSTRUCTION(TEXREG2RGB, "TEXREG2RGB", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

373 
INSTRUCTION(TEXDP3TEX, "TEXDP3TEX", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

374 
INSTRUCTION(TEXM3X2DEPTH, "TEXM3X2DEPTH", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

375 
INSTRUCTION(TEXDP3, "TEXDP3", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

376 
INSTRUCTION(TEXM3X3, "TEXM3X3", 1, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

377 
INSTRUCTION(TEXDEPTH, "TEXDEPTH", 1, D, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

378 
INSTRUCTION_STATE(CMP, "CMP", 1, DSSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

379 
INSTRUCTION(BEM, "BEM", 2, DSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

380 
INSTRUCTION_STATE(DP2ADD, "DP2ADD", 2, DSSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

381 
INSTRUCTION(DSX, "DSX", 2, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

382 
INSTRUCTION(DSY, "DSY", 2, DS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

383 
INSTRUCTION(TEXLDD, "TEXLDD", 3, DSSSS, MOJOSHADER_TYPE_PIXEL) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

384 
INSTRUCTION_STATE(SETP, "SETP", 1, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

385 
INSTRUCTION_STATE(TEXLDL, "TEXLDL", 2, DSS, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

386 
INSTRUCTION_STATE(BREAKP, "BREAKP", 3, S, MOJOSHADER_TYPE_ANY) 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

387 
#endif 
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset

388 

464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

389 
// end of mojoshader_internal.h ... 
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset

390 