2 * Direct3D wine internal header: D3D equivalent types
4 * Copyright 2002-2003 Jason Edmeades
5 * Copyright 2002-2003 Raphael Junqueira
6 * Copyright 2005 Oliver Stieber
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef __WINE_WINED3D_TYPES_INTERNAL_H
24 #define __WINE_WINED3D_TYPES_INTERNAL_H
26 /* Depth copy state */
28 WINED3D_DCS_INITIAL
= 0,
30 WINED3D_DCS_NO_COPY
= 2
31 } WINED3D_DEPTHCOPYSTATE
;
33 /** DCL usage masks **/
34 #define WINED3DSP_DCL_USAGE_SHIFT 0
35 #define WINED3DSP_DCL_USAGE_MASK 0x0000000f
36 #define WINED3DSP_DCL_USAGEINDEX_SHIFT 16
37 #define WINED3DSP_DCL_USAGEINDEX_MASK 0x000f0000
39 /** DCL sampler texture type **/
40 #define WINED3DSP_TEXTURETYPE_SHIFT 27
41 #define WINED3DSP_TEXTURETYPE_MASK 0x78000000
43 typedef enum _WINED3DSAMPLER_TEXTURE_TYPE
{
44 WINED3DSTT_UNKNOWN
= 0 << WINED3DSP_TEXTURETYPE_SHIFT
,
45 WINED3DSTT_1D
= 1 << WINED3DSP_TEXTURETYPE_SHIFT
,
46 WINED3DSTT_2D
= 2 << WINED3DSP_TEXTURETYPE_SHIFT
,
47 WINED3DSTT_CUBE
= 3 << WINED3DSP_TEXTURETYPE_SHIFT
,
48 WINED3DSTT_VOLUME
= 4 << WINED3DSP_TEXTURETYPE_SHIFT
,
50 WINED3DSTT_FORCE_DWORD
= 0x7FFFFFFF
51 } WINED3DSAMPLER_TEXTURE_TYPE
;
53 /** Register number mask **/
54 #define WINED3DSP_REGNUM_MASK 0x000007FF
56 /** Register type masks **/
57 #define WINED3DSP_REGTYPE_SHIFT 28
58 #define WINED3DSP_REGTYPE_SHIFT2 8
59 #define WINED3DSP_REGTYPE_MASK (0x7 << WINED3DSP_REGTYPE_SHIFT)
60 #define WINED3DSP_REGTYPE_MASK2 0x00001800
62 /** Register types **/
63 typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE
{
68 WINED3DSPR_TEXTURE
= 3,
69 WINED3DSPR_RASTOUT
= 4,
70 WINED3DSPR_ATTROUT
= 5,
71 WINED3DSPR_TEXCRDOUT
= 6,
72 WINED3DSPR_OUTPUT
= 6,
73 WINED3DSPR_CONSTINT
= 7,
74 WINED3DSPR_COLOROUT
= 8,
75 WINED3DSPR_DEPTHOUT
= 9,
76 WINED3DSPR_SAMPLER
= 10,
77 WINED3DSPR_CONST2
= 11,
78 WINED3DSPR_CONST3
= 12,
79 WINED3DSPR_CONST4
= 13,
80 WINED3DSPR_CONSTBOOL
= 14,
82 WINED3DSPR_TEMPFLOAT16
= 16,
83 WINED3DSPR_MISCTYPE
= 17,
84 WINED3DSPR_LABEL
= 18,
85 WINED3DSPR_PREDICATE
= 19,
87 WINED3DSPR_FORCE_DWORD
= 0x7FFFFFFF
88 } WINED3DSHADER_PARAM_REGISTER_TYPE
;
90 /* RASTOUT register offsets */
91 typedef enum _WINED3DVS_RASTOUT_OFFSETS
{
92 WINED3DSRO_POSITION
= 0,
94 WINED3DSRO_POINT_SIZE
= 2,
96 WINED3DSRO_FORCE_DWORD
= 0x7FFFFFFF
97 } WINED3DVS_RASTOUT_OFFSETS
;
99 /** Source register modifiers **/
100 #define WINED3DVS_SWIZZLE_SHIFT 16
101 #define WINED3DVS_SWIZZLE_MASK (0xFF << WINED3DVS_SWIZZLE_SHIFT)
102 #define WINED3DSP_SWIZZLE_SHIFT 16
103 #define WINED3DSP_SWIZZLE_MASK (0xFF << WINED3DSP_SWIZZLE_SHIFT)
105 #define WINED3DVS_X_X (0 << WINED3DVS_SWIZZLE_SHIFT)
106 #define WINED3DVS_X_Y (1 << WINED3DVS_SWIZZLE_SHIFT)
107 #define WINED3DVS_X_Z (2 << WINED3DVS_SWIZZLE_SHIFT)
108 #define WINED3DVS_X_W (3 << WINED3DVS_SWIZZLE_SHIFT)
110 #define WINED3DVS_Y_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 2))
111 #define WINED3DVS_Y_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 2))
112 #define WINED3DVS_Y_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 2))
113 #define WINED3DVS_Y_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 2))
115 #define WINED3DVS_Z_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 4))
116 #define WINED3DVS_Z_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 4))
117 #define WINED3DVS_Z_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 4))
118 #define WINED3DVS_Z_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 4))
120 #define WINED3DVS_W_X (0 << (WINED3DVS_SWIZZLE_SHIFT + 6))
121 #define WINED3DVS_W_Y (1 << (WINED3DVS_SWIZZLE_SHIFT + 6))
122 #define WINED3DVS_W_Z (2 << (WINED3DVS_SWIZZLE_SHIFT + 6))
123 #define WINED3DVS_W_W (3 << (WINED3DVS_SWIZZLE_SHIFT + 6))
125 #define WINED3DVS_NOSWIZZLE (WINED3DVS_X_X | WINED3DVS_Y_Y | WINED3DVS_Z_Z | WINED3DVS_W_W)
127 #define WINED3DSP_NOSWIZZLE \
128 ((0 << (WINED3DSP_SWIZZLE_SHIFT + 0)) | (1 << (WINED3DSP_SWIZZLE_SHIFT + 2)) | \
129 (2 << (WINED3DSP_SWIZZLE_SHIFT + 4)) | (3 << (WINED3DSP_SWIZZLE_SHIFT + 6)))
131 #define WINED3DSP_SRCMOD_SHIFT 24
132 #define WINED3DSP_SRCMOD_MASK (0xF << WINED3DSP_SRCMOD_SHIFT)
134 typedef enum _WINED3DSHADER_PARAM_SRCMOD_TYPE
{
135 WINED3DSPSM_NONE
= 0 << WINED3DSP_SRCMOD_SHIFT
,
136 WINED3DSPSM_NEG
= 1 << WINED3DSP_SRCMOD_SHIFT
,
137 WINED3DSPSM_BIAS
= 2 << WINED3DSP_SRCMOD_SHIFT
,
138 WINED3DSPSM_BIASNEG
= 3 << WINED3DSP_SRCMOD_SHIFT
,
139 WINED3DSPSM_SIGN
= 4 << WINED3DSP_SRCMOD_SHIFT
,
140 WINED3DSPSM_SIGNNEG
= 5 << WINED3DSP_SRCMOD_SHIFT
,
141 WINED3DSPSM_COMP
= 6 << WINED3DSP_SRCMOD_SHIFT
,
142 WINED3DSPSM_X2
= 7 << WINED3DSP_SRCMOD_SHIFT
,
143 WINED3DSPSM_X2NEG
= 8 << WINED3DSP_SRCMOD_SHIFT
,
144 WINED3DSPSM_DZ
= 9 << WINED3DSP_SRCMOD_SHIFT
,
145 WINED3DSPSM_DW
= 10 << WINED3DSP_SRCMOD_SHIFT
,
146 WINED3DSPSM_ABS
= 11 << WINED3DSP_SRCMOD_SHIFT
,
147 WINED3DSPSM_ABSNEG
= 12 << WINED3DSP_SRCMOD_SHIFT
,
148 WINED3DSPSM_NOT
= 13 << WINED3DSP_SRCMOD_SHIFT
,
150 WINED3DSPSM_FORCE_DWORD
= 0x7FFFFFFF
151 } WINED3DSHADER_PARAM_SRCMOD_TYPE
;
153 /** Destination register modifiers **/
154 #define WINED3DSP_WRITEMASK_0 0x00010000 /* .x r */
155 #define WINED3DSP_WRITEMASK_1 0x00020000 /* .y g */
156 #define WINED3DSP_WRITEMASK_2 0x00040000 /* .z b */
157 #define WINED3DSP_WRITEMASK_3 0x00080000 /* .w a */
158 #define WINED3DSP_WRITEMASK_ALL 0x000F0000 /* all */
160 #define WINED3DSP_DSTMOD_SHIFT 20
161 #define WINED3DSP_DSTMOD_MASK (0xF << WINED3DSP_DSTMOD_SHIFT)
163 typedef enum _WINED3DSHADER_PARAM_DSTMOD_TYPE
{
164 WINED3DSPDM_NONE
= 0 << WINED3DSP_DSTMOD_SHIFT
,
165 WINED3DSPDM_SATURATE
= 1 << WINED3DSP_DSTMOD_SHIFT
,
166 WINED3DSPDM_PARTIALPRECISION
= 2 << WINED3DSP_DSTMOD_SHIFT
,
167 WINED3DSPDM_MSAMPCENTROID
= 4 << WINED3DSP_DSTMOD_SHIFT
,
169 WINED3DSPDM_FORCE_DWORD
= 0x7FFFFFFF
170 } WINED3DSHADER_PARAM_DSTMOD_TYPE
;
172 #define WINED3DSP_DSTSHIFT_SHIFT 24
173 #define WINED3DSP_DSTSHIFT_MASK (0xF << WINED3DSP_DSTSHIFT_SHIFT)
175 /** Register addressing modes **/
176 #define WINED3DSHADER_ADDRESSMODE_SHIFT 13
177 #define WINED3DSHADER_ADDRESSMODE_MASK (1 << WINED3DSHADER_ADDRESSMODE_SHIFT)
179 typedef enum _WINED3DSHADER_ADDRESSMODE_TYPE
{
180 WINED3DSHADER_ADDRMODE_ABSOLUTE
= 0 << WINED3DSHADER_ADDRESSMODE_SHIFT
,
181 WINED3DSHADER_ADDRMODE_RELATIVE
= 1 << WINED3DSHADER_ADDRESSMODE_SHIFT
,
183 WINED3DSHADER_ADDRMODE_FORCE_DWORD
= 0x7FFFFFFF
184 } WINED3DSHADER_ADDRESSMODE_TYPE
;
187 typedef enum _WINED3DSHADER_INSTRUCTION_OPCODE_TYPE
{
208 WINED3DSIO_M4x4
= 20,
209 WINED3DSIO_M4x3
= 21,
210 WINED3DSIO_M3x4
= 22,
211 WINED3DSIO_M3x3
= 23,
212 WINED3DSIO_M3x2
= 24,
213 WINED3DSIO_CALL
= 25,
214 WINED3DSIO_CALLNZ
= 26,
215 WINED3DSIO_LOOP
= 27,
217 WINED3DSIO_ENDLOOP
= 29,
218 WINED3DSIO_LABEL
= 30,
225 WINED3DSIO_SINCOS
= 37,
227 WINED3DSIO_ENDREP
= 39,
230 WINED3DSIO_ELSE
= 42,
231 WINED3DSIO_ENDIF
= 43,
232 WINED3DSIO_BREAK
= 44,
233 WINED3DSIO_BREAKC
= 45,
234 WINED3DSIO_MOVA
= 46,
235 WINED3DSIO_DEFB
= 47,
236 WINED3DSIO_DEFI
= 48,
238 WINED3DSIO_TEXCOORD
= 64,
239 WINED3DSIO_TEXKILL
= 65,
241 WINED3DSIO_TEXBEM
= 67,
242 WINED3DSIO_TEXBEML
= 68,
243 WINED3DSIO_TEXREG2AR
= 69,
244 WINED3DSIO_TEXREG2GB
= 70,
245 WINED3DSIO_TEXM3x2PAD
= 71,
246 WINED3DSIO_TEXM3x2TEX
= 72,
247 WINED3DSIO_TEXM3x3PAD
= 73,
248 WINED3DSIO_TEXM3x3TEX
= 74,
249 WINED3DSIO_TEXM3x3DIFF
= 75,
250 WINED3DSIO_TEXM3x3SPEC
= 76,
251 WINED3DSIO_TEXM3x3VSPEC
= 77,
252 WINED3DSIO_EXPP
= 78,
253 WINED3DSIO_LOGP
= 79,
256 WINED3DSIO_TEXREG2RGB
= 82,
257 WINED3DSIO_TEXDP3TEX
= 83,
258 WINED3DSIO_TEXM3x2DEPTH
= 84,
259 WINED3DSIO_TEXDP3
= 85,
260 WINED3DSIO_TEXM3x3
= 86,
261 WINED3DSIO_TEXDEPTH
= 87,
264 WINED3DSIO_DP2ADD
= 90,
267 WINED3DSIO_TEXLDD
= 93,
268 WINED3DSIO_SETP
= 94,
269 WINED3DSIO_TEXLDL
= 95,
270 WINED3DSIO_BREAKP
= 96,
272 WINED3DSIO_PHASE
= 0xFFFD,
273 WINED3DSIO_COMMENT
= 0xFFFE,
274 WINED3DSIO_END
= 0XFFFF,
276 WINED3DSIO_FORCE_DWORD
= 0X7FFFFFFF /** for 32-bit alignment */
277 } WINED3DSHADER_INSTRUCTION_OPCODE_TYPE
;
279 /** opcode-related masks **/
281 #define WINED3DSI_OPCODE_MASK 0x0000FFFF
282 #define WINED3DSI_INSTLENGTH_MASK 0x0F000000
283 #define WINED3DSI_INSTLENGTH_SHIFT 24
285 #define WINED3DSI_COISSUE 0x40000000
287 #define WINED3DSI_COMMENTSIZE_SHIFT 16
288 #define WINED3DSI_COMMENTSIZE_MASK (0x7FFF << WINED3DSI_COMMENTSIZE_SHIFT)
289 #define WINED3DSHADER_COMMENT(commentSize) \
290 ((((commentSize) << WINED3DSI_COMMENTSIZE_SHIFT) & WINED3DSI_COMMENTSIZE_MASK) | WINED3DSIO_COMMENT)
292 #define WINED3DSHADER_INSTRUCTION_PREDICATED (1 << 28)
294 /* Undocumented opcode control to identify projective texture lookups in ps 2.0 and later */
295 #define WINED3DSI_TEXLD_PROJECT 0x00010000
297 /** Shader version tokens, and shader end tokens **/
299 #define WINED3DPS_VERSION(major, minor) (0xFFFF0000 | ((major) << 8) | (minor))
300 #define WINED3DVS_VERSION(major, minor) (0xFFFE0000 | ((major) << 8) | (minor))
301 #define WINED3DSHADER_VERSION_MAJOR(version) (((version) >> 8) & 0xFF)
302 #define WINED3DSHADER_VERSION_MINOR(version) (((version) >> 0) & 0xFF)
303 #define WINED3DPS_END() 0x0000FFFF
304 #define WINED3DVS_END() 0x0000FFFF
306 /* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */
307 #define WINED3DCREATE_MULTITHREADED 0x00000004