author | Ryan C. Gordon <icculus@icculus.org> |
Thu, 23 Jul 2020 05:12:09 -0400 | |
changeset 1298 | b70ccc2c7a51 |
parent 1200 | eb1e5280a5a9 |
permissions | -rw-r--r-- |
1199
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
1 |
/** |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
2 |
* MojoShader; generate shader programs from bytecode of compiled |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
3 |
* Direct3D shaders. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
4 |
* |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
5 |
* Please see the file LICENSE.txt in the source's root directory. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
6 |
* |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
7 |
* This file written by Ryan C. Gordon. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
8 |
*/ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
9 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
10 |
#define __MOJOSHADER_INTERNAL__ 1 |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
11 |
#include "mojoshader_profile.h" |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
12 |
|
1200
eb1e5280a5a9
Move the visibility pragmas below the includes.
Ethan Lee <flibitijibibo@flibitijibibo.com>
parents:
1199
diff
changeset
|
13 |
#pragma GCC visibility push(hidden) |
eb1e5280a5a9
Move the visibility pragmas below the includes.
Ethan Lee <flibitijibibo@flibitijibibo.com>
parents:
1199
diff
changeset
|
14 |
|
1199
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
15 |
#if SUPPORT_PROFILE_D3D |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
16 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
17 |
const char *make_D3D_srcarg_string_in_buf(Context *ctx, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
18 |
const SourceArgInfo *arg, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
19 |
char *buf, size_t buflen) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
20 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
21 |
const char *premod_str = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
22 |
const char *postmod_str = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
23 |
switch (arg->src_mod) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
24 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
25 |
case SRCMOD_NEGATE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
26 |
premod_str = "-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
27 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
28 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
29 |
case SRCMOD_BIASNEGATE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
30 |
premod_str = "-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
31 |
// fall through. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
32 |
case SRCMOD_BIAS: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
33 |
postmod_str = "_bias"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
34 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
35 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
36 |
case SRCMOD_SIGNNEGATE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
37 |
premod_str = "-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
38 |
// fall through. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
39 |
case SRCMOD_SIGN: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
40 |
postmod_str = "_bx2"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
41 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
42 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
43 |
case SRCMOD_COMPLEMENT: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
44 |
premod_str = "1-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
45 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
46 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
47 |
case SRCMOD_X2NEGATE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
48 |
premod_str = "-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
49 |
// fall through. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
50 |
case SRCMOD_X2: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
51 |
postmod_str = "_x2"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
52 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
53 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
54 |
case SRCMOD_DZ: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
55 |
postmod_str = "_dz"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
56 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
57 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
58 |
case SRCMOD_DW: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
59 |
postmod_str = "_dw"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
60 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
61 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
62 |
case SRCMOD_ABSNEGATE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
63 |
premod_str = "-"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
64 |
// fall through. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
65 |
case SRCMOD_ABS: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
66 |
postmod_str = "_abs"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
67 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
68 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
69 |
case SRCMOD_NOT: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
70 |
premod_str = "!"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
71 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
72 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
73 |
case SRCMOD_NONE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
74 |
case SRCMOD_TOTAL: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
75 |
break; // stop compiler whining. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
76 |
} // switch |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
77 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
78 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
79 |
char regnum_str[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
80 |
const char *regtype_str = get_D3D_register_string(ctx, arg->regtype, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
81 |
arg->regnum, regnum_str, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
82 |
sizeof (regnum_str)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
83 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
84 |
if (regtype_str == NULL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
85 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
86 |
fail(ctx, "Unknown source register type."); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
87 |
*buf = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
88 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
89 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
90 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
91 |
const char *rel_lbracket = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
92 |
const char *rel_rbracket = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
93 |
char rel_swizzle[4] = { '\0' }; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
94 |
char rel_regnum_str[16] = { '\0' }; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
95 |
const char *rel_regtype_str = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
96 |
if (arg->relative) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
97 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
98 |
if (arg->relative_regtype == REG_TYPE_LOOP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
99 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
100 |
rel_swizzle[0] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
101 |
rel_swizzle[1] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
102 |
rel_swizzle[2] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
103 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
104 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
105 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
106 |
rel_swizzle[0] = '.'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
107 |
rel_swizzle[1] = swizzle_channels[arg->relative_component]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
108 |
rel_swizzle[2] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
109 |
} // else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
110 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
111 |
rel_lbracket = "["; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
112 |
rel_rbracket = "]"; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
113 |
rel_regtype_str = get_D3D_register_string(ctx, arg->relative_regtype, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
114 |
arg->relative_regnum, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
115 |
rel_regnum_str, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
116 |
sizeof (rel_regnum_str)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
117 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
118 |
if (regtype_str == NULL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
119 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
120 |
fail(ctx, "Unknown relative source register type."); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
121 |
*buf = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
122 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
123 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
124 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
125 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
126 |
char swizzle_str[6]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
127 |
size_t i = 0; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
128 |
const int scalar = isscalar(ctx, ctx->shader_type, arg->regtype, arg->regnum); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
129 |
if (!scalar && !no_swizzle(arg->swizzle)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
130 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
131 |
swizzle_str[i++] = '.'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
132 |
swizzle_str[i++] = swizzle_channels[arg->swizzle_x]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
133 |
swizzle_str[i++] = swizzle_channels[arg->swizzle_y]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
134 |
swizzle_str[i++] = swizzle_channels[arg->swizzle_z]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
135 |
swizzle_str[i++] = swizzle_channels[arg->swizzle_w]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
136 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
137 |
// .xyzz is the same as .xyz, .z is the same as .zzzz, etc. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
138 |
while (swizzle_str[i-1] == swizzle_str[i-2]) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
139 |
i--; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
140 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
141 |
swizzle_str[i] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
142 |
assert(i < sizeof (swizzle_str)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
143 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
144 |
// !!! FIXME: c12[a0.x] actually needs to be c[a0.x + 12] |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
145 |
snprintf(buf, buflen, "%s%s%s%s%s%s%s%s%s%s", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
146 |
premod_str, regtype_str, regnum_str, postmod_str, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
147 |
rel_lbracket, rel_regtype_str, rel_regnum_str, rel_swizzle, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
148 |
rel_rbracket, swizzle_str); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
149 |
// !!! FIXME: make sure the scratch buffer was large enough. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
150 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
151 |
} // make_D3D_srcarg_string_in_buf |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
152 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
153 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
154 |
const char *make_D3D_destarg_string(Context *ctx, char *buf, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
155 |
const size_t buflen) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
156 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
157 |
const DestArgInfo *arg = &ctx->dest_arg; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
158 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
159 |
const char *result_shift_str = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
160 |
switch (arg->result_shift) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
161 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
162 |
case 0x1: result_shift_str = "_x2"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
163 |
case 0x2: result_shift_str = "_x4"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
164 |
case 0x3: result_shift_str = "_x8"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
165 |
case 0xD: result_shift_str = "_d8"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
166 |
case 0xE: result_shift_str = "_d4"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
167 |
case 0xF: result_shift_str = "_d2"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
168 |
} // switch |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
169 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
170 |
const char *sat_str = (arg->result_mod & MOD_SATURATE) ? "_sat" : ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
171 |
const char *pp_str = (arg->result_mod & MOD_PP) ? "_pp" : ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
172 |
const char *cent_str = (arg->result_mod & MOD_CENTROID) ? "_centroid" : ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
173 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
174 |
char regnum_str[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
175 |
const char *regtype_str = get_D3D_register_string(ctx, arg->regtype, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
176 |
arg->regnum, regnum_str, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
177 |
sizeof (regnum_str)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
178 |
if (regtype_str == NULL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
179 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
180 |
fail(ctx, "Unknown destination register type."); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
181 |
*buf = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
182 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
183 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
184 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
185 |
char writemask_str[6]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
186 |
size_t i = 0; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
187 |
const int scalar = isscalar(ctx, ctx->shader_type, arg->regtype, arg->regnum); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
188 |
if (!scalar && !writemask_xyzw(arg->writemask)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
189 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
190 |
writemask_str[i++] = '.'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
191 |
if (arg->writemask0) writemask_str[i++] = 'x'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
192 |
if (arg->writemask1) writemask_str[i++] = 'y'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
193 |
if (arg->writemask2) writemask_str[i++] = 'z'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
194 |
if (arg->writemask3) writemask_str[i++] = 'w'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
195 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
196 |
writemask_str[i] = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
197 |
assert(i < sizeof (writemask_str)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
198 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
199 |
const char *pred_left = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
200 |
const char *pred_right = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
201 |
char pred[32] = { '\0' }; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
202 |
if (ctx->predicated) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
203 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
204 |
pred_left = "("; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
205 |
pred_right = ") "; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
206 |
make_D3D_srcarg_string_in_buf(ctx, &ctx->predicate_arg, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
207 |
pred, sizeof (pred)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
208 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
209 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
210 |
// may turn out something like "_x2_sat_pp_centroid (!p0.x) r0.xyzw" ... |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
211 |
snprintf(buf, buflen, "%s%s%s%s %s%s%s%s%s%s", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
212 |
result_shift_str, sat_str, pp_str, cent_str, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
213 |
pred_left, pred, pred_right, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
214 |
regtype_str, regnum_str, writemask_str); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
215 |
// !!! FIXME: make sure the scratch buffer was large enough. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
216 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
217 |
} // make_D3D_destarg_string |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
218 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
219 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
220 |
const char *make_D3D_srcarg_string(Context *ctx, const size_t idx, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
221 |
char *buf, size_t buflen) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
222 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
223 |
if (idx >= STATICARRAYLEN(ctx->source_args)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
224 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
225 |
fail(ctx, "Too many source args"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
226 |
*buf = '\0'; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
227 |
return buf; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
228 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
229 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
230 |
const SourceArgInfo *arg = &ctx->source_args[idx]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
231 |
return make_D3D_srcarg_string_in_buf(ctx, arg, buf, buflen); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
232 |
} // make_D3D_srcarg_string |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
233 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
234 |
const char *get_D3D_const_array_varname(Context *ctx, int base, int size) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
235 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
236 |
char buf[64]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
237 |
snprintf(buf, sizeof (buf), "c_array_%d_%d", base, size); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
238 |
return StrDup(ctx, buf); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
239 |
} // get_D3D_const_array_varname |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
240 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
241 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
242 |
void emit_D3D_start(Context *ctx, const char *profilestr) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
243 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
244 |
const uint major = (uint) ctx->major_ver; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
245 |
const uint minor = (uint) ctx->minor_ver; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
246 |
char minor_str[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
247 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
248 |
ctx->ignores_ctab = 1; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
249 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
250 |
if (minor == 0xFF) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
251 |
strcpy(minor_str, "sw"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
252 |
else if ((major > 1) && (minor == 1)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
253 |
strcpy(minor_str, "x"); // for >= SM2, apparently this is "x". Weird. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
254 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
255 |
snprintf(minor_str, sizeof (minor_str), "%u", (uint) minor); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
256 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
257 |
output_line(ctx, "%s_%u_%s", ctx->shader_type_str, major, minor_str); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
258 |
} // emit_D3D_start |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
259 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
260 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
261 |
void emit_D3D_end(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
262 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
263 |
output_line(ctx, "end"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
264 |
} // emit_D3D_end |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
265 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
266 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
267 |
void emit_D3D_phase(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
268 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
269 |
output_line(ctx, "phase"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
270 |
} // emit_D3D_phase |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
271 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
272 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
273 |
void emit_D3D_finalize(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
274 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
275 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
276 |
} // emit_D3D_finalize |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
277 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
278 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
279 |
void emit_D3D_global(Context *ctx, RegisterType regtype, int regnum) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
280 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
281 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
282 |
} // emit_D3D_global |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
283 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
284 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
285 |
void emit_D3D_array(Context *ctx, VariableList *var) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
286 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
287 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
288 |
} // emit_D3D_array |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
289 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
290 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
291 |
void emit_D3D_const_array(Context *ctx, const ConstantsList *clist, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
292 |
int base, int size) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
293 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
294 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
295 |
} // emit_D3D_const_array |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
296 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
297 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
298 |
void emit_D3D_uniform(Context *ctx, RegisterType regtype, int regnum, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
299 |
const VariableList *var) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
300 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
301 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
302 |
} // emit_D3D_uniform |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
303 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
304 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
305 |
void emit_D3D_sampler(Context *ctx, int s, TextureType ttype, int tb) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
306 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
307 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
308 |
} // emit_D3D_sampler |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
309 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
310 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
311 |
void emit_D3D_attribute(Context *ctx, RegisterType regtype, int regnum, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
312 |
MOJOSHADER_usage usage, int index, int wmask, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
313 |
int flags) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
314 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
315 |
// no-op. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
316 |
} // emit_D3D_attribute |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
317 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
318 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
319 |
void emit_D3D_RESERVED(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
320 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
321 |
// do nothing; fails in the state machine. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
322 |
} // emit_D3D_RESERVED |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
323 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
324 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
325 |
// Generic D3D opcode emitters. A list of macros generate all the entry points |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
326 |
// that call into these... |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
327 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
328 |
char *lowercase(char *dst, const char *src) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
329 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
330 |
int i = 0; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
331 |
do |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
332 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
333 |
const char ch = src[i]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
334 |
dst[i] = (((ch >= 'A') && (ch <= 'Z')) ? (ch - ('A' - 'a')) : ch); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
335 |
} while (src[i++]); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
336 |
return dst; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
337 |
} // lowercase |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
338 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
339 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
340 |
void emit_D3D_opcode_d(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
341 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
342 |
char dst[64]; make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
343 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
344 |
output_line(ctx, "%s%s%s", ctx->coissue ? "+" : "", opcode, dst); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
345 |
} // emit_D3D_opcode_d |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
346 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
347 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
348 |
void emit_D3D_opcode_s(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
349 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
350 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
351 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
352 |
output_line(ctx, "%s%s %s", ctx->coissue ? "+" : "", opcode, src0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
353 |
} // emit_D3D_opcode_s |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
354 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
355 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
356 |
void emit_D3D_opcode_ss(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
357 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
358 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
359 |
char src1[64]; make_D3D_srcarg_string(ctx, 1, src1, sizeof (src1)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
360 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
361 |
output_line(ctx, "%s%s %s, %s", ctx->coissue ? "+" : "", opcode, src0, src1); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
362 |
} // emit_D3D_opcode_ss |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
363 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
364 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
365 |
void emit_D3D_opcode_ds(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
366 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
367 |
char dst[64]; make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
368 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
369 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
370 |
output_line(ctx, "%s%s%s, %s", ctx->coissue ? "+" : "", opcode, dst, src0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
371 |
} // emit_D3D_opcode_ds |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
372 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
373 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
374 |
void emit_D3D_opcode_dss(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
375 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
376 |
char dst[64]; make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
377 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
378 |
char src1[64]; make_D3D_srcarg_string(ctx, 1, src1, sizeof (src1)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
379 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
380 |
output_line(ctx, "%s%s%s, %s, %s", ctx->coissue ? "+" : "", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
381 |
opcode, dst, src0, src1); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
382 |
} // emit_D3D_opcode_dss |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
383 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
384 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
385 |
void emit_D3D_opcode_dsss(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
386 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
387 |
char dst[64]; make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
388 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
389 |
char src1[64]; make_D3D_srcarg_string(ctx, 1, src1, sizeof (src1)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
390 |
char src2[64]; make_D3D_srcarg_string(ctx, 2, src2, sizeof (src2)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
391 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
392 |
output_line(ctx, "%s%s%s, %s, %s, %s", ctx->coissue ? "+" : "", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
393 |
opcode, dst, src0, src1, src2); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
394 |
} // emit_D3D_opcode_dsss |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
395 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
396 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
397 |
void emit_D3D_opcode_dssss(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
398 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
399 |
char dst[64]; make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
400 |
char src0[64]; make_D3D_srcarg_string(ctx, 0, src0, sizeof (src0)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
401 |
char src1[64]; make_D3D_srcarg_string(ctx, 1, src1, sizeof (src1)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
402 |
char src2[64]; make_D3D_srcarg_string(ctx, 2, src2, sizeof (src2)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
403 |
char src3[64]; make_D3D_srcarg_string(ctx, 3, src3, sizeof (src3)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
404 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
405 |
output_line(ctx,"%s%s%s, %s, %s, %s, %s", ctx->coissue ? "+" : "", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
406 |
opcode, dst, src0, src1, src2, src3); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
407 |
} // emit_D3D_opcode_dssss |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
408 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
409 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
410 |
void emit_D3D_opcode(Context *ctx, const char *opcode) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
411 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
412 |
opcode = lowercase((char *) alloca(strlen(opcode) + 1), opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
413 |
output_line(ctx, "%s%s", ctx->coissue ? "+" : "", opcode); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
414 |
} // emit_D3D_opcode |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
415 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
416 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
417 |
#define EMIT_D3D_OPCODE_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
418 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
419 |
emit_D3D_opcode(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
420 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
421 |
#define EMIT_D3D_OPCODE_D_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
422 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
423 |
emit_D3D_opcode_d(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
424 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
425 |
#define EMIT_D3D_OPCODE_S_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
426 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
427 |
emit_D3D_opcode_s(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
428 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
429 |
#define EMIT_D3D_OPCODE_SS_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
430 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
431 |
emit_D3D_opcode_ss(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
432 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
433 |
#define EMIT_D3D_OPCODE_DS_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
434 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
435 |
emit_D3D_opcode_ds(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
436 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
437 |
#define EMIT_D3D_OPCODE_DSS_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
438 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
439 |
emit_D3D_opcode_dss(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
440 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
441 |
#define EMIT_D3D_OPCODE_DSSS_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
442 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
443 |
emit_D3D_opcode_dsss(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
444 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
445 |
#define EMIT_D3D_OPCODE_DSSSS_FUNC(op) \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
446 |
void emit_D3D_##op(Context *ctx) { \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
447 |
emit_D3D_opcode_dssss(ctx, #op); \ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
448 |
} |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
449 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
450 |
EMIT_D3D_OPCODE_FUNC(NOP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
451 |
EMIT_D3D_OPCODE_DS_FUNC(MOV) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
452 |
EMIT_D3D_OPCODE_DSS_FUNC(ADD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
453 |
EMIT_D3D_OPCODE_DSS_FUNC(SUB) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
454 |
EMIT_D3D_OPCODE_DSSS_FUNC(MAD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
455 |
EMIT_D3D_OPCODE_DSS_FUNC(MUL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
456 |
EMIT_D3D_OPCODE_DS_FUNC(RCP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
457 |
EMIT_D3D_OPCODE_DS_FUNC(RSQ) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
458 |
EMIT_D3D_OPCODE_DSS_FUNC(DP3) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
459 |
EMIT_D3D_OPCODE_DSS_FUNC(DP4) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
460 |
EMIT_D3D_OPCODE_DSS_FUNC(MIN) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
461 |
EMIT_D3D_OPCODE_DSS_FUNC(MAX) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
462 |
EMIT_D3D_OPCODE_DSS_FUNC(SLT) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
463 |
EMIT_D3D_OPCODE_DSS_FUNC(SGE) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
464 |
EMIT_D3D_OPCODE_DS_FUNC(EXP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
465 |
EMIT_D3D_OPCODE_DS_FUNC(LOG) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
466 |
EMIT_D3D_OPCODE_DS_FUNC(LIT) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
467 |
EMIT_D3D_OPCODE_DSS_FUNC(DST) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
468 |
EMIT_D3D_OPCODE_DSSS_FUNC(LRP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
469 |
EMIT_D3D_OPCODE_DS_FUNC(FRC) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
470 |
EMIT_D3D_OPCODE_DSS_FUNC(M4X4) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
471 |
EMIT_D3D_OPCODE_DSS_FUNC(M4X3) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
472 |
EMIT_D3D_OPCODE_DSS_FUNC(M3X4) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
473 |
EMIT_D3D_OPCODE_DSS_FUNC(M3X3) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
474 |
EMIT_D3D_OPCODE_DSS_FUNC(M3X2) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
475 |
EMIT_D3D_OPCODE_S_FUNC(CALL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
476 |
EMIT_D3D_OPCODE_SS_FUNC(CALLNZ) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
477 |
EMIT_D3D_OPCODE_SS_FUNC(LOOP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
478 |
EMIT_D3D_OPCODE_FUNC(RET) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
479 |
EMIT_D3D_OPCODE_FUNC(ENDLOOP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
480 |
EMIT_D3D_OPCODE_S_FUNC(LABEL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
481 |
EMIT_D3D_OPCODE_DSS_FUNC(POW) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
482 |
EMIT_D3D_OPCODE_DSS_FUNC(CRS) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
483 |
EMIT_D3D_OPCODE_DSSS_FUNC(SGN) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
484 |
EMIT_D3D_OPCODE_DS_FUNC(ABS) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
485 |
EMIT_D3D_OPCODE_DS_FUNC(NRM) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
486 |
EMIT_D3D_OPCODE_S_FUNC(REP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
487 |
EMIT_D3D_OPCODE_FUNC(ENDREP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
488 |
EMIT_D3D_OPCODE_S_FUNC(IF) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
489 |
EMIT_D3D_OPCODE_FUNC(ELSE) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
490 |
EMIT_D3D_OPCODE_FUNC(ENDIF) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
491 |
EMIT_D3D_OPCODE_FUNC(BREAK) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
492 |
EMIT_D3D_OPCODE_DS_FUNC(MOVA) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
493 |
EMIT_D3D_OPCODE_D_FUNC(TEXKILL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
494 |
EMIT_D3D_OPCODE_DS_FUNC(TEXBEM) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
495 |
EMIT_D3D_OPCODE_DS_FUNC(TEXBEML) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
496 |
EMIT_D3D_OPCODE_DS_FUNC(TEXREG2AR) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
497 |
EMIT_D3D_OPCODE_DS_FUNC(TEXREG2GB) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
498 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X2PAD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
499 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X2TEX) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
500 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X3PAD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
501 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X3TEX) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
502 |
EMIT_D3D_OPCODE_DSS_FUNC(TEXM3X3SPEC) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
503 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X3VSPEC) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
504 |
EMIT_D3D_OPCODE_DS_FUNC(EXPP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
505 |
EMIT_D3D_OPCODE_DS_FUNC(LOGP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
506 |
EMIT_D3D_OPCODE_DSSS_FUNC(CND) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
507 |
EMIT_D3D_OPCODE_DS_FUNC(TEXREG2RGB) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
508 |
EMIT_D3D_OPCODE_DS_FUNC(TEXDP3TEX) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
509 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X2DEPTH) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
510 |
EMIT_D3D_OPCODE_DS_FUNC(TEXDP3) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
511 |
EMIT_D3D_OPCODE_DS_FUNC(TEXM3X3) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
512 |
EMIT_D3D_OPCODE_D_FUNC(TEXDEPTH) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
513 |
EMIT_D3D_OPCODE_DSSS_FUNC(CMP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
514 |
EMIT_D3D_OPCODE_DSS_FUNC(BEM) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
515 |
EMIT_D3D_OPCODE_DSSS_FUNC(DP2ADD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
516 |
EMIT_D3D_OPCODE_DS_FUNC(DSX) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
517 |
EMIT_D3D_OPCODE_DS_FUNC(DSY) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
518 |
EMIT_D3D_OPCODE_DSSSS_FUNC(TEXLDD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
519 |
EMIT_D3D_OPCODE_DSS_FUNC(TEXLDL) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
520 |
EMIT_D3D_OPCODE_S_FUNC(BREAKP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
521 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
522 |
// special cases for comparison opcodes... |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
523 |
const char *get_D3D_comparison_string(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
524 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
525 |
const char *comps[] = { |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
526 |
"", "_gt", "_eq", "_ge", "_lt", "_ne", "_le" |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
527 |
}; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
528 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
529 |
if (ctx->instruction_controls >= STATICARRAYLEN(comps)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
530 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
531 |
fail(ctx, "unknown comparison control"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
532 |
return ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
533 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
534 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
535 |
return comps[ctx->instruction_controls]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
536 |
} // get_D3D_comparison_string |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
537 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
538 |
void emit_D3D_BREAKC(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
539 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
540 |
char op[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
541 |
snprintf(op, sizeof (op), "break%s", get_D3D_comparison_string(ctx)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
542 |
emit_D3D_opcode_ss(ctx, op); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
543 |
} // emit_D3D_BREAKC |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
544 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
545 |
void emit_D3D_IFC(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
546 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
547 |
char op[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
548 |
snprintf(op, sizeof (op), "if%s", get_D3D_comparison_string(ctx)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
549 |
emit_D3D_opcode_ss(ctx, op); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
550 |
} // emit_D3D_IFC |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
551 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
552 |
void emit_D3D_SETP(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
553 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
554 |
char op[16]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
555 |
snprintf(op, sizeof (op), "setp%s", get_D3D_comparison_string(ctx)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
556 |
emit_D3D_opcode_dss(ctx, op); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
557 |
} // emit_D3D_SETP |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
558 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
559 |
void emit_D3D_DEF(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
560 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
561 |
char dst[64]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
562 |
make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
563 |
const float *val = (const float *) ctx->dwords; // !!! FIXME: could be int? |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
564 |
char val0[32]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
565 |
char val1[32]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
566 |
char val2[32]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
567 |
char val3[32]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
568 |
floatstr(ctx, val0, sizeof (val0), val[0], 0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
569 |
floatstr(ctx, val1, sizeof (val1), val[1], 0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
570 |
floatstr(ctx, val2, sizeof (val2), val[2], 0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
571 |
floatstr(ctx, val3, sizeof (val3), val[3], 0); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
572 |
output_line(ctx, "def%s, %s, %s, %s, %s", dst, val0, val1, val2, val3); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
573 |
} // emit_D3D_DEF |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
574 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
575 |
void emit_D3D_DEFI(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
576 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
577 |
char dst[64]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
578 |
make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
579 |
const int32 *x = (const int32 *) ctx->dwords; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
580 |
output_line(ctx, "defi%s, %d, %d, %d, %d", dst, |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
581 |
(int) x[0], (int) x[1], (int) x[2], (int) x[3]); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
582 |
} // emit_D3D_DEFI |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
583 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
584 |
void emit_D3D_DEFB(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
585 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
586 |
char dst[64]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
587 |
make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
588 |
output_line(ctx, "defb%s, %s", dst, ctx->dwords[0] ? "true" : "false"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
589 |
} // emit_D3D_DEFB |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
590 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
591 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
592 |
static const char *usagestrs[] = { |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
593 |
"_position", "_blendweight", "_blendindices", "_normal", "_psize", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
594 |
"_texcoord", "_tangent", "_binormal", "_tessfactor", "_positiont", |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
595 |
"_color", "_fog", "_depth", "_sample" |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
596 |
}; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
597 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
598 |
void emit_D3D_DCL(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
599 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
600 |
char dst[64]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
601 |
make_D3D_destarg_string(ctx, dst, sizeof (dst)); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
602 |
const DestArgInfo *arg = &ctx->dest_arg; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
603 |
const char *usage_str = ""; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
604 |
char index_str[16] = { '\0' }; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
605 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
606 |
if (arg->regtype == REG_TYPE_SAMPLER) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
607 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
608 |
switch ((const TextureType) ctx->dwords[0]) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
609 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
610 |
case TEXTURE_TYPE_2D: usage_str = "_2d"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
611 |
case TEXTURE_TYPE_CUBE: usage_str = "_cube"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
612 |
case TEXTURE_TYPE_VOLUME: usage_str = "_volume"; break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
613 |
default: fail(ctx, "unknown sampler texture type"); return; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
614 |
} // switch |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
615 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
616 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
617 |
else if (arg->regtype == REG_TYPE_MISCTYPE) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
618 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
619 |
switch ((const MiscTypeType) arg->regnum) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
620 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
621 |
case MISCTYPE_TYPE_POSITION: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
622 |
case MISCTYPE_TYPE_FACE: |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
623 |
usage_str = ""; // just become "dcl vFace" or whatever. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
624 |
break; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
625 |
default: fail(ctx, "unknown misc register type"); return; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
626 |
} // switch |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
627 |
} // else if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
628 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
629 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
630 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
631 |
const uint32 usage = ctx->dwords[0]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
632 |
const uint32 index = ctx->dwords[1]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
633 |
usage_str = usagestrs[usage]; |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
634 |
if (index != 0) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
635 |
snprintf(index_str, sizeof (index_str), "%u", (uint) index); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
636 |
} // else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
637 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
638 |
output_line(ctx, "dcl%s%s%s", usage_str, index_str, dst); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
639 |
} // emit_D3D_DCL |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
640 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
641 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
642 |
void emit_D3D_TEXCRD(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
643 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
644 |
// this opcode looks and acts differently depending on the shader model. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
645 |
if (shader_version_atleast(ctx, 1, 4)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
646 |
emit_D3D_opcode_ds(ctx, "texcrd"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
647 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
648 |
emit_D3D_opcode_d(ctx, "texcoord"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
649 |
} // emit_D3D_TEXCOORD |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
650 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
651 |
void emit_D3D_TEXLD(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
652 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
653 |
// this opcode looks and acts differently depending on the shader model. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
654 |
if (shader_version_atleast(ctx, 2, 0)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
655 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
656 |
if (ctx->instruction_controls == CONTROL_TEXLD) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
657 |
emit_D3D_opcode_dss(ctx, "texld"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
658 |
else if (ctx->instruction_controls == CONTROL_TEXLDP) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
659 |
emit_D3D_opcode_dss(ctx, "texldp"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
660 |
else if (ctx->instruction_controls == CONTROL_TEXLDB) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
661 |
emit_D3D_opcode_dss(ctx, "texldb"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
662 |
} // if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
663 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
664 |
else if (shader_version_atleast(ctx, 1, 4)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
665 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
666 |
emit_D3D_opcode_ds(ctx, "texld"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
667 |
} // else if |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
668 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
669 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
670 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
671 |
emit_D3D_opcode_d(ctx, "tex"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
672 |
} // else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
673 |
} // emit_D3D_TEXLD |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
674 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
675 |
void emit_D3D_SINCOS(Context *ctx) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
676 |
{ |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
677 |
// this opcode needs extra registers for sm2 and lower. |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
678 |
if (!shader_version_atleast(ctx, 3, 0)) |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
679 |
emit_D3D_opcode_dsss(ctx, "sincos"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
680 |
else |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
681 |
emit_D3D_opcode_ds(ctx, "sincos"); |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
682 |
} // emit_D3D_SINCOS |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
683 |
|
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
684 |
#endif // SUPPORT_PROFILE_D3D |
b8ece252a201
Reorganize profiles into their own files
Caleb Cornett <caleb.cornett@outlook.com>
parents:
diff
changeset
|
685 |
|
1200
eb1e5280a5a9
Move the visibility pragmas below the includes.
Ethan Lee <flibitijibibo@flibitijibibo.com>
parents:
1199
diff
changeset
|
686 |
#pragma GCC visibility pop |