author | Ryan C. Gordon <icculus@icculus.org> |
Thu, 04 Dec 2008 21:36:11 -0500 | |
changeset 465 | 0a75f98f785b |
parent 464 | eba4cf79437f |
child 467 | 577a9d07b6bf |
permissions | -rw-r--r-- |
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/en-us/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 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 |
#define MAX_SHADER_MINOR 0 |
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 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 |
#define SUPPORT_PROFILE_PASSTHROUGH 1 |
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 |
// Special-case return values from the parsing pipeline... |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
87 |
#define FAIL (-1) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
88 |
#define NOFAIL (-2) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
89 |
#define END_OF_STREAM (-3) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
90 |
|
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 |
// Byteswap magic... |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
93 |
|
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
94 |
#if ((defined __GNUC__) && (defined __POWERPC__)) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
95 |
static inline uint32 SWAP32(uint32 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__("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
|
98 |
return x; |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
99 |
} // SWAP32 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
100 |
static inline uint16 SWAP16(uint16 x) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
101 |
{ |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
102 |
__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
|
103 |
return x; |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
104 |
} // SWAP16 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
105 |
#elif defined(__POWERPC__) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
106 |
static inline uint32 SWAP32(uint32 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) >> 24) & 0x000000FF) | (((x) >> 8) & 0x0000FF00) | |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
109 |
(((x) << 8) & 0x00FF0000) | (((x) << 24) & 0xFF000000) ); |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
110 |
} // SWAP32 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
111 |
static inline uint16 SWAP16(uint16 x) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
112 |
{ |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
113 |
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
|
114 |
} // SWAP16 |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
115 |
#else |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
116 |
# define SWAP16(x) (x) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
117 |
# define SWAP32(x) (x) |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
118 |
#endif |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
119 |
|
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
120 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
121 |
// 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
|
122 |
#define OPCODE_RET 28 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
123 |
#define OPCODE_IFC 41 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
124 |
#define OPCODE_BREAKC 45 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
125 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
126 |
// #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
|
127 |
// 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
|
128 |
#if MOJOSHADER_FORCE_ALLOCATOR |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
129 |
#define internal_malloc NULL |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
130 |
#define internal_free NULL |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
131 |
#else |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
132 |
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
|
133 |
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
|
134 |
#endif |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
135 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
136 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
137 |
// result modifiers. |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
138 |
// !!! 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
|
139 |
#define MOD_SATURATE 0x01 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
140 |
#define MOD_PP 0x02 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
141 |
#define MOD_CENTROID 0x04 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
142 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
143 |
typedef enum |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
144 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
145 |
REG_TYPE_TEMP = 0, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
146 |
REG_TYPE_INPUT = 1, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
147 |
REG_TYPE_CONST = 2, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
148 |
REG_TYPE_ADDRESS = 3, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
149 |
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
|
150 |
REG_TYPE_RASTOUT = 4, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
151 |
REG_TYPE_ATTROUT = 5, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
152 |
REG_TYPE_TEXCRDOUT = 6, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
153 |
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
|
154 |
REG_TYPE_CONSTINT = 7, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
155 |
REG_TYPE_COLOROUT = 8, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
156 |
REG_TYPE_DEPTHOUT = 9, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
157 |
REG_TYPE_SAMPLER = 10, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
158 |
REG_TYPE_CONST2 = 11, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
159 |
REG_TYPE_CONST3 = 12, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
160 |
REG_TYPE_CONST4 = 13, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
161 |
REG_TYPE_CONSTBOOL = 14, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
162 |
REG_TYPE_LOOP = 15, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
163 |
REG_TYPE_TEMPFLOAT16 = 16, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
164 |
REG_TYPE_MISCTYPE = 17, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
165 |
REG_TYPE_LABEL = 18, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
166 |
REG_TYPE_PREDICATE = 19, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
167 |
REG_TYPE_MAX = 19 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
168 |
} RegisterType; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
169 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
170 |
typedef enum |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
171 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
172 |
TEXTURE_TYPE_2D = 2, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
173 |
TEXTURE_TYPE_CUBE = 3, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
174 |
TEXTURE_TYPE_VOLUME = 4, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
175 |
} TextureType; |
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 |
typedef enum |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
178 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
179 |
RASTOUT_TYPE_POSITION = 0, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
180 |
RASTOUT_TYPE_FOG = 1, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
181 |
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
|
182 |
RASTOUT_TYPE_MAX = 2 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
183 |
} RastOutType; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
184 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
185 |
typedef enum |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
186 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
187 |
MISCTYPE_TYPE_POSITION = 0, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
188 |
MISCTYPE_TYPE_FACE = 1, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
189 |
MISCTYPE_TYPE_MAX = 1 |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
190 |
} MiscTypeType; |
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 |
// source modifiers. |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
193 |
typedef enum |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
194 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
195 |
SRCMOD_NONE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
196 |
SRCMOD_NEGATE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
197 |
SRCMOD_BIAS, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
198 |
SRCMOD_BIASNEGATE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
199 |
SRCMOD_SIGN, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
200 |
SRCMOD_SIGNNEGATE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
201 |
SRCMOD_COMPLEMENT, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
202 |
SRCMOD_X2, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
203 |
SRCMOD_X2NEGATE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
204 |
SRCMOD_DZ, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
205 |
SRCMOD_DW, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
206 |
SRCMOD_ABS, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
207 |
SRCMOD_ABSNEGATE, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
208 |
SRCMOD_NOT, |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
209 |
SRCMOD_TOTAL |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
210 |
} SourceMod; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
211 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
212 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
213 |
typedef struct |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
214 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
215 |
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
|
216 |
int regnum; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
217 |
int relative; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
218 |
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
|
219 |
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
|
220 |
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
|
221 |
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
|
222 |
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
|
223 |
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
|
224 |
int result_mod; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
225 |
int result_shift; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
226 |
RegisterType regtype; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
227 |
} DestArgInfo; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
228 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
229 |
typedef struct |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
230 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
231 |
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
|
232 |
int regnum; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
233 |
int swizzle; // xyzw (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
|
234 |
int swizzle_x; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
235 |
int swizzle_y; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
236 |
int swizzle_z; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
237 |
int swizzle_w; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
238 |
SourceMod src_mod; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
239 |
RegisterType regtype; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
240 |
int relative; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
241 |
RegisterType relative_regtype; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
242 |
int relative_regnum; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
243 |
int relative_component; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
244 |
const VariableList *relative_array; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
245 |
} SourceArgInfo; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
246 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
247 |
static inline int scalar_register(const RegisterType regtype, const int regnum) |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
248 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
249 |
switch (regtype) |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
250 |
{ |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
251 |
case REG_TYPE_DEPTHOUT: |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
252 |
case REG_TYPE_CONSTBOOL: |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
253 |
case REG_TYPE_PREDICATE: |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
254 |
case REG_TYPE_LOOP: |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
255 |
return 1; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
256 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
257 |
case REG_TYPE_MISCTYPE: |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
258 |
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
|
259 |
return 1; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
260 |
return 0; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
261 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
262 |
default: break; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
263 |
} // switch |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
264 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
265 |
return 0; |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
266 |
} // scalar_register |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
267 |
|
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
268 |
#endif // _INCLUDE_MOJOSHADER_INTERNAL_H_ |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
269 |
|
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
270 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
271 |
#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
|
272 |
// 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
|
273 |
// of the instruction token. |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
274 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
275 |
// 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
|
276 |
// (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
|
277 |
// 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
|
278 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
279 |
// !!! 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
|
280 |
// !!! 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
|
281 |
|
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
282 |
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
|
283 |
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
|
284 |
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
|
285 |
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
|
286 |
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
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
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
|
291 |
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
|
292 |
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
|
293 |
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
|
294 |
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
|
295 |
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
|
296 |
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
|
297 |
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
|
298 |
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
|
299 |
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
|
300 |
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
|
301 |
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
|
302 |
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
|
303 |
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
|
304 |
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
|
305 |
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
|
306 |
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
|
307 |
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
|
308 |
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
|
309 |
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
|
310 |
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
|
311 |
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
|
312 |
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
|
313 |
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
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
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
|
323 |
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
|
324 |
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
|
325 |
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
|
326 |
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
|
327 |
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
|
328 |
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
|
329 |
INSTRUCTION_STATE(DEFB, "DEFB", 0, DEFB, 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(DEFI, "DEFI", 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
|
331 |
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
|
332 |
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
|
333 |
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
|
334 |
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
|
335 |
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
|
336 |
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
|
337 |
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
|
338 |
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
|
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_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
|
347 |
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
|
348 |
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
|
349 |
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
|
350 |
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
|
351 |
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
|
352 |
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
|
353 |
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
|
354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
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
|
359 |
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
|
360 |
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
|
361 |
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
|
362 |
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
|
363 |
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
|
364 |
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
|
365 |
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
|
366 |
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
|
367 |
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
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
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
|
372 |
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
|
373 |
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
|
374 |
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
|
375 |
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
|
376 |
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
|
377 |
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
|
378 |
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
|
379 |
// !!! FIXME: TEXLDB? |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
380 |
#endif |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
464
diff
changeset
|
381 |
|
464
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
382 |
// end of mojoshader_internal.h ... |
eba4cf79437f
Moved some common stuff to mojoshader_internal.h ...
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
383 |