1 /*==========================================================================; 2 * 3 * Copyright (C) Microsoft Corporation. All Rights Reserved. 4 * 5 * File: d3d9types.h 6 * Content: Direct3D capabilities include file 7 * 8 ***************************************************************************/ 9 10 #ifndef _d3d9TYPES_H_ 11 #define _d3d9TYPES_H_ 12 13 14 #ifndef DIRECT3D_VERSION 15 #define DIRECT3D_VERSION 0x0900 16 #endif //DIRECT3D_VERSION 17 18 // include this file content only if compiling for DX9 interfaces 19 #if(DIRECT3D_VERSION >= 0x0900) 20 21 #include <float.h> 22 23 #ifdef _MSC_VER 24 #if _MSC_VER >= 1200 25 #pragma warning(push) 26 #endif 27 #pragma warning(disable:4201) // anonymous unions warning 28 #if defined(_X86_) || defined(_IA64_) 29 #pragma pack(4) 30 #endif 31 #endif // _MSC_VER 32 33 // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8 34 #ifndef D3DCOLOR_DEFINED 35 typedef DWORD D3DCOLOR; 36 #define D3DCOLOR_DEFINED 37 #endif 38 39 // maps unsigned 8 bits/channel to D3DCOLOR 40 #define D3DCOLOR_ARGB(a,r,g,b) \ 41 ((D3DCOLOR)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff))) 42 #define D3DCOLOR_RGBA(r,g,b,a) D3DCOLOR_ARGB(a,r,g,b) 43 #define D3DCOLOR_XRGB(r,g,b) D3DCOLOR_ARGB(0xff,r,g,b) 44 45 #define D3DCOLOR_XYUV(y,u,v) D3DCOLOR_ARGB(0xff,y,u,v) 46 #define D3DCOLOR_AYUV(a,y,u,v) D3DCOLOR_ARGB(a,y,u,v) 47 48 // maps floating point channels (0.f to 1.f range) to D3DCOLOR 49 #define D3DCOLOR_COLORVALUE(r,g,b,a) \ 50 D3DCOLOR_RGBA((DWORD)((r)*255.f),(DWORD)((g)*255.f),(DWORD)((b)*255.f),(DWORD)((a)*255.f)) 51 52 53 #ifndef D3DVECTOR_DEFINED 54 typedef struct _D3DVECTOR { 55 float x; 56 float y; 57 float z; 58 } D3DVECTOR; 59 #define D3DVECTOR_DEFINED 60 #endif 61 62 #ifndef D3DCOLORVALUE_DEFINED 63 typedef struct _D3DCOLORVALUE { 64 float r; 65 float g; 66 float b; 67 float a; 68 } D3DCOLORVALUE; 69 #define D3DCOLORVALUE_DEFINED 70 #endif 71 72 #ifndef D3DRECT_DEFINED 73 typedef struct _D3DRECT { 74 LONG x1; 75 LONG y1; 76 LONG x2; 77 LONG y2; 78 } D3DRECT; 79 #define D3DRECT_DEFINED 80 #endif 81 82 83 84 #ifndef D3DMATRIX_DEFINED 85 typedef struct _D3DMATRIX { 86 union { 87 struct { 88 float _11, _12, _13, _14; 89 float _21, _22, _23, _24; 90 float _31, _32, _33, _34; 91 float _41, _42, _43, _44; 92 93 }; 94 float m[4][4]; 95 }; 96 } D3DMATRIX; 97 #define D3DMATRIX_DEFINED 98 #endif 99 100 101 102 typedef struct _D3DVIEWPORT9 { 103 DWORD X; 104 DWORD Y; /* Viewport Top left */ 105 DWORD Width; 106 DWORD Height; /* Viewport Dimensions */ 107 float MinZ; /* Min/max of clip Volume */ 108 float MaxZ; 109 } D3DVIEWPORT9; 110 111 /* 112 * Values for clip fields. 113 */ 114 115 // Max number of user clipping planes, supported in D3D. 116 #define D3DMAXUSERCLIPPLANES 32 117 118 // These bits could be ORed together to use with D3DRS_CLIPPLANEENABLE 119 // 120 #define D3DCLIPPLANE0 (1 << 0) 121 #define D3DCLIPPLANE1 (1 << 1) 122 #define D3DCLIPPLANE2 (1 << 2) 123 #define D3DCLIPPLANE3 (1 << 3) 124 #define D3DCLIPPLANE4 (1 << 4) 125 #define D3DCLIPPLANE5 (1 << 5) 126 127 // The following bits are used in the ClipUnion and ClipIntersection 128 // members of the D3DCLIPSTATUS9 129 // 130 131 #define D3DCS_LEFT 0x00000001L 132 #define D3DCS_RIGHT 0x00000002L 133 #define D3DCS_TOP 0x00000004L 134 #define D3DCS_BOTTOM 0x00000008L 135 #define D3DCS_FRONT 0x00000010L 136 #define D3DCS_BACK 0x00000020L 137 #define D3DCS_PLANE0 0x00000040L 138 #define D3DCS_PLANE1 0x00000080L 139 #define D3DCS_PLANE2 0x00000100L 140 #define D3DCS_PLANE3 0x00000200L 141 #define D3DCS_PLANE4 0x00000400L 142 #define D3DCS_PLANE5 0x00000800L 143 144 #define D3DCS_ALL (D3DCS_LEFT | \ 145 D3DCS_RIGHT | \ 146 D3DCS_TOP | \ 147 D3DCS_BOTTOM | \ 148 D3DCS_FRONT | \ 149 D3DCS_BACK | \ 150 D3DCS_PLANE0 | \ 151 D3DCS_PLANE1 | \ 152 D3DCS_PLANE2 | \ 153 D3DCS_PLANE3 | \ 154 D3DCS_PLANE4 | \ 155 D3DCS_PLANE5) 156 157 typedef struct _D3DCLIPSTATUS9 { 158 DWORD ClipUnion; 159 DWORD ClipIntersection; 160 } D3DCLIPSTATUS9; 161 162 typedef struct _D3DMATERIAL9 { 163 D3DCOLORVALUE Diffuse; /* Diffuse color RGBA */ 164 D3DCOLORVALUE Ambient; /* Ambient color RGB */ 165 D3DCOLORVALUE Specular; /* Specular 'shininess' */ 166 D3DCOLORVALUE Emissive; /* Emissive color RGB */ 167 float Power; /* Sharpness if specular highlight */ 168 } D3DMATERIAL9; 169 170 typedef enum _D3DLIGHTTYPE { 171 D3DLIGHT_POINT = 1, 172 D3DLIGHT_SPOT = 2, 173 D3DLIGHT_DIRECTIONAL = 3, 174 D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 175 } D3DLIGHTTYPE; 176 177 typedef struct _D3DLIGHT9 { 178 D3DLIGHTTYPE Type; /* Type of light source */ 179 D3DCOLORVALUE Diffuse; /* Diffuse color of light */ 180 D3DCOLORVALUE Specular; /* Specular color of light */ 181 D3DCOLORVALUE Ambient; /* Ambient color of light */ 182 D3DVECTOR Position; /* Position in world space */ 183 D3DVECTOR Direction; /* Direction in world space */ 184 float Range; /* Cutoff range */ 185 float Falloff; /* Falloff */ 186 float Attenuation0; /* Constant attenuation */ 187 float Attenuation1; /* Linear attenuation */ 188 float Attenuation2; /* Quadratic attenuation */ 189 float Theta; /* Inner angle of spotlight cone */ 190 float Phi; /* Outer angle of spotlight cone */ 191 } D3DLIGHT9; 192 193 /* 194 * Options for clearing 195 */ 196 #define D3DCLEAR_TARGET 0x00000001l /* Clear target surface */ 197 #define D3DCLEAR_ZBUFFER 0x00000002l /* Clear target z buffer */ 198 #define D3DCLEAR_STENCIL 0x00000004l /* Clear stencil planes */ 199 200 /* 201 * The following defines the rendering states 202 */ 203 204 typedef enum _D3DSHADEMODE { 205 D3DSHADE_FLAT = 1, 206 D3DSHADE_GOURAUD = 2, 207 D3DSHADE_PHONG = 3, 208 D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 209 } D3DSHADEMODE; 210 211 typedef enum _D3DFILLMODE { 212 D3DFILL_POINT = 1, 213 D3DFILL_WIREFRAME = 2, 214 D3DFILL_SOLID = 3, 215 D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 216 } D3DFILLMODE; 217 218 typedef enum _D3DBLEND { 219 D3DBLEND_ZERO = 1, 220 D3DBLEND_ONE = 2, 221 D3DBLEND_SRCCOLOR = 3, 222 D3DBLEND_INVSRCCOLOR = 4, 223 D3DBLEND_SRCALPHA = 5, 224 D3DBLEND_INVSRCALPHA = 6, 225 D3DBLEND_DESTALPHA = 7, 226 D3DBLEND_INVDESTALPHA = 8, 227 D3DBLEND_DESTCOLOR = 9, 228 D3DBLEND_INVDESTCOLOR = 10, 229 D3DBLEND_SRCALPHASAT = 11, 230 D3DBLEND_BOTHSRCALPHA = 12, 231 D3DBLEND_BOTHINVSRCALPHA = 13, 232 D3DBLEND_BLENDFACTOR = 14, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ 233 D3DBLEND_INVBLENDFACTOR = 15, /* Only supported if D3DPBLENDCAPS_BLENDFACTOR is on */ 234 /* D3D9Ex only -- */ 235 #if !defined(D3D_DISABLE_9EX) 236 237 D3DBLEND_SRCCOLOR2 = 16, 238 D3DBLEND_INVSRCCOLOR2 = 17, 239 240 #endif // !D3D_DISABLE_9EX 241 /* -- D3D9Ex only */ 242 D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 243 } D3DBLEND; 244 245 typedef enum _D3DBLENDOP { 246 D3DBLENDOP_ADD = 1, 247 D3DBLENDOP_SUBTRACT = 2, 248 D3DBLENDOP_REVSUBTRACT = 3, 249 D3DBLENDOP_MIN = 4, 250 D3DBLENDOP_MAX = 5, 251 D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 252 } D3DBLENDOP; 253 254 typedef enum _D3DTEXTUREADDRESS { 255 D3DTADDRESS_WRAP = 1, 256 D3DTADDRESS_MIRROR = 2, 257 D3DTADDRESS_CLAMP = 3, 258 D3DTADDRESS_BORDER = 4, 259 D3DTADDRESS_MIRRORONCE = 5, 260 D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 261 } D3DTEXTUREADDRESS; 262 263 typedef enum _D3DCULL { 264 D3DCULL_NONE = 1, 265 D3DCULL_CW = 2, 266 D3DCULL_CCW = 3, 267 D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 268 } D3DCULL; 269 270 typedef enum _D3DCMPFUNC { 271 D3DCMP_NEVER = 1, 272 D3DCMP_LESS = 2, 273 D3DCMP_EQUAL = 3, 274 D3DCMP_LESSEQUAL = 4, 275 D3DCMP_GREATER = 5, 276 D3DCMP_NOTEQUAL = 6, 277 D3DCMP_GREATEREQUAL = 7, 278 D3DCMP_ALWAYS = 8, 279 D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 280 } D3DCMPFUNC; 281 282 typedef enum _D3DSTENCILOP { 283 D3DSTENCILOP_KEEP = 1, 284 D3DSTENCILOP_ZERO = 2, 285 D3DSTENCILOP_REPLACE = 3, 286 D3DSTENCILOP_INCRSAT = 4, 287 D3DSTENCILOP_DECRSAT = 5, 288 D3DSTENCILOP_INVERT = 6, 289 D3DSTENCILOP_INCR = 7, 290 D3DSTENCILOP_DECR = 8, 291 D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 292 } D3DSTENCILOP; 293 294 typedef enum _D3DFOGMODE { 295 D3DFOG_NONE = 0, 296 D3DFOG_EXP = 1, 297 D3DFOG_EXP2 = 2, 298 D3DFOG_LINEAR = 3, 299 D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 300 } D3DFOGMODE; 301 302 typedef enum _D3DZBUFFERTYPE { 303 D3DZB_FALSE = 0, 304 D3DZB_TRUE = 1, // Z buffering 305 D3DZB_USEW = 2, // W buffering 306 D3DZB_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 307 } D3DZBUFFERTYPE; 308 309 // Primitives supported by draw-primitive API 310 typedef enum _D3DPRIMITIVETYPE { 311 D3DPT_POINTLIST = 1, 312 D3DPT_LINELIST = 2, 313 D3DPT_LINESTRIP = 3, 314 D3DPT_TRIANGLELIST = 4, 315 D3DPT_TRIANGLESTRIP = 5, 316 D3DPT_TRIANGLEFAN = 6, 317 D3DPT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 318 } D3DPRIMITIVETYPE; 319 320 typedef enum _D3DTRANSFORMSTATETYPE { 321 D3DTS_VIEW = 2, 322 D3DTS_PROJECTION = 3, 323 D3DTS_TEXTURE0 = 16, 324 D3DTS_TEXTURE1 = 17, 325 D3DTS_TEXTURE2 = 18, 326 D3DTS_TEXTURE3 = 19, 327 D3DTS_TEXTURE4 = 20, 328 D3DTS_TEXTURE5 = 21, 329 D3DTS_TEXTURE6 = 22, 330 D3DTS_TEXTURE7 = 23, 331 D3DTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 332 } D3DTRANSFORMSTATETYPE; 333 334 #define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256) 335 #define D3DTS_WORLD D3DTS_WORLDMATRIX(0) 336 #define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1) 337 #define D3DTS_WORLD2 D3DTS_WORLDMATRIX(2) 338 #define D3DTS_WORLD3 D3DTS_WORLDMATRIX(3) 339 340 typedef enum _D3DRENDERSTATETYPE { 341 D3DRS_ZENABLE = 7, /* D3DZBUFFERTYPE (or TRUE/FALSE for legacy) */ 342 D3DRS_FILLMODE = 8, /* D3DFILLMODE */ 343 D3DRS_SHADEMODE = 9, /* D3DSHADEMODE */ 344 D3DRS_ZWRITEENABLE = 14, /* TRUE to enable z writes */ 345 D3DRS_ALPHATESTENABLE = 15, /* TRUE to enable alpha tests */ 346 D3DRS_LASTPIXEL = 16, /* TRUE for last-pixel on lines */ 347 D3DRS_SRCBLEND = 19, /* D3DBLEND */ 348 D3DRS_DESTBLEND = 20, /* D3DBLEND */ 349 D3DRS_CULLMODE = 22, /* D3DCULL */ 350 D3DRS_ZFUNC = 23, /* D3DCMPFUNC */ 351 D3DRS_ALPHAREF = 24, /* D3DFIXED */ 352 D3DRS_ALPHAFUNC = 25, /* D3DCMPFUNC */ 353 D3DRS_DITHERENABLE = 26, /* TRUE to enable dithering */ 354 D3DRS_ALPHABLENDENABLE = 27, /* TRUE to enable alpha blending */ 355 D3DRS_FOGENABLE = 28, /* TRUE to enable fog blending */ 356 D3DRS_SPECULARENABLE = 29, /* TRUE to enable specular */ 357 D3DRS_FOGCOLOR = 34, /* D3DCOLOR */ 358 D3DRS_FOGTABLEMODE = 35, /* D3DFOGMODE */ 359 D3DRS_FOGSTART = 36, /* Fog start (for both vertex and pixel fog) */ 360 D3DRS_FOGEND = 37, /* Fog end */ 361 D3DRS_FOGDENSITY = 38, /* Fog density */ 362 D3DRS_RANGEFOGENABLE = 48, /* Enables range-based fog */ 363 D3DRS_STENCILENABLE = 52, /* BOOL enable/disable stenciling */ 364 D3DRS_STENCILFAIL = 53, /* D3DSTENCILOP to do if stencil test fails */ 365 D3DRS_STENCILZFAIL = 54, /* D3DSTENCILOP to do if stencil test passes and Z test fails */ 366 D3DRS_STENCILPASS = 55, /* D3DSTENCILOP to do if both stencil and Z tests pass */ 367 D3DRS_STENCILFUNC = 56, /* D3DCMPFUNC fn. Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ 368 D3DRS_STENCILREF = 57, /* Reference value used in stencil test */ 369 D3DRS_STENCILMASK = 58, /* Mask value used in stencil test */ 370 D3DRS_STENCILWRITEMASK = 59, /* Write mask applied to values written to stencil buffer */ 371 D3DRS_TEXTUREFACTOR = 60, /* D3DCOLOR used for multi-texture blend */ 372 D3DRS_WRAP0 = 128, /* wrap for 1st texture coord. set */ 373 D3DRS_WRAP1 = 129, /* wrap for 2nd texture coord. set */ 374 D3DRS_WRAP2 = 130, /* wrap for 3rd texture coord. set */ 375 D3DRS_WRAP3 = 131, /* wrap for 4th texture coord. set */ 376 D3DRS_WRAP4 = 132, /* wrap for 5th texture coord. set */ 377 D3DRS_WRAP5 = 133, /* wrap for 6th texture coord. set */ 378 D3DRS_WRAP6 = 134, /* wrap for 7th texture coord. set */ 379 D3DRS_WRAP7 = 135, /* wrap for 8th texture coord. set */ 380 D3DRS_CLIPPING = 136, 381 D3DRS_LIGHTING = 137, 382 D3DRS_AMBIENT = 139, 383 D3DRS_FOGVERTEXMODE = 140, 384 D3DRS_COLORVERTEX = 141, 385 D3DRS_LOCALVIEWER = 142, 386 D3DRS_NORMALIZENORMALS = 143, 387 D3DRS_DIFFUSEMATERIALSOURCE = 145, 388 D3DRS_SPECULARMATERIALSOURCE = 146, 389 D3DRS_AMBIENTMATERIALSOURCE = 147, 390 D3DRS_EMISSIVEMATERIALSOURCE = 148, 391 D3DRS_VERTEXBLEND = 151, 392 D3DRS_CLIPPLANEENABLE = 152, 393 D3DRS_POINTSIZE = 154, /* float point size */ 394 D3DRS_POINTSIZE_MIN = 155, /* float point size min threshold */ 395 D3DRS_POINTSPRITEENABLE = 156, /* BOOL point texture coord control */ 396 D3DRS_POINTSCALEENABLE = 157, /* BOOL point size scale enable */ 397 D3DRS_POINTSCALE_A = 158, /* float point attenuation A value */ 398 D3DRS_POINTSCALE_B = 159, /* float point attenuation B value */ 399 D3DRS_POINTSCALE_C = 160, /* float point attenuation C value */ 400 D3DRS_MULTISAMPLEANTIALIAS = 161, // BOOL - set to do FSAA with multisample buffer 401 D3DRS_MULTISAMPLEMASK = 162, // DWORD - per-sample enable/disable 402 D3DRS_PATCHEDGESTYLE = 163, // Sets whether patch edges will use float style tessellation 403 D3DRS_DEBUGMONITORTOKEN = 165, // DEBUG ONLY - token to debug monitor 404 D3DRS_POINTSIZE_MAX = 166, /* float point size max threshold */ 405 D3DRS_INDEXEDVERTEXBLENDENABLE = 167, 406 D3DRS_COLORWRITEENABLE = 168, // per-channel write enable 407 D3DRS_TWEENFACTOR = 170, // float tween factor 408 D3DRS_BLENDOP = 171, // D3DBLENDOP setting 409 D3DRS_POSITIONDEGREE = 172, // NPatch position interpolation degree. D3DDEGREE_LINEAR or D3DDEGREE_CUBIC (default) 410 D3DRS_NORMALDEGREE = 173, // NPatch normal interpolation degree. D3DDEGREE_LINEAR (default) or D3DDEGREE_QUADRATIC 411 D3DRS_SCISSORTESTENABLE = 174, 412 D3DRS_SLOPESCALEDEPTHBIAS = 175, 413 D3DRS_ANTIALIASEDLINEENABLE = 176, 414 D3DRS_MINTESSELLATIONLEVEL = 178, 415 D3DRS_MAXTESSELLATIONLEVEL = 179, 416 D3DRS_ADAPTIVETESS_X = 180, 417 D3DRS_ADAPTIVETESS_Y = 181, 418 D3DRS_ADAPTIVETESS_Z = 182, 419 D3DRS_ADAPTIVETESS_W = 183, 420 D3DRS_ENABLEADAPTIVETESSELLATION = 184, 421 D3DRS_TWOSIDEDSTENCILMODE = 185, /* BOOL enable/disable 2 sided stenciling */ 422 D3DRS_CCW_STENCILFAIL = 186, /* D3DSTENCILOP to do if ccw stencil test fails */ 423 D3DRS_CCW_STENCILZFAIL = 187, /* D3DSTENCILOP to do if ccw stencil test passes and Z test fails */ 424 D3DRS_CCW_STENCILPASS = 188, /* D3DSTENCILOP to do if both ccw stencil and Z tests pass */ 425 D3DRS_CCW_STENCILFUNC = 189, /* D3DCMPFUNC fn. ccw Stencil Test passes if ((ref & mask) stencilfn (stencil & mask)) is true */ 426 D3DRS_COLORWRITEENABLE1 = 190, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ 427 D3DRS_COLORWRITEENABLE2 = 191, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ 428 D3DRS_COLORWRITEENABLE3 = 192, /* Additional ColorWriteEnables for the devices that support D3DPMISCCAPS_INDEPENDENTWRITEMASKS */ 429 D3DRS_BLENDFACTOR = 193, /* D3DCOLOR used for a constant blend factor during alpha blending for devices that support D3DPBLENDCAPS_BLENDFACTOR */ 430 D3DRS_SRGBWRITEENABLE = 194, /* Enable rendertarget writes to be DE-linearized to SRGB (for formats that expose D3DUSAGE_QUERY_SRGBWRITE) */ 431 D3DRS_DEPTHBIAS = 195, 432 D3DRS_WRAP8 = 198, /* Additional wrap states for vs_3_0+ attributes with D3DDECLUSAGE_TEXCOORD */ 433 D3DRS_WRAP9 = 199, 434 D3DRS_WRAP10 = 200, 435 D3DRS_WRAP11 = 201, 436 D3DRS_WRAP12 = 202, 437 D3DRS_WRAP13 = 203, 438 D3DRS_WRAP14 = 204, 439 D3DRS_WRAP15 = 205, 440 D3DRS_SEPARATEALPHABLENDENABLE = 206, /* TRUE to enable a separate blending function for the alpha channel */ 441 D3DRS_SRCBLENDALPHA = 207, /* SRC blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ 442 D3DRS_DESTBLENDALPHA = 208, /* DST blend factor for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ 443 D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ 444 445 446 D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 447 } D3DRENDERSTATETYPE; 448 449 // Maximum number of simultaneous render targets D3D supports 450 #define D3D_MAX_SIMULTANEOUS_RENDERTARGETS 4 451 452 // Values for material source 453 typedef enum _D3DMATERIALCOLORSOURCE 454 { 455 D3DMCS_MATERIAL = 0, // Color from material is used 456 D3DMCS_COLOR1 = 1, // Diffuse vertex color is used 457 D3DMCS_COLOR2 = 2, // Specular vertex color is used 458 D3DMCS_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 459 } D3DMATERIALCOLORSOURCE; 460 461 // Bias to apply to the texture coordinate set to apply a wrap to. 462 #define D3DRENDERSTATE_WRAPBIAS 128UL 463 464 /* Flags to construct the WRAP render states */ 465 #define D3DWRAP_U 0x00000001L 466 #define D3DWRAP_V 0x00000002L 467 #define D3DWRAP_W 0x00000004L 468 469 /* Flags to construct the WRAP render states for 1D thru 4D texture coordinates */ 470 #define D3DWRAPCOORD_0 0x00000001L // same as D3DWRAP_U 471 #define D3DWRAPCOORD_1 0x00000002L // same as D3DWRAP_V 472 #define D3DWRAPCOORD_2 0x00000004L // same as D3DWRAP_W 473 #define D3DWRAPCOORD_3 0x00000008L 474 475 /* Flags to construct D3DRS_COLORWRITEENABLE */ 476 #define D3DCOLORWRITEENABLE_RED (1L<<0) 477 #define D3DCOLORWRITEENABLE_GREEN (1L<<1) 478 #define D3DCOLORWRITEENABLE_BLUE (1L<<2) 479 #define D3DCOLORWRITEENABLE_ALPHA (1L<<3) 480 481 /* 482 * State enumerants for per-stage processing of fixed function pixel processing 483 * Two of these affect fixed function vertex processing as well: TEXTURETRANSFORMFLAGS and TEXCOORDINDEX. 484 */ 485 typedef enum _D3DTEXTURESTAGESTATETYPE 486 { 487 D3DTSS_COLOROP = 1, /* D3DTEXTUREOP - per-stage blending controls for color channels */ 488 D3DTSS_COLORARG1 = 2, /* D3DTA_* (texture arg) */ 489 D3DTSS_COLORARG2 = 3, /* D3DTA_* (texture arg) */ 490 D3DTSS_ALPHAOP = 4, /* D3DTEXTUREOP - per-stage blending controls for alpha channel */ 491 D3DTSS_ALPHAARG1 = 5, /* D3DTA_* (texture arg) */ 492 D3DTSS_ALPHAARG2 = 6, /* D3DTA_* (texture arg) */ 493 D3DTSS_BUMPENVMAT00 = 7, /* float (bump mapping matrix) */ 494 D3DTSS_BUMPENVMAT01 = 8, /* float (bump mapping matrix) */ 495 D3DTSS_BUMPENVMAT10 = 9, /* float (bump mapping matrix) */ 496 D3DTSS_BUMPENVMAT11 = 10, /* float (bump mapping matrix) */ 497 D3DTSS_TEXCOORDINDEX = 11, /* identifies which set of texture coordinates index this texture */ 498 D3DTSS_BUMPENVLSCALE = 22, /* float scale for bump map luminance */ 499 D3DTSS_BUMPENVLOFFSET = 23, /* float offset for bump map luminance */ 500 D3DTSS_TEXTURETRANSFORMFLAGS = 24, /* D3DTEXTURETRANSFORMFLAGS controls texture transform */ 501 D3DTSS_COLORARG0 = 26, /* D3DTA_* third arg for triadic ops */ 502 D3DTSS_ALPHAARG0 = 27, /* D3DTA_* third arg for triadic ops */ 503 D3DTSS_RESULTARG = 28, /* D3DTA_* arg for result (CURRENT or TEMP) */ 504 D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ 505 506 507 D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 508 } D3DTEXTURESTAGESTATETYPE; 509 510 /* 511 * State enumerants for per-sampler texture processing. 512 */ 513 typedef enum _D3DSAMPLERSTATETYPE 514 { 515 D3DSAMP_ADDRESSU = 1, /* D3DTEXTUREADDRESS for U coordinate */ 516 D3DSAMP_ADDRESSV = 2, /* D3DTEXTUREADDRESS for V coordinate */ 517 D3DSAMP_ADDRESSW = 3, /* D3DTEXTUREADDRESS for W coordinate */ 518 D3DSAMP_BORDERCOLOR = 4, /* D3DCOLOR */ 519 D3DSAMP_MAGFILTER = 5, /* D3DTEXTUREFILTER filter to use for magnification */ 520 D3DSAMP_MINFILTER = 6, /* D3DTEXTUREFILTER filter to use for minification */ 521 D3DSAMP_MIPFILTER = 7, /* D3DTEXTUREFILTER filter to use between mipmaps during minification */ 522 D3DSAMP_MIPMAPLODBIAS = 8, /* float Mipmap LOD bias */ 523 D3DSAMP_MAXMIPLEVEL = 9, /* DWORD 0..(n-1) LOD index of largest map to use (0 == largest) */ 524 D3DSAMP_MAXANISOTROPY = 10, /* DWORD maximum anisotropy */ 525 D3DSAMP_SRGBTEXTURE = 11, /* Default = 0 (which means Gamma 1.0, 526 no correction required.) else correct for 527 Gamma = 2.2 */ 528 D3DSAMP_ELEMENTINDEX = 12, /* When multi-element texture is assigned to sampler, this 529 indicates which element index to use. Default = 0. */ 530 D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. 531 Only valid for D3DDMAPSAMPLER sampler */ 532 D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 533 } D3DSAMPLERSTATETYPE; 534 535 /* Special sampler which is used in the tesselator */ 536 #define D3DDMAPSAMPLER 256 537 538 // Samplers used in vertex shaders 539 #define D3DVERTEXTEXTURESAMPLER0 (D3DDMAPSAMPLER+1) 540 #define D3DVERTEXTEXTURESAMPLER1 (D3DDMAPSAMPLER+2) 541 #define D3DVERTEXTEXTURESAMPLER2 (D3DDMAPSAMPLER+3) 542 #define D3DVERTEXTEXTURESAMPLER3 (D3DDMAPSAMPLER+4) 543 544 // Values, used with D3DTSS_TEXCOORDINDEX, to specify that the vertex data(position 545 // and normal in the camera space) should be taken as texture coordinates 546 // Low 16 bits are used to specify texture coordinate index, to take the WRAP mode from 547 // 548 #define D3DTSS_TCI_PASSTHRU 0x00000000 549 #define D3DTSS_TCI_CAMERASPACENORMAL 0x00010000 550 #define D3DTSS_TCI_CAMERASPACEPOSITION 0x00020000 551 #define D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x00030000 552 #define D3DTSS_TCI_SPHEREMAP 0x00040000 553 554 /* 555 * Enumerations for COLOROP and ALPHAOP texture blending operations set in 556 * texture processing stage controls in D3DTSS. 557 */ 558 typedef enum _D3DTEXTUREOP 559 { 560 // Control 561 D3DTOP_DISABLE = 1, // disables stage 562 D3DTOP_SELECTARG1 = 2, // the default 563 D3DTOP_SELECTARG2 = 3, 564 565 // Modulate 566 D3DTOP_MODULATE = 4, // multiply args together 567 D3DTOP_MODULATE2X = 5, // multiply and 1 bit 568 D3DTOP_MODULATE4X = 6, // multiply and 2 bits 569 570 // Add 571 D3DTOP_ADD = 7, // add arguments together 572 D3DTOP_ADDSIGNED = 8, // add with -0.5 bias 573 D3DTOP_ADDSIGNED2X = 9, // as above but left 1 bit 574 D3DTOP_SUBTRACT = 10, // Arg1 - Arg2, with no saturation 575 D3DTOP_ADDSMOOTH = 11, // add 2 args, subtract product 576 // Arg1 + Arg2 - Arg1*Arg2 577 // = Arg1 + (1-Arg1)*Arg2 578 579 // Linear alpha blend: Arg1*(Alpha) + Arg2*(1-Alpha) 580 D3DTOP_BLENDDIFFUSEALPHA = 12, // iterated alpha 581 D3DTOP_BLENDTEXTUREALPHA = 13, // texture alpha 582 D3DTOP_BLENDFACTORALPHA = 14, // alpha from D3DRS_TEXTUREFACTOR 583 584 // Linear alpha blend with pre-multiplied arg1 input: Arg1 + Arg2*(1-Alpha) 585 D3DTOP_BLENDTEXTUREALPHAPM = 15, // texture alpha 586 D3DTOP_BLENDCURRENTALPHA = 16, // by alpha of current color 587 588 // Specular mapping 589 D3DTOP_PREMODULATE = 17, // modulate with next texture before use 590 D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB 591 // COLOROP only 592 D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A 593 // COLOROP only 594 D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB 595 // COLOROP only 596 D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A 597 // COLOROP only 598 599 // Bump mapping 600 D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation 601 D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel 602 603 // This can do either diffuse or specular bump mapping with correct input. 604 // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) 605 // where each component has been scaled and offset to make it signed. 606 // The result is replicated into all four (including alpha) channels. 607 // This is a valid COLOROP only. 608 D3DTOP_DOTPRODUCT3 = 24, 609 610 // Triadic ops 611 D3DTOP_MULTIPLYADD = 25, // Arg0 + Arg1*Arg2 612 D3DTOP_LERP = 26, // (Arg0)*Arg1 + (1-Arg0)*Arg2 613 614 D3DTOP_FORCE_DWORD = 0x7fffffff, 615 } D3DTEXTUREOP; 616 617 /* 618 * Values for COLORARG0,1,2, ALPHAARG0,1,2, and RESULTARG texture blending 619 * operations set in texture processing stage controls in D3DRENDERSTATE. 620 */ 621 #define D3DTA_SELECTMASK 0x0000000f // mask for arg selector 622 #define D3DTA_DIFFUSE 0x00000000 // select diffuse color (read only) 623 #define D3DTA_CURRENT 0x00000001 // select stage destination register (read/write) 624 #define D3DTA_TEXTURE 0x00000002 // select texture color (read only) 625 #define D3DTA_TFACTOR 0x00000003 // select D3DRS_TEXTUREFACTOR (read only) 626 #define D3DTA_SPECULAR 0x00000004 // select specular color (read only) 627 #define D3DTA_TEMP 0x00000005 // select temporary register color (read/write) 628 #define D3DTA_CONSTANT 0x00000006 // select texture stage constant 629 #define D3DTA_COMPLEMENT 0x00000010 // take 1.0 - x (read modifier) 630 #define D3DTA_ALPHAREPLICATE 0x00000020 // replicate alpha to color components (read modifier) 631 632 // 633 // Values for D3DSAMP_***FILTER texture stage states 634 // 635 typedef enum _D3DTEXTUREFILTERTYPE 636 { 637 D3DTEXF_NONE = 0, // filtering disabled (valid for mip filter only) 638 D3DTEXF_POINT = 1, // nearest 639 D3DTEXF_LINEAR = 2, // linear interpolation 640 D3DTEXF_ANISOTROPIC = 3, // anisotropic 641 D3DTEXF_PYRAMIDALQUAD = 6, // 4-sample tent 642 D3DTEXF_GAUSSIANQUAD = 7, // 4-sample gaussian 643 /* D3D9Ex only -- */ 644 #if !defined(D3D_DISABLE_9EX) 645 646 D3DTEXF_CONVOLUTIONMONO = 8, // Convolution filter for monochrome textures 647 648 #endif // !D3D_DISABLE_9EX 649 /* -- D3D9Ex only */ 650 D3DTEXF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 651 } D3DTEXTUREFILTERTYPE; 652 653 /* Bits for Flags in ProcessVertices call */ 654 655 #define D3DPV_DONOTCOPYDATA (1 << 0) 656 657 //------------------------------------------------------------------- 658 659 // Flexible vertex format bits 660 // 661 #define D3DFVF_RESERVED0 0x001 662 #define D3DFVF_POSITION_MASK 0x400E 663 #define D3DFVF_XYZ 0x002 664 #define D3DFVF_XYZRHW 0x004 665 #define D3DFVF_XYZB1 0x006 666 #define D3DFVF_XYZB2 0x008 667 #define D3DFVF_XYZB3 0x00a 668 #define D3DFVF_XYZB4 0x00c 669 #define D3DFVF_XYZB5 0x00e 670 #define D3DFVF_XYZW 0x4002 671 672 #define D3DFVF_NORMAL 0x010 673 #define D3DFVF_PSIZE 0x020 674 #define D3DFVF_DIFFUSE 0x040 675 #define D3DFVF_SPECULAR 0x080 676 677 #define D3DFVF_TEXCOUNT_MASK 0xf00 678 #define D3DFVF_TEXCOUNT_SHIFT 8 679 #define D3DFVF_TEX0 0x000 680 #define D3DFVF_TEX1 0x100 681 #define D3DFVF_TEX2 0x200 682 #define D3DFVF_TEX3 0x300 683 #define D3DFVF_TEX4 0x400 684 #define D3DFVF_TEX5 0x500 685 #define D3DFVF_TEX6 0x600 686 #define D3DFVF_TEX7 0x700 687 #define D3DFVF_TEX8 0x800 688 689 #define D3DFVF_LASTBETA_UBYTE4 0x1000 690 #define D3DFVF_LASTBETA_D3DCOLOR 0x8000 691 692 #define D3DFVF_RESERVED2 0x6000 // 2 reserved bits 693 694 //--------------------------------------------------------------------- 695 // Vertex Shaders 696 // 697 698 // Vertex shader declaration 699 700 // Vertex element semantics 701 // 702 typedef enum _D3DDECLUSAGE 703 { 704 D3DDECLUSAGE_POSITION = 0, 705 D3DDECLUSAGE_BLENDWEIGHT, // 1 706 D3DDECLUSAGE_BLENDINDICES, // 2 707 D3DDECLUSAGE_NORMAL, // 3 708 D3DDECLUSAGE_PSIZE, // 4 709 D3DDECLUSAGE_TEXCOORD, // 5 710 D3DDECLUSAGE_TANGENT, // 6 711 D3DDECLUSAGE_BINORMAL, // 7 712 D3DDECLUSAGE_TESSFACTOR, // 8 713 D3DDECLUSAGE_POSITIONT, // 9 714 D3DDECLUSAGE_COLOR, // 10 715 D3DDECLUSAGE_FOG, // 11 716 D3DDECLUSAGE_DEPTH, // 12 717 D3DDECLUSAGE_SAMPLE, // 13 718 } D3DDECLUSAGE; 719 720 #define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE 721 #define MAXD3DDECLUSAGEINDEX 15 722 #define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element 723 724 typedef enum _D3DDECLMETHOD 725 { 726 D3DDECLMETHOD_DEFAULT = 0, 727 D3DDECLMETHOD_PARTIALU, 728 D3DDECLMETHOD_PARTIALV, 729 D3DDECLMETHOD_CROSSUV, // Normal 730 D3DDECLMETHOD_UV, 731 D3DDECLMETHOD_LOOKUP, // Lookup a displacement map 732 D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map 733 } D3DDECLMETHOD; 734 735 #define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED 736 737 // Declarations for _Type fields 738 // 739 typedef enum _D3DDECLTYPE 740 { 741 D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.) 742 D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.) 743 D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.) 744 D3DDECLTYPE_FLOAT4 = 3, // 4D float 745 D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range 746 // Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A) 747 D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte 748 D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.) 749 D3DDECLTYPE_SHORT4 = 7, // 4D signed short 750 751 // The following types are valid only with vertex shaders >= 2.0 752 753 754 D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0 755 D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1) 756 D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0) 757 D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1) 758 D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0) 759 D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1) 760 D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1) 761 D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1) 762 D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values 763 D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused. 764 } D3DDECLTYPE; 765 766 #define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED 767 768 typedef struct _D3DVERTEXELEMENT9 769 { 770 WORD Stream; // Stream index 771 WORD Offset; // Offset in the stream in bytes 772 BYTE Type; // Data type 773 BYTE Method; // Processing method 774 BYTE Usage; // Semantics 775 BYTE UsageIndex; // Semantic index 776 } D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9; 777 778 // This is used to initialize the last vertex element in a vertex declaration 779 // array 780 // 781 #define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0} 782 783 // Maximum supported number of texture coordinate sets 784 #define D3DDP_MAXTEXCOORD 8 785 786 //--------------------------------------------------------------------- 787 // Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter 788 //--------------------------------------------------------------------- 789 #define D3DSTREAMSOURCE_INDEXEDDATA (1<<30) 790 #define D3DSTREAMSOURCE_INSTANCEDATA (2<<30) 791 792 793 794 //--------------------------------------------------------------------- 795 // 796 // The internal format of Pixel Shader (PS) & Vertex Shader (VS) 797 // Instruction Tokens is defined in the Direct3D Device Driver Kit 798 // 799 //--------------------------------------------------------------------- 800 801 // 802 // Instruction Token Bit Definitions 803 // 804 #define D3DSI_OPCODE_MASK 0x0000FFFF 805 806 #define D3DSI_INSTLENGTH_MASK 0x0F000000 807 #define D3DSI_INSTLENGTH_SHIFT 24 808 809 typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE 810 { 811 D3DSIO_NOP = 0, 812 D3DSIO_MOV , 813 D3DSIO_ADD , 814 D3DSIO_SUB , 815 D3DSIO_MAD , 816 D3DSIO_MUL , 817 D3DSIO_RCP , 818 D3DSIO_RSQ , 819 D3DSIO_DP3 , 820 D3DSIO_DP4 , 821 D3DSIO_MIN , 822 D3DSIO_MAX , 823 D3DSIO_SLT , 824 D3DSIO_SGE , 825 D3DSIO_EXP , 826 D3DSIO_LOG , 827 D3DSIO_LIT , 828 D3DSIO_DST , 829 D3DSIO_LRP , 830 D3DSIO_FRC , 831 D3DSIO_M4x4 , 832 D3DSIO_M4x3 , 833 D3DSIO_M3x4 , 834 D3DSIO_M3x3 , 835 D3DSIO_M3x2 , 836 D3DSIO_CALL , 837 D3DSIO_CALLNZ , 838 D3DSIO_LOOP , 839 D3DSIO_RET , 840 D3DSIO_ENDLOOP , 841 D3DSIO_LABEL , 842 D3DSIO_DCL , 843 D3DSIO_POW , 844 D3DSIO_CRS , 845 D3DSIO_SGN , 846 D3DSIO_ABS , 847 D3DSIO_NRM , 848 D3DSIO_SINCOS , 849 D3DSIO_REP , 850 D3DSIO_ENDREP , 851 D3DSIO_IF , 852 D3DSIO_IFC , 853 D3DSIO_ELSE , 854 D3DSIO_ENDIF , 855 D3DSIO_BREAK , 856 D3DSIO_BREAKC , 857 D3DSIO_MOVA , 858 D3DSIO_DEFB , 859 D3DSIO_DEFI , 860 861 D3DSIO_TEXCOORD = 64, 862 D3DSIO_TEXKILL , 863 D3DSIO_TEX , 864 D3DSIO_TEXBEM , 865 D3DSIO_TEXBEML , 866 D3DSIO_TEXREG2AR , 867 D3DSIO_TEXREG2GB , 868 D3DSIO_TEXM3x2PAD , 869 D3DSIO_TEXM3x2TEX , 870 D3DSIO_TEXM3x3PAD , 871 D3DSIO_TEXM3x3TEX , 872 D3DSIO_RESERVED0 , 873 D3DSIO_TEXM3x3SPEC , 874 D3DSIO_TEXM3x3VSPEC , 875 D3DSIO_EXPP , 876 D3DSIO_LOGP , 877 D3DSIO_CND , 878 D3DSIO_DEF , 879 D3DSIO_TEXREG2RGB , 880 D3DSIO_TEXDP3TEX , 881 D3DSIO_TEXM3x2DEPTH , 882 D3DSIO_TEXDP3 , 883 D3DSIO_TEXM3x3 , 884 D3DSIO_TEXDEPTH , 885 D3DSIO_CMP , 886 D3DSIO_BEM , 887 D3DSIO_DP2ADD , 888 D3DSIO_DSX , 889 D3DSIO_DSY , 890 D3DSIO_TEXLDD , 891 D3DSIO_SETP , 892 D3DSIO_TEXLDL , 893 D3DSIO_BREAKP , 894 895 D3DSIO_PHASE = 0xFFFD, 896 D3DSIO_COMMENT = 0xFFFE, 897 D3DSIO_END = 0xFFFF, 898 899 D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 900 } D3DSHADER_INSTRUCTION_OPCODE_TYPE; 901 902 //--------------------------------------------------------------------- 903 // Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 904 // 905 #define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f 906 #define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f 907 908 //--------------------------------------------------------------------- 909 // Co-Issue Instruction Modifier - if set then this instruction is to be 910 // issued in parallel with the previous instruction(s) for which this bit 911 // is not set. 912 // 913 #define D3DSI_COISSUE 0x40000000 914 915 //--------------------------------------------------------------------- 916 // Opcode specific controls 917 918 #define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 919 #define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 920 921 // ps_2_0 texld controls 922 #define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) 923 #define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT) 924 925 // Comparison for dynamic conditional instruction opcodes (i.e. if, breakc) 926 typedef enum _D3DSHADER_COMPARISON 927 { 928 // < = > 929 D3DSPC_RESERVED0= 0, // 0 0 0 930 D3DSPC_GT = 1, // 0 0 1 931 D3DSPC_EQ = 2, // 0 1 0 932 D3DSPC_GE = 3, // 0 1 1 933 D3DSPC_LT = 4, // 1 0 0 934 D3DSPC_NE = 5, // 1 0 1 935 D3DSPC_LE = 6, // 1 1 0 936 D3DSPC_RESERVED1= 7 // 1 1 1 937 } D3DSHADER_COMPARISON; 938 939 // Comparison is part of instruction opcode token: 940 #define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT 941 #define D3DSHADER_COMPARISON_MASK (0x7<<D3DSHADER_COMPARISON_SHIFT) 942 943 //--------------------------------------------------------------------- 944 // Predication flags on instruction token 945 #define D3DSHADER_INSTRUCTION_PREDICATED (0x1 << 28) 946 947 //--------------------------------------------------------------------- 948 // DCL Info Token Controls 949 950 // For dcl info tokens requiring a semantic (usage + index) 951 #define D3DSP_DCL_USAGE_SHIFT 0 952 #define D3DSP_DCL_USAGE_MASK 0x0000000f 953 954 #define D3DSP_DCL_USAGEINDEX_SHIFT 16 955 #define D3DSP_DCL_USAGEINDEX_MASK 0x000f0000 956 957 // DCL pixel shader sampler info token. 958 #define D3DSP_TEXTURETYPE_SHIFT 27 959 #define D3DSP_TEXTURETYPE_MASK 0x78000000 960 961 typedef enum _D3DSAMPLER_TEXTURE_TYPE 962 { 963 D3DSTT_UNKNOWN = 0<<D3DSP_TEXTURETYPE_SHIFT, // uninitialized value 964 D3DSTT_2D = 2<<D3DSP_TEXTURETYPE_SHIFT, // dcl_2d s# (for declaring a 2-D texture) 965 D3DSTT_CUBE = 3<<D3DSP_TEXTURETYPE_SHIFT, // dcl_cube s# (for declaring a cube texture) 966 D3DSTT_VOLUME = 4<<D3DSP_TEXTURETYPE_SHIFT, // dcl_volume s# (for declaring a volume texture) 967 D3DSTT_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 968 } D3DSAMPLER_TEXTURE_TYPE; 969 970 //--------------------------------------------------------------------- 971 // Parameter Token Bit Definitions 972 // 973 #define D3DSP_REGNUM_MASK 0x000007FF 974 975 // destination parameter write mask 976 #define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red) 977 #define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green) 978 #define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue) 979 #define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha) 980 #define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components 981 982 // destination parameter modifiers 983 #define D3DSP_DSTMOD_SHIFT 20 984 #define D3DSP_DSTMOD_MASK 0x00F00000 985 986 // Bit masks for destination parameter modifiers 987 #define D3DSPDM_NONE (0<<D3DSP_DSTMOD_SHIFT) // nop 988 #define D3DSPDM_SATURATE (1<<D3DSP_DSTMOD_SHIFT) // clamp to 0. to 1. range 989 #define D3DSPDM_PARTIALPRECISION (2<<D3DSP_DSTMOD_SHIFT) // Partial precision hint 990 #define D3DSPDM_MSAMPCENTROID (4<<D3DSP_DSTMOD_SHIFT) // Relevant to multisampling only: 991 // When the pixel center is not covered, sample 992 // attribute or compute gradients/LOD 993 // using multisample "centroid" location. 994 // "Centroid" is some location within the covered 995 // region of the pixel. 996 997 // destination parameter 998 #define D3DSP_DSTSHIFT_SHIFT 24 999 #define D3DSP_DSTSHIFT_MASK 0x0F000000 1000 1001 // destination/source parameter register type 1002 #define D3DSP_REGTYPE_SHIFT 28 1003 #define D3DSP_REGTYPE_SHIFT2 8 1004 #define D3DSP_REGTYPE_MASK 0x70000000 1005 #define D3DSP_REGTYPE_MASK2 0x00001800 1006 1007 typedef enum _D3DSHADER_PARAM_REGISTER_TYPE 1008 { 1009 D3DSPR_TEMP = 0, // Temporary Register File 1010 D3DSPR_INPUT = 1, // Input Register File 1011 D3DSPR_CONST = 2, // Constant Register File 1012 D3DSPR_ADDR = 3, // Address Register (VS) 1013 D3DSPR_TEXTURE = 3, // Texture Register File (PS) 1014 D3DSPR_RASTOUT = 4, // Rasterizer Register File 1015 D3DSPR_ATTROUT = 5, // Attribute Output Register File 1016 D3DSPR_TEXCRDOUT = 6, // Texture Coordinate Output Register File 1017 D3DSPR_OUTPUT = 6, // Output register file for VS3.0+ 1018 D3DSPR_CONSTINT = 7, // Constant Integer Vector Register File 1019 D3DSPR_COLOROUT = 8, // Color Output Register File 1020 D3DSPR_DEPTHOUT = 9, // Depth Output Register File 1021 D3DSPR_SAMPLER = 10, // Sampler State Register File 1022 D3DSPR_CONST2 = 11, // Constant Register File 2048 - 4095 1023 D3DSPR_CONST3 = 12, // Constant Register File 4096 - 6143 1024 D3DSPR_CONST4 = 13, // Constant Register File 6144 - 8191 1025 D3DSPR_CONSTBOOL = 14, // Constant Boolean register file 1026 D3DSPR_LOOP = 15, // Loop counter register file 1027 D3DSPR_TEMPFLOAT16 = 16, // 16-bit float temp register file 1028 D3DSPR_MISCTYPE = 17, // Miscellaneous (single) registers. 1029 D3DSPR_LABEL = 18, // Label 1030 D3DSPR_PREDICATE = 19, // Predicate register 1031 D3DSPR_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1032 } D3DSHADER_PARAM_REGISTER_TYPE; 1033 1034 // The miscellaneous register file (D3DSPR_MISCTYPES) 1035 // contains register types for which there is only ever one 1036 // register (i.e. the register # is not needed). 1037 // Rather than use up additional register types for such 1038 // registers, they are defined 1039 // as particular offsets into the misc. register file: 1040 typedef enum _D3DSHADER_MISCTYPE_OFFSETS 1041 { 1042 D3DSMO_POSITION = 0, // Input position x,y,z,rhw (PS) 1043 D3DSMO_FACE = 1, // Floating point primitive area (PS) 1044 } D3DSHADER_MISCTYPE_OFFSETS; 1045 1046 // Register offsets in the Rasterizer Register File 1047 // 1048 typedef enum _D3DVS_RASTOUT_OFFSETS 1049 { 1050 D3DSRO_POSITION = 0, 1051 D3DSRO_FOG, 1052 D3DSRO_POINT_SIZE, 1053 D3DSRO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1054 } D3DVS_RASTOUT_OFFSETS; 1055 1056 // Source operand addressing modes 1057 1058 #define D3DVS_ADDRESSMODE_SHIFT 13 1059 #define D3DVS_ADDRESSMODE_MASK (1 << D3DVS_ADDRESSMODE_SHIFT) 1060 1061 typedef enum _D3DVS_ADDRESSMODE_TYPE 1062 { 1063 D3DVS_ADDRMODE_ABSOLUTE = (0 << D3DVS_ADDRESSMODE_SHIFT), 1064 D3DVS_ADDRMODE_RELATIVE = (1 << D3DVS_ADDRESSMODE_SHIFT), 1065 D3DVS_ADDRMODE_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1066 } D3DVS_ADDRESSMODE_TYPE; 1067 1068 #define D3DSHADER_ADDRESSMODE_SHIFT 13 1069 #define D3DSHADER_ADDRESSMODE_MASK (1 << D3DSHADER_ADDRESSMODE_SHIFT) 1070 1071 typedef enum _D3DSHADER_ADDRESSMODE_TYPE 1072 { 1073 D3DSHADER_ADDRMODE_ABSOLUTE = (0 << D3DSHADER_ADDRESSMODE_SHIFT), 1074 D3DSHADER_ADDRMODE_RELATIVE = (1 << D3DSHADER_ADDRESSMODE_SHIFT), 1075 D3DSHADER_ADDRMODE_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1076 } D3DSHADER_ADDRESSMODE_TYPE; 1077 1078 // Source operand swizzle definitions 1079 // 1080 #define D3DVS_SWIZZLE_SHIFT 16 1081 #define D3DVS_SWIZZLE_MASK 0x00FF0000 1082 1083 // The following bits define where to take component X from: 1084 1085 #define D3DVS_X_X (0 << D3DVS_SWIZZLE_SHIFT) 1086 #define D3DVS_X_Y (1 << D3DVS_SWIZZLE_SHIFT) 1087 #define D3DVS_X_Z (2 << D3DVS_SWIZZLE_SHIFT) 1088 #define D3DVS_X_W (3 << D3DVS_SWIZZLE_SHIFT) 1089 1090 // The following bits define where to take component Y from: 1091 1092 #define D3DVS_Y_X (0 << (D3DVS_SWIZZLE_SHIFT + 2)) 1093 #define D3DVS_Y_Y (1 << (D3DVS_SWIZZLE_SHIFT + 2)) 1094 #define D3DVS_Y_Z (2 << (D3DVS_SWIZZLE_SHIFT + 2)) 1095 #define D3DVS_Y_W (3 << (D3DVS_SWIZZLE_SHIFT + 2)) 1096 1097 // The following bits define where to take component Z from: 1098 1099 #define D3DVS_Z_X (0 << (D3DVS_SWIZZLE_SHIFT + 4)) 1100 #define D3DVS_Z_Y (1 << (D3DVS_SWIZZLE_SHIFT + 4)) 1101 #define D3DVS_Z_Z (2 << (D3DVS_SWIZZLE_SHIFT + 4)) 1102 #define D3DVS_Z_W (3 << (D3DVS_SWIZZLE_SHIFT + 4)) 1103 1104 // The following bits define where to take component W from: 1105 1106 #define D3DVS_W_X (0 << (D3DVS_SWIZZLE_SHIFT + 6)) 1107 #define D3DVS_W_Y (1 << (D3DVS_SWIZZLE_SHIFT + 6)) 1108 #define D3DVS_W_Z (2 << (D3DVS_SWIZZLE_SHIFT + 6)) 1109 #define D3DVS_W_W (3 << (D3DVS_SWIZZLE_SHIFT + 6)) 1110 1111 // Value when there is no swizzle (X is taken from X, Y is taken from Y, 1112 // Z is taken from Z, W is taken from W 1113 // 1114 #define D3DVS_NOSWIZZLE (D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W) 1115 1116 // source parameter swizzle 1117 #define D3DSP_SWIZZLE_SHIFT 16 1118 #define D3DSP_SWIZZLE_MASK 0x00FF0000 1119 1120 #define D3DSP_NOSWIZZLE \ 1121 ( (0 << (D3DSP_SWIZZLE_SHIFT + 0)) | \ 1122 (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | \ 1123 (2 << (D3DSP_SWIZZLE_SHIFT + 4)) | \ 1124 (3 << (D3DSP_SWIZZLE_SHIFT + 6)) ) 1125 1126 // pixel-shader swizzle ops 1127 #define D3DSP_REPLICATERED \ 1128 ( (0 << (D3DSP_SWIZZLE_SHIFT + 0)) | \ 1129 (0 << (D3DSP_SWIZZLE_SHIFT + 2)) | \ 1130 (0 << (D3DSP_SWIZZLE_SHIFT + 4)) | \ 1131 (0 << (D3DSP_SWIZZLE_SHIFT + 6)) ) 1132 1133 #define D3DSP_REPLICATEGREEN \ 1134 ( (1 << (D3DSP_SWIZZLE_SHIFT + 0)) | \ 1135 (1 << (D3DSP_SWIZZLE_SHIFT + 2)) | \ 1136 (1 << (D3DSP_SWIZZLE_SHIFT + 4)) | \ 1137 (1 << (D3DSP_SWIZZLE_SHIFT + 6)) ) 1138 1139 #define D3DSP_REPLICATEBLUE \ 1140 ( (2 << (D3DSP_SWIZZLE_SHIFT + 0)) | \ 1141 (2 << (D3DSP_SWIZZLE_SHIFT + 2)) | \ 1142 (2 << (D3DSP_SWIZZLE_SHIFT + 4)) | \ 1143 (2 << (D3DSP_SWIZZLE_SHIFT + 6)) ) 1144 1145 #define D3DSP_REPLICATEALPHA \ 1146 ( (3 << (D3DSP_SWIZZLE_SHIFT + 0)) | \ 1147 (3 << (D3DSP_SWIZZLE_SHIFT + 2)) | \ 1148 (3 << (D3DSP_SWIZZLE_SHIFT + 4)) | \ 1149 (3 << (D3DSP_SWIZZLE_SHIFT + 6)) ) 1150 1151 // source parameter modifiers 1152 #define D3DSP_SRCMOD_SHIFT 24 1153 #define D3DSP_SRCMOD_MASK 0x0F000000 1154 1155 typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE 1156 { 1157 D3DSPSM_NONE = 0<<D3DSP_SRCMOD_SHIFT, // nop 1158 D3DSPSM_NEG = 1<<D3DSP_SRCMOD_SHIFT, // negate 1159 D3DSPSM_BIAS = 2<<D3DSP_SRCMOD_SHIFT, // bias 1160 D3DSPSM_BIASNEG = 3<<D3DSP_SRCMOD_SHIFT, // bias and negate 1161 D3DSPSM_SIGN = 4<<D3DSP_SRCMOD_SHIFT, // sign 1162 D3DSPSM_SIGNNEG = 5<<D3DSP_SRCMOD_SHIFT, // sign and negate 1163 D3DSPSM_COMP = 6<<D3DSP_SRCMOD_SHIFT, // complement 1164 D3DSPSM_X2 = 7<<D3DSP_SRCMOD_SHIFT, // *2 1165 D3DSPSM_X2NEG = 8<<D3DSP_SRCMOD_SHIFT, // *2 and negate 1166 D3DSPSM_DZ = 9<<D3DSP_SRCMOD_SHIFT, // divide through by z component 1167 D3DSPSM_DW = 10<<D3DSP_SRCMOD_SHIFT, // divide through by w component 1168 D3DSPSM_ABS = 11<<D3DSP_SRCMOD_SHIFT, // abs() 1169 D3DSPSM_ABSNEG = 12<<D3DSP_SRCMOD_SHIFT, // -abs() 1170 D3DSPSM_NOT = 13<<D3DSP_SRCMOD_SHIFT, // for predicate register: "!p0" 1171 D3DSPSM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1172 } D3DSHADER_PARAM_SRCMOD_TYPE; 1173 1174 // Source or dest token bits [15:14]: 1175 // destination parameter modifiers 1176 #define D3DSP_MIN_PRECISION_SHIFT 14 1177 #define D3DSP_MIN_PRECISION_MASK 0x0000C000 1178 1179 typedef enum _D3DSHADER_MIN_PRECISION 1180 { 1181 D3DMP_DEFAULT = 0, // Default precision for the shader model 1182 D3DMP_16 = 1, // 16 bit per component 1183 D3DMP_2_8 = 2, // 10 bits (2.8) per component 1184 } D3DSHADER_MIN_PRECISION; 1185 // If the older D3DSPDM_PARTIALPRECISION is set, 1186 // that is equivalent to the whole operation specifying 1187 // D3DMP_16 (on all operands). The two encodings are not 1188 // used together however. 1189 1190 1191 1192 // pixel shader version token 1193 #define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor)) 1194 1195 // vertex shader version token 1196 #define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor)) 1197 1198 // extract major/minor from version cap 1199 #define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF) 1200 #define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) 1201 1202 // destination/source parameter register type 1203 #define D3DSI_COMMENTSIZE_SHIFT 16 1204 #define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 1205 #define D3DSHADER_COMMENT(_DWordSize) \ 1206 ((((_DWordSize)<<D3DSI_COMMENTSIZE_SHIFT)&D3DSI_COMMENTSIZE_MASK)|D3DSIO_COMMENT) 1207 1208 // pixel/vertex shader end token 1209 #define D3DPS_END() 0x0000FFFF 1210 #define D3DVS_END() 0x0000FFFF 1211 1212 1213 //--------------------------------------------------------------------- 1214 1215 // High order surfaces 1216 // 1217 typedef enum _D3DBASISTYPE 1218 { 1219 D3DBASIS_BEZIER = 0, 1220 D3DBASIS_BSPLINE = 1, 1221 D3DBASIS_CATMULL_ROM = 2, /* In D3D8 this used to be D3DBASIS_INTERPOLATE */ 1222 D3DBASIS_FORCE_DWORD = 0x7fffffff, 1223 } D3DBASISTYPE; 1224 1225 typedef enum _D3DDEGREETYPE 1226 { 1227 D3DDEGREE_LINEAR = 1, 1228 D3DDEGREE_QUADRATIC = 2, 1229 D3DDEGREE_CUBIC = 3, 1230 D3DDEGREE_QUINTIC = 5, 1231 D3DDEGREE_FORCE_DWORD = 0x7fffffff, 1232 } D3DDEGREETYPE; 1233 1234 typedef enum _D3DPATCHEDGESTYLE 1235 { 1236 D3DPATCHEDGE_DISCRETE = 0, 1237 D3DPATCHEDGE_CONTINUOUS = 1, 1238 D3DPATCHEDGE_FORCE_DWORD = 0x7fffffff, 1239 } D3DPATCHEDGESTYLE; 1240 1241 typedef enum _D3DSTATEBLOCKTYPE 1242 { 1243 D3DSBT_ALL = 1, // capture all state 1244 D3DSBT_PIXELSTATE = 2, // capture pixel state 1245 D3DSBT_VERTEXSTATE = 3, // capture vertex state 1246 D3DSBT_FORCE_DWORD = 0x7fffffff, 1247 } D3DSTATEBLOCKTYPE; 1248 1249 // The D3DVERTEXBLENDFLAGS type is used with D3DRS_VERTEXBLEND state. 1250 // 1251 typedef enum _D3DVERTEXBLENDFLAGS 1252 { 1253 D3DVBF_DISABLE = 0, // Disable vertex blending 1254 D3DVBF_1WEIGHTS = 1, // 2 matrix blending 1255 D3DVBF_2WEIGHTS = 2, // 3 matrix blending 1256 D3DVBF_3WEIGHTS = 3, // 4 matrix blending 1257 D3DVBF_TWEENING = 255, // blending using D3DRS_TWEENFACTOR 1258 D3DVBF_0WEIGHTS = 256, // one matrix is used with weight 1.0 1259 D3DVBF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum 1260 } D3DVERTEXBLENDFLAGS; 1261 1262 typedef enum _D3DTEXTURETRANSFORMFLAGS { 1263 D3DTTFF_DISABLE = 0, // texture coordinates are passed directly 1264 D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords 1265 D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords 1266 D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords 1267 D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords 1268 D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element 1269 D3DTTFF_FORCE_DWORD = 0x7fffffff, 1270 } D3DTEXTURETRANSFORMFLAGS; 1271 1272 // Macros to set texture coordinate format bits in the FVF id 1273 1274 #define D3DFVF_TEXTUREFORMAT2 0 // Two floating point values 1275 #define D3DFVF_TEXTUREFORMAT1 3 // One floating point value 1276 #define D3DFVF_TEXTUREFORMAT3 1 // Three floating point values 1277 #define D3DFVF_TEXTUREFORMAT4 2 // Four floating point values 1278 1279 #define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16)) 1280 #define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2) 1281 #define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16)) 1282 #define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16)) 1283 1284 1285 //--------------------------------------------------------------------- 1286 1287 /* Direct3D9 Device types */ 1288 typedef enum _D3DDEVTYPE 1289 { 1290 D3DDEVTYPE_HAL = 1, 1291 D3DDEVTYPE_REF = 2, 1292 D3DDEVTYPE_SW = 3, 1293 1294 D3DDEVTYPE_NULLREF = 4, 1295 1296 D3DDEVTYPE_FORCE_DWORD = 0x7fffffff 1297 } D3DDEVTYPE; 1298 1299 /* Multi-Sample buffer types */ 1300 typedef enum _D3DMULTISAMPLE_TYPE 1301 { 1302 D3DMULTISAMPLE_NONE = 0, 1303 D3DMULTISAMPLE_NONMASKABLE = 1, 1304 D3DMULTISAMPLE_2_SAMPLES = 2, 1305 D3DMULTISAMPLE_3_SAMPLES = 3, 1306 D3DMULTISAMPLE_4_SAMPLES = 4, 1307 D3DMULTISAMPLE_5_SAMPLES = 5, 1308 D3DMULTISAMPLE_6_SAMPLES = 6, 1309 D3DMULTISAMPLE_7_SAMPLES = 7, 1310 D3DMULTISAMPLE_8_SAMPLES = 8, 1311 D3DMULTISAMPLE_9_SAMPLES = 9, 1312 D3DMULTISAMPLE_10_SAMPLES = 10, 1313 D3DMULTISAMPLE_11_SAMPLES = 11, 1314 D3DMULTISAMPLE_12_SAMPLES = 12, 1315 D3DMULTISAMPLE_13_SAMPLES = 13, 1316 D3DMULTISAMPLE_14_SAMPLES = 14, 1317 D3DMULTISAMPLE_15_SAMPLES = 15, 1318 D3DMULTISAMPLE_16_SAMPLES = 16, 1319 1320 D3DMULTISAMPLE_FORCE_DWORD = 0x7fffffff 1321 } D3DMULTISAMPLE_TYPE; 1322 1323 /* Formats 1324 * Most of these names have the following convention: 1325 * A = Alpha 1326 * R = Red 1327 * G = Green 1328 * B = Blue 1329 * X = Unused Bits 1330 * P = Palette 1331 * L = Luminance 1332 * U = dU coordinate for BumpMap 1333 * V = dV coordinate for BumpMap 1334 * S = Stencil 1335 * D = Depth (e.g. Z or W buffer) 1336 * C = Computed from other channels (typically on certain read operations) 1337 * 1338 * Further, the order of the pieces are from MSB first; hence 1339 * D3DFMT_A8L8 indicates that the high byte of this two byte 1340 * format is alpha. 1341 * 1342 * D3DFMT_D16_LOCKABLE indicates: 1343 * - An integer 16-bit value. 1344 * - An app-lockable surface. 1345 * 1346 * D3DFMT_D32F_LOCKABLE indicates: 1347 * - An IEEE 754 floating-point value. 1348 * - An app-lockable surface. 1349 * 1350 * All Depth/Stencil formats except D3DFMT_D16_LOCKABLE and D3DFMT_D32F_LOCKABLE indicate: 1351 * - no particular bit ordering per pixel, and 1352 * - are not app lockable, and 1353 * - the driver is allowed to consume more than the indicated 1354 * number of bits per Depth channel (but not Stencil channel). 1355 */ 1356 #ifndef MAKEFOURCC 1357 #define MAKEFOURCC(ch0, ch1, ch2, ch3) \ 1358 ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ 1359 ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) 1360 #endif /* defined(MAKEFOURCC) */ 1361 1362 1363 typedef enum _D3DFORMAT 1364 { 1365 D3DFMT_UNKNOWN = 0, 1366 1367 D3DFMT_R8G8B8 = 20, 1368 D3DFMT_A8R8G8B8 = 21, 1369 D3DFMT_X8R8G8B8 = 22, 1370 D3DFMT_R5G6B5 = 23, 1371 D3DFMT_X1R5G5B5 = 24, 1372 D3DFMT_A1R5G5B5 = 25, 1373 D3DFMT_A4R4G4B4 = 26, 1374 D3DFMT_R3G3B2 = 27, 1375 D3DFMT_A8 = 28, 1376 D3DFMT_A8R3G3B2 = 29, 1377 D3DFMT_X4R4G4B4 = 30, 1378 D3DFMT_A2B10G10R10 = 31, 1379 D3DFMT_A8B8G8R8 = 32, 1380 D3DFMT_X8B8G8R8 = 33, 1381 D3DFMT_G16R16 = 34, 1382 D3DFMT_A2R10G10B10 = 35, 1383 D3DFMT_A16B16G16R16 = 36, 1384 1385 D3DFMT_A8P8 = 40, 1386 D3DFMT_P8 = 41, 1387 1388 D3DFMT_L8 = 50, 1389 D3DFMT_A8L8 = 51, 1390 D3DFMT_A4L4 = 52, 1391 1392 D3DFMT_V8U8 = 60, 1393 D3DFMT_L6V5U5 = 61, 1394 D3DFMT_X8L8V8U8 = 62, 1395 D3DFMT_Q8W8V8U8 = 63, 1396 D3DFMT_V16U16 = 64, 1397 D3DFMT_A2W10V10U10 = 67, 1398 1399 D3DFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'), 1400 D3DFMT_R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'), 1401 D3DFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'), 1402 D3DFMT_G8R8_G8B8 = MAKEFOURCC('G', 'R', 'G', 'B'), 1403 D3DFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'), 1404 D3DFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'), 1405 D3DFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'), 1406 D3DFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'), 1407 D3DFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'), 1408 1409 D3DFMT_D16_LOCKABLE = 70, 1410 D3DFMT_D32 = 71, 1411 D3DFMT_D15S1 = 73, 1412 D3DFMT_D24S8 = 75, 1413 D3DFMT_D24X8 = 77, 1414 D3DFMT_D24X4S4 = 79, 1415 D3DFMT_D16 = 80, 1416 1417 D3DFMT_D32F_LOCKABLE = 82, 1418 D3DFMT_D24FS8 = 83, 1419 1420 /* D3D9Ex only -- */ 1421 #if !defined(D3D_DISABLE_9EX) 1422 1423 /* Z-Stencil formats valid for CPU access */ 1424 D3DFMT_D32_LOCKABLE = 84, 1425 D3DFMT_S8_LOCKABLE = 85, 1426 1427 #endif // !D3D_DISABLE_9EX 1428 /* -- D3D9Ex only */ 1429 1430 1431 D3DFMT_L16 = 81, 1432 1433 D3DFMT_VERTEXDATA =100, 1434 D3DFMT_INDEX16 =101, 1435 D3DFMT_INDEX32 =102, 1436 1437 D3DFMT_Q16W16V16U16 =110, 1438 1439 D3DFMT_MULTI2_ARGB8 = MAKEFOURCC('M','E','T','1'), 1440 1441 // Floating point surface formats 1442 1443 // s10e5 formats (16-bits per channel) 1444 D3DFMT_R16F = 111, 1445 D3DFMT_G16R16F = 112, 1446 D3DFMT_A16B16G16R16F = 113, 1447 1448 // IEEE s23e8 formats (32-bits per channel) 1449 D3DFMT_R32F = 114, 1450 D3DFMT_G32R32F = 115, 1451 D3DFMT_A32B32G32R32F = 116, 1452 1453 D3DFMT_CxV8U8 = 117, 1454 1455 /* D3D9Ex only -- */ 1456 #if !defined(D3D_DISABLE_9EX) 1457 1458 // Monochrome 1 bit per pixel format 1459 D3DFMT_A1 = 118, 1460 1461 // 2.8 biased fixed point 1462 D3DFMT_A2B10G10R10_XR_BIAS = 119, 1463 1464 1465 // Binary format indicating that the data has no inherent type 1466 D3DFMT_BINARYBUFFER = 199, 1467 1468 #endif // !D3D_DISABLE_9EX 1469 /* -- D3D9Ex only */ 1470 1471 1472 D3DFMT_FORCE_DWORD =0x7fffffff 1473 } D3DFORMAT; 1474 1475 /* Display Modes */ 1476 typedef struct _D3DDISPLAYMODE 1477 { 1478 UINT Width; 1479 UINT Height; 1480 UINT RefreshRate; 1481 D3DFORMAT Format; 1482 } D3DDISPLAYMODE; 1483 1484 /* Creation Parameters */ 1485 typedef struct _D3DDEVICE_CREATION_PARAMETERS 1486 { 1487 UINT AdapterOrdinal; 1488 D3DDEVTYPE DeviceType; 1489 HWND hFocusWindow; 1490 DWORD BehaviorFlags; 1491 } D3DDEVICE_CREATION_PARAMETERS; 1492 1493 1494 /* SwapEffects */ 1495 typedef enum _D3DSWAPEFFECT 1496 { 1497 D3DSWAPEFFECT_DISCARD = 1, 1498 D3DSWAPEFFECT_FLIP = 2, 1499 D3DSWAPEFFECT_COPY = 3, 1500 1501 /* D3D9Ex only -- */ 1502 #if !defined(D3D_DISABLE_9EX) 1503 D3DSWAPEFFECT_OVERLAY = 4, 1504 D3DSWAPEFFECT_FLIPEX = 5, 1505 #endif // !D3D_DISABLE_9EX 1506 /* -- D3D9Ex only */ 1507 1508 D3DSWAPEFFECT_FORCE_DWORD = 0x7fffffff 1509 } D3DSWAPEFFECT; 1510 1511 /* Pool types */ 1512 typedef enum _D3DPOOL { 1513 D3DPOOL_DEFAULT = 0, 1514 D3DPOOL_MANAGED = 1, 1515 D3DPOOL_SYSTEMMEM = 2, 1516 D3DPOOL_SCRATCH = 3, 1517 1518 D3DPOOL_FORCE_DWORD = 0x7fffffff 1519 } D3DPOOL; 1520 1521 1522 /* RefreshRate pre-defines */ 1523 #define D3DPRESENT_RATE_DEFAULT 0x00000000 1524 1525 1526 /* Resize Optional Parameters */ 1527 typedef struct _D3DPRESENT_PARAMETERS_ 1528 { 1529 UINT BackBufferWidth; 1530 UINT BackBufferHeight; 1531 D3DFORMAT BackBufferFormat; 1532 UINT BackBufferCount; 1533 1534 D3DMULTISAMPLE_TYPE MultiSampleType; 1535 DWORD MultiSampleQuality; 1536 1537 D3DSWAPEFFECT SwapEffect; 1538 HWND hDeviceWindow; 1539 BOOL Windowed; 1540 BOOL EnableAutoDepthStencil; 1541 D3DFORMAT AutoDepthStencilFormat; 1542 DWORD Flags; 1543 1544 /* FullScreen_RefreshRateInHz must be zero for Windowed mode */ 1545 UINT FullScreen_RefreshRateInHz; 1546 UINT PresentationInterval; 1547 } D3DPRESENT_PARAMETERS; 1548 1549 // Values for D3DPRESENT_PARAMETERS.Flags 1550 1551 #define D3DPRESENTFLAG_LOCKABLE_BACKBUFFER 0x00000001 1552 #define D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL 0x00000002 1553 #define D3DPRESENTFLAG_DEVICECLIP 0x00000004 1554 #define D3DPRESENTFLAG_VIDEO 0x00000010 1555 1556 /* D3D9Ex only -- */ 1557 #if !defined(D3D_DISABLE_9EX) 1558 1559 #define D3DPRESENTFLAG_NOAUTOROTATE 0x00000020 1560 #define D3DPRESENTFLAG_UNPRUNEDMODE 0x00000040 1561 #define D3DPRESENTFLAG_OVERLAY_LIMITEDRGB 0x00000080 1562 #define D3DPRESENTFLAG_OVERLAY_YCbCr_BT709 0x00000100 1563 #define D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC 0x00000200 1564 #define D3DPRESENTFLAG_RESTRICTED_CONTENT 0x00000400 1565 #define D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER 0x00000800 1566 1567 #endif // !D3D_DISABLE_9EX 1568 /* -- D3D9Ex only */ 1569 1570 /* Gamma Ramp: Same as DX7 */ 1571 1572 typedef struct _D3DGAMMARAMP 1573 { 1574 WORD red [256]; 1575 WORD green[256]; 1576 WORD blue [256]; 1577 } D3DGAMMARAMP; 1578 1579 /* Back buffer types */ 1580 typedef enum _D3DBACKBUFFER_TYPE 1581 { 1582 D3DBACKBUFFER_TYPE_MONO = 0, 1583 D3DBACKBUFFER_TYPE_LEFT = 1, 1584 D3DBACKBUFFER_TYPE_RIGHT = 2, 1585 1586 D3DBACKBUFFER_TYPE_FORCE_DWORD = 0x7fffffff 1587 } D3DBACKBUFFER_TYPE; 1588 1589 1590 /* Types */ 1591 typedef enum _D3DRESOURCETYPE { 1592 D3DRTYPE_SURFACE = 1, 1593 D3DRTYPE_VOLUME = 2, 1594 D3DRTYPE_TEXTURE = 3, 1595 D3DRTYPE_VOLUMETEXTURE = 4, 1596 D3DRTYPE_CUBETEXTURE = 5, 1597 D3DRTYPE_VERTEXBUFFER = 6, 1598 D3DRTYPE_INDEXBUFFER = 7, //if this changes, change _D3DDEVINFO_RESOURCEMANAGER definition 1599 1600 1601 D3DRTYPE_FORCE_DWORD = 0x7fffffff 1602 } D3DRESOURCETYPE; 1603 1604 /* Usages */ 1605 #define D3DUSAGE_RENDERTARGET (0x00000001L) 1606 #define D3DUSAGE_DEPTHSTENCIL (0x00000002L) 1607 #define D3DUSAGE_DYNAMIC (0x00000200L) 1608 1609 /* D3D9Ex only -- */ 1610 #if !defined(D3D_DISABLE_9EX) 1611 1612 #define D3DUSAGE_NONSECURE (0x00800000L) 1613 1614 #endif // !D3D_DISABLE_9EX 1615 /* -- D3D9Ex only */ 1616 1617 // When passed to CheckDeviceFormat, D3DUSAGE_AUTOGENMIPMAP may return 1618 // D3DOK_NOAUTOGEN if the device doesn't support autogeneration for that format. 1619 // D3DOK_NOAUTOGEN is a success code, not a failure code... the SUCCEEDED and FAILED macros 1620 // will return true and false respectively for this code. 1621 #define D3DUSAGE_AUTOGENMIPMAP (0x00000400L) 1622 #define D3DUSAGE_DMAP (0x00004000L) 1623 1624 // The following usages are valid only for querying CheckDeviceFormat 1625 #define D3DUSAGE_QUERY_LEGACYBUMPMAP (0x00008000L) 1626 #define D3DUSAGE_QUERY_SRGBREAD (0x00010000L) 1627 #define D3DUSAGE_QUERY_FILTER (0x00020000L) 1628 #define D3DUSAGE_QUERY_SRGBWRITE (0x00040000L) 1629 #define D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING (0x00080000L) 1630 #define D3DUSAGE_QUERY_VERTEXTEXTURE (0x00100000L) 1631 #define D3DUSAGE_QUERY_WRAPANDMIP (0x00200000L) 1632 1633 /* Usages for Vertex/Index buffers */ 1634 #define D3DUSAGE_WRITEONLY (0x00000008L) 1635 #define D3DUSAGE_SOFTWAREPROCESSING (0x00000010L) 1636 #define D3DUSAGE_DONOTCLIP (0x00000020L) 1637 #define D3DUSAGE_POINTS (0x00000040L) 1638 #define D3DUSAGE_RTPATCHES (0x00000080L) 1639 #define D3DUSAGE_NPATCHES (0x00000100L) 1640 1641 /* D3D9Ex only -- */ 1642 #if !defined(D3D_DISABLE_9EX) 1643 1644 #define D3DUSAGE_TEXTAPI (0x10000000L) 1645 #define D3DUSAGE_RESTRICTED_CONTENT (0x00000800L) 1646 #define D3DUSAGE_RESTRICT_SHARED_RESOURCE (0x00002000L) 1647 #define D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER (0x00001000L) 1648 1649 #endif // !D3D_DISABLE_9EX 1650 /* -- D3D9Ex only */ 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 /* CubeMap Face identifiers */ 1669 typedef enum _D3DCUBEMAP_FACES 1670 { 1671 D3DCUBEMAP_FACE_POSITIVE_X = 0, 1672 D3DCUBEMAP_FACE_NEGATIVE_X = 1, 1673 D3DCUBEMAP_FACE_POSITIVE_Y = 2, 1674 D3DCUBEMAP_FACE_NEGATIVE_Y = 3, 1675 D3DCUBEMAP_FACE_POSITIVE_Z = 4, 1676 D3DCUBEMAP_FACE_NEGATIVE_Z = 5, 1677 1678 D3DCUBEMAP_FACE_FORCE_DWORD = 0x7fffffff 1679 } D3DCUBEMAP_FACES; 1680 1681 1682 /* Lock flags */ 1683 1684 #define D3DLOCK_READONLY 0x00000010L 1685 #define D3DLOCK_DISCARD 0x00002000L 1686 #define D3DLOCK_NOOVERWRITE 0x00001000L 1687 #define D3DLOCK_NOSYSLOCK 0x00000800L 1688 #define D3DLOCK_DONOTWAIT 0x00004000L 1689 1690 #define D3DLOCK_NO_DIRTY_UPDATE 0x00008000L 1691 1692 1693 1694 1695 1696 1697 1698 /* Vertex Buffer Description */ 1699 typedef struct _D3DVERTEXBUFFER_DESC 1700 { 1701 D3DFORMAT Format; 1702 D3DRESOURCETYPE Type; 1703 DWORD Usage; 1704 D3DPOOL Pool; 1705 UINT Size; 1706 1707 DWORD FVF; 1708 1709 } D3DVERTEXBUFFER_DESC; 1710 1711 /* Index Buffer Description */ 1712 typedef struct _D3DINDEXBUFFER_DESC 1713 { 1714 D3DFORMAT Format; 1715 D3DRESOURCETYPE Type; 1716 DWORD Usage; 1717 D3DPOOL Pool; 1718 UINT Size; 1719 } D3DINDEXBUFFER_DESC; 1720 1721 1722 /* Surface Description */ 1723 typedef struct _D3DSURFACE_DESC 1724 { 1725 D3DFORMAT Format; 1726 D3DRESOURCETYPE Type; 1727 DWORD Usage; 1728 D3DPOOL Pool; 1729 1730 D3DMULTISAMPLE_TYPE MultiSampleType; 1731 DWORD MultiSampleQuality; 1732 UINT Width; 1733 UINT Height; 1734 } D3DSURFACE_DESC; 1735 1736 typedef struct _D3DVOLUME_DESC 1737 { 1738 D3DFORMAT Format; 1739 D3DRESOURCETYPE Type; 1740 DWORD Usage; 1741 D3DPOOL Pool; 1742 1743 UINT Width; 1744 UINT Height; 1745 UINT Depth; 1746 } D3DVOLUME_DESC; 1747 1748 /* Structure for LockRect */ 1749 typedef struct _D3DLOCKED_RECT 1750 { 1751 INT Pitch; 1752 void* pBits; 1753 } D3DLOCKED_RECT; 1754 1755 /* Structures for LockBox */ 1756 typedef struct _D3DBOX 1757 { 1758 UINT Left; 1759 UINT Top; 1760 UINT Right; 1761 UINT Bottom; 1762 UINT Front; 1763 UINT Back; 1764 } D3DBOX; 1765 1766 typedef struct _D3DLOCKED_BOX 1767 { 1768 INT RowPitch; 1769 INT SlicePitch; 1770 void* pBits; 1771 } D3DLOCKED_BOX; 1772 1773 /* Structures for LockRange */ 1774 typedef struct _D3DRANGE 1775 { 1776 UINT Offset; 1777 UINT Size; 1778 } D3DRANGE; 1779 1780 /* Structures for high order primitives */ 1781 typedef struct _D3DRECTPATCH_INFO 1782 { 1783 UINT StartVertexOffsetWidth; 1784 UINT StartVertexOffsetHeight; 1785 UINT Width; 1786 UINT Height; 1787 UINT Stride; 1788 D3DBASISTYPE Basis; 1789 D3DDEGREETYPE Degree; 1790 } D3DRECTPATCH_INFO; 1791 1792 typedef struct _D3DTRIPATCH_INFO 1793 { 1794 UINT StartVertexOffset; 1795 UINT NumVertices; 1796 D3DBASISTYPE Basis; 1797 D3DDEGREETYPE Degree; 1798 } D3DTRIPATCH_INFO; 1799 1800 /* Adapter Identifier */ 1801 1802 #define MAX_DEVICE_IDENTIFIER_STRING 512 1803 typedef struct _D3DADAPTER_IDENTIFIER9 1804 { 1805 char Driver[MAX_DEVICE_IDENTIFIER_STRING]; 1806 char Description[MAX_DEVICE_IDENTIFIER_STRING]; 1807 char DeviceName[32]; /* Device name for GDI (ex. \\.\DISPLAY1) */ 1808 1809 #ifdef _WIN32 1810 LARGE_INTEGER DriverVersion; /* Defined for 32 bit components */ 1811 #else 1812 DWORD DriverVersionLowPart; /* Defined for 16 bit driver components */ 1813 DWORD DriverVersionHighPart; 1814 #endif 1815 1816 DWORD VendorId; 1817 DWORD DeviceId; 1818 DWORD SubSysId; 1819 DWORD Revision; 1820 1821 GUID DeviceIdentifier; 1822 1823 DWORD WHQLLevel; 1824 1825 } D3DADAPTER_IDENTIFIER9; 1826 1827 1828 /* Raster Status structure returned by GetRasterStatus */ 1829 typedef struct _D3DRASTER_STATUS 1830 { 1831 BOOL InVBlank; 1832 UINT ScanLine; 1833 } D3DRASTER_STATUS; 1834 1835 1836 1837 /* Debug monitor tokens (DEBUG only) 1838 1839 Note that if D3DRS_DEBUGMONITORTOKEN is set, the call is treated as 1840 passing a token to the debug monitor. For example, if, after passing 1841 D3DDMT_ENABLE/DISABLE to D3DRS_DEBUGMONITORTOKEN other token values 1842 are passed in, the enabled/disabled state of the debug 1843 monitor will still persist. 1844 1845 The debug monitor defaults to enabled. 1846 1847 Calling GetRenderState on D3DRS_DEBUGMONITORTOKEN is not of any use. 1848 */ 1849 typedef enum _D3DDEBUGMONITORTOKENS { 1850 D3DDMT_ENABLE = 0, // enable debug monitor 1851 D3DDMT_DISABLE = 1, // disable debug monitor 1852 D3DDMT_FORCE_DWORD = 0x7fffffff, 1853 } D3DDEBUGMONITORTOKENS; 1854 1855 // Async feedback 1856 1857 typedef enum _D3DQUERYTYPE { 1858 D3DQUERYTYPE_VCACHE = 4, /* D3DISSUE_END */ 1859 D3DQUERYTYPE_RESOURCEMANAGER = 5, /* D3DISSUE_END */ 1860 D3DQUERYTYPE_VERTEXSTATS = 6, /* D3DISSUE_END */ 1861 D3DQUERYTYPE_EVENT = 8, /* D3DISSUE_END */ 1862 D3DQUERYTYPE_OCCLUSION = 9, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1863 D3DQUERYTYPE_TIMESTAMP = 10, /* D3DISSUE_END */ 1864 D3DQUERYTYPE_TIMESTAMPDISJOINT = 11, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1865 D3DQUERYTYPE_TIMESTAMPFREQ = 12, /* D3DISSUE_END */ 1866 D3DQUERYTYPE_PIPELINETIMINGS = 13, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1867 D3DQUERYTYPE_INTERFACETIMINGS = 14, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1868 D3DQUERYTYPE_VERTEXTIMINGS = 15, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1869 D3DQUERYTYPE_PIXELTIMINGS = 16, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1870 D3DQUERYTYPE_BANDWIDTHTIMINGS = 17, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1871 D3DQUERYTYPE_CACHEUTILIZATION = 18, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1872 /* D3D9Ex only -- */ 1873 #if !defined(D3D_DISABLE_9EX) 1874 D3DQUERYTYPE_MEMORYPRESSURE = 19, /* D3DISSUE_BEGIN, D3DISSUE_END */ 1875 #endif // !D3D_DISABLE_9EX 1876 } D3DQUERYTYPE; 1877 1878 // Flags field for Issue 1879 #define D3DISSUE_END (1 << 0) // Tells the runtime to issue the end of a query, changing it's state to "non-signaled". 1880 #define D3DISSUE_BEGIN (1 << 1) // Tells the runtime to issue the beginng of a query. 1881 1882 1883 // Flags field for GetData 1884 #define D3DGETDATA_FLUSH (1 << 0) // Tells the runtime to flush if the query is outstanding. 1885 1886 1887 typedef struct _D3DRESOURCESTATS 1888 { 1889 // Data collected since last Present() 1890 BOOL bThrashing; /* indicates if thrashing */ 1891 DWORD ApproxBytesDownloaded; /* Approximate number of bytes downloaded by resource manager */ 1892 DWORD NumEvicts; /* number of objects evicted */ 1893 DWORD NumVidCreates; /* number of objects created in video memory */ 1894 DWORD LastPri; /* priority of last object evicted */ 1895 DWORD NumUsed; /* number of objects set to the device */ 1896 DWORD NumUsedInVidMem; /* number of objects set to the device, which are already in video memory */ 1897 // Persistent data 1898 DWORD WorkingSet; /* number of objects in video memory */ 1899 DWORD WorkingSetBytes; /* number of bytes in video memory */ 1900 DWORD TotalManaged; /* total number of managed objects */ 1901 DWORD TotalBytes; /* total number of bytes of managed objects */ 1902 } D3DRESOURCESTATS; 1903 1904 #define D3DRTYPECOUNT (D3DRTYPE_INDEXBUFFER+1) 1905 1906 typedef struct _D3DDEVINFO_RESOURCEMANAGER 1907 { 1908 #ifndef WOW64_ENUM_WORKAROUND 1909 D3DRESOURCESTATS stats[D3DRTYPECOUNT]; 1910 #else 1911 D3DRESOURCESTATS stats[8]; 1912 #endif 1913 } D3DDEVINFO_RESOURCEMANAGER, *LPD3DDEVINFO_RESOURCEMANAGER; 1914 1915 typedef struct _D3DDEVINFO_D3DVERTEXSTATS 1916 { 1917 DWORD NumRenderedTriangles; /* total number of triangles that are not clipped in this frame */ 1918 DWORD NumExtraClippingTriangles; /* Number of new triangles generated by clipping */ 1919 } D3DDEVINFO_D3DVERTEXSTATS, *LPD3DDEVINFO_D3DVERTEXSTATS; 1920 1921 1922 typedef struct _D3DDEVINFO_VCACHE { 1923 DWORD Pattern; /* bit pattern, return value must be FOUR_CC('C', 'A', 'C', 'H') */ 1924 DWORD OptMethod; /* optimization method 0 means longest strips, 1 means vertex cache based */ 1925 DWORD CacheSize; /* cache size to optimize for (only required if type is 1) */ 1926 DWORD MagicNumber; /* used to determine when to restart strips (only required if type is 1)*/ 1927 } D3DDEVINFO_VCACHE, *LPD3DDEVINFO_VCACHE; 1928 1929 typedef struct _D3DDEVINFO_D3D9PIPELINETIMINGS 1930 { 1931 FLOAT VertexProcessingTimePercent; 1932 FLOAT PixelProcessingTimePercent; 1933 FLOAT OtherGPUProcessingTimePercent; 1934 FLOAT GPUIdleTimePercent; 1935 } D3DDEVINFO_D3D9PIPELINETIMINGS; 1936 1937 typedef struct _D3DDEVINFO_D3D9INTERFACETIMINGS 1938 { 1939 FLOAT WaitingForGPUToUseApplicationResourceTimePercent; 1940 FLOAT WaitingForGPUToAcceptMoreCommandsTimePercent; 1941 FLOAT WaitingForGPUToStayWithinLatencyTimePercent; 1942 FLOAT WaitingForGPUExclusiveResourceTimePercent; 1943 FLOAT WaitingForGPUOtherTimePercent; 1944 } D3DDEVINFO_D3D9INTERFACETIMINGS; 1945 1946 typedef struct _D3DDEVINFO_D3D9STAGETIMINGS 1947 { 1948 FLOAT MemoryProcessingPercent; 1949 FLOAT ComputationProcessingPercent; 1950 } D3DDEVINFO_D3D9STAGETIMINGS; 1951 1952 typedef struct _D3DDEVINFO_D3D9BANDWIDTHTIMINGS 1953 { 1954 FLOAT MaxBandwidthUtilized; 1955 FLOAT FrontEndUploadMemoryUtilizedPercent; 1956 FLOAT VertexRateUtilizedPercent; 1957 FLOAT TriangleSetupRateUtilizedPercent; 1958 FLOAT FillRateUtilizedPercent; 1959 } D3DDEVINFO_D3D9BANDWIDTHTIMINGS; 1960 1961 typedef struct _D3DDEVINFO_D3D9CACHEUTILIZATION 1962 { 1963 FLOAT TextureCacheHitRate; // Percentage of cache hits 1964 FLOAT PostTransformVertexCacheHitRate; 1965 } D3DDEVINFO_D3D9CACHEUTILIZATION; 1966 1967 /* D3D9Ex only -- */ 1968 #if !defined(D3D_DISABLE_9EX) 1969 1970 typedef struct _D3DMEMORYPRESSURE 1971 { 1972 UINT64 BytesEvictedFromProcess; 1973 UINT64 SizeOfInefficientAllocation; 1974 DWORD LevelOfEfficiency; 1975 } D3DMEMORYPRESSURE; 1976 1977 typedef enum _D3DCOMPOSERECTSOP{ 1978 D3DCOMPOSERECTS_COPY = 1, 1979 D3DCOMPOSERECTS_OR = 2, 1980 D3DCOMPOSERECTS_AND = 3, 1981 D3DCOMPOSERECTS_NEG = 4, 1982 D3DCOMPOSERECTS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ 1983 } D3DCOMPOSERECTSOP; 1984 1985 typedef struct _D3DCOMPOSERECTDESC 1986 { 1987 USHORT X, Y; // Top-left coordinates of a rect in the source surface 1988 USHORT Width, Height; // Dimensions of the rect 1989 } D3DCOMPOSERECTDESC; 1990 1991 typedef struct _D3DCOMPOSERECTDESTINATION 1992 { 1993 USHORT SrcRectIndex; // Index of D3DCOMPOSERECTDESC 1994 USHORT Reserved; // For alignment 1995 SHORT X, Y; // Top-left coordinates of the rect in the destination surface 1996 } D3DCOMPOSERECTDESTINATION; 1997 1998 #define D3DCOMPOSERECTS_MAXNUMRECTS 0xFFFF 1999 #define D3DCONVOLUTIONMONO_MAXWIDTH 7 2000 #define D3DCONVOLUTIONMONO_MAXHEIGHT D3DCONVOLUTIONMONO_MAXWIDTH 2001 #define D3DFMT_A1_SURFACE_MAXWIDTH 8192 2002 #define D3DFMT_A1_SURFACE_MAXHEIGHT 2048 2003 2004 2005 typedef struct _D3DPRESENTSTATS { 2006 UINT PresentCount; 2007 UINT PresentRefreshCount; 2008 UINT SyncRefreshCount; 2009 LARGE_INTEGER SyncQPCTime; 2010 LARGE_INTEGER SyncGPUTime; 2011 } D3DPRESENTSTATS; 2012 2013 typedef enum D3DSCANLINEORDERING 2014 { 2015 D3DSCANLINEORDERING_UNKNOWN = 0, 2016 D3DSCANLINEORDERING_PROGRESSIVE = 1, 2017 D3DSCANLINEORDERING_INTERLACED = 2, 2018 } D3DSCANLINEORDERING; 2019 2020 2021 typedef struct D3DDISPLAYMODEEX 2022 { 2023 UINT Size; 2024 UINT Width; 2025 UINT Height; 2026 UINT RefreshRate; 2027 D3DFORMAT Format; 2028 D3DSCANLINEORDERING ScanLineOrdering; 2029 } D3DDISPLAYMODEEX; 2030 2031 typedef struct D3DDISPLAYMODEFILTER 2032 { 2033 UINT Size; 2034 D3DFORMAT Format; 2035 D3DSCANLINEORDERING ScanLineOrdering; 2036 } D3DDISPLAYMODEFILTER; 2037 2038 2039 typedef enum D3DDISPLAYROTATION 2040 { 2041 D3DDISPLAYROTATION_IDENTITY = 1, // No rotation. 2042 D3DDISPLAYROTATION_90 = 2, // Rotated 90 degrees. 2043 D3DDISPLAYROTATION_180 = 3, // Rotated 180 degrees. 2044 D3DDISPLAYROTATION_270 = 4 // Rotated 270 degrees. 2045 } D3DDISPLAYROTATION; 2046 2047 /* For use in ID3DResource9::SetPriority calls */ 2048 #define D3D9_RESOURCE_PRIORITY_MINIMUM 0x28000000 2049 #define D3D9_RESOURCE_PRIORITY_LOW 0x50000000 2050 #define D3D9_RESOURCE_PRIORITY_NORMAL 0x78000000 2051 #define D3D9_RESOURCE_PRIORITY_HIGH 0xa0000000 2052 #define D3D9_RESOURCE_PRIORITY_MAXIMUM 0xc8000000 2053 2054 #define D3D_OMAC_SIZE 16 2055 2056 typedef struct _D3D_OMAC 2057 { 2058 BYTE Omac[D3D_OMAC_SIZE]; 2059 } D3D_OMAC; 2060 2061 typedef enum _D3DAUTHENTICATEDCHANNELTYPE 2062 { 2063 D3DAUTHENTICATEDCHANNEL_D3D9 = 1, 2064 D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE = 2, 2065 D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE = 3, 2066 } D3DAUTHENTICATEDCHANNELTYPE; 2067 2068 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_INPUT 2069 { 2070 GUID QueryType; 2071 HANDLE hChannel; 2072 UINT SequenceNumber; 2073 } D3DAUTHENTICATEDCHANNEL_QUERY_INPUT; 2074 2075 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT 2076 { 2077 D3D_OMAC omac; 2078 GUID QueryType; 2079 HANDLE hChannel; 2080 UINT SequenceNumber; 2081 HRESULT ReturnCode; 2082 } D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT; 2083 2084 DEFINE_GUID(D3DAUTHENTICATEDQUERY_PROTECTION, 2085 0xa84eb584, 0xc495, 0x48aa, 0xb9, 0x4d, 0x8b, 0xd2, 0xd6, 0xfb, 0xce, 0x5); 2086 2087 typedef struct _D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS 2088 { 2089 union 2090 { 2091 struct 2092 { 2093 UINT ProtectionEnabled : 1; 2094 UINT OverlayOrFullscreenRequired : 1; 2095 UINT Reserved : 30; 2096 }; 2097 UINT Value; 2098 }; 2099 2100 } D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS; 2101 2102 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT 2103 { 2104 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2105 2106 D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS ProtectionFlags; 2107 2108 } D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT; 2109 2110 2111 DEFINE_GUID(D3DAUTHENTICATEDQUERY_CHANNELTYPE, 2112 0xbc1b18a5, 0xb1fb, 0x42ab, 0xbd, 0x94, 0xb5, 0x82, 0x8b, 0x4b, 0xf7, 0xbe); 2113 2114 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT 2115 { 2116 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2117 2118 D3DAUTHENTICATEDCHANNELTYPE ChannelType; 2119 2120 } D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT; 2121 2122 2123 DEFINE_GUID(D3DAUTHENTICATEDQUERY_DEVICEHANDLE, 2124 0xec1c539d, 0x8cff, 0x4e2a, 0xbc, 0xc4, 0xf5, 0x69, 0x2f, 0x99, 0xf4, 0x80); 2125 2126 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT 2127 { 2128 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2129 2130 HANDLE DeviceHandle; 2131 2132 } D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT; 2133 2134 2135 DEFINE_GUID(D3DAUTHENTICATEDQUERY_CRYPTOSESSION, 2136 0x2634499e, 0xd018, 0x4d74, 0xac, 0x17, 0x7f, 0x72, 0x40, 0x59, 0x52, 0x8d); 2137 2138 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT 2139 { 2140 D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; 2141 2142 HANDLE DXVA2DecodeHandle; 2143 2144 } D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT; 2145 2146 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT 2147 { 2148 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2149 2150 HANDLE DXVA2DecodeHandle; 2151 HANDLE CryptoSessionHandle; 2152 HANDLE DeviceHandle; 2153 2154 } D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT; 2155 2156 2157 DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESSCOUNT, 2158 0xdb207b3, 0x9450, 0x46a6, 0x82, 0xde, 0x1b, 0x96, 0xd4, 0x4f, 0x9c, 0xf2); 2159 2160 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT 2161 { 2162 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2163 2164 UINT NumRestrictedSharedResourceProcesses; 2165 2166 } D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT; 2167 2168 2169 DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESS, 2170 0x649bbadb, 0xf0f4, 0x4639, 0xa1, 0x5b, 0x24, 0x39, 0x3f, 0xc3, 0xab, 0xac); 2171 2172 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT 2173 { 2174 D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; 2175 2176 UINT ProcessIndex; 2177 2178 } D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT; 2179 2180 typedef enum _D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE 2181 { 2182 PROCESSIDTYPE_UNKNOWN = 0, 2183 PROCESSIDTYPE_DWM = 1, 2184 PROCESSIDTYPE_HANDLE = 2 2185 } D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE; 2186 2187 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT 2188 { 2189 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2190 2191 UINT ProcessIndex; 2192 D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentifer; 2193 HANDLE ProcessHandle; 2194 2195 } D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT; 2196 2197 2198 DEFINE_GUID(D3DAUTHENTICATEDQUERY_UNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT, 2199 0x12f0bd6, 0xe662, 0x4474, 0xbe, 0xfd, 0xaa, 0x53, 0xe5, 0x14, 0x3c, 0x6d); 2200 2201 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT 2202 { 2203 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2204 2205 UINT NumUnrestrictedProtectedSharedResources; 2206 2207 } D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT; 2208 2209 2210 DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTIDCOUNT, 2211 0x2c042b5e, 0x8c07, 0x46d5, 0xaa, 0xbe, 0x8f, 0x75, 0xcb, 0xad, 0x4c, 0x31); 2212 2213 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT 2214 { 2215 D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; 2216 2217 HANDLE DeviceHandle; 2218 HANDLE CryptoSessionHandle; 2219 2220 } D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT; 2221 2222 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT 2223 { 2224 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2225 2226 HANDLE DeviceHandle; 2227 HANDLE CryptoSessionHandle; 2228 UINT NumOutputIDs; 2229 2230 } D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT; 2231 2232 2233 DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTID, 2234 0x839ddca3, 0x9b4e, 0x41e4, 0xb0, 0x53, 0x89, 0x2b, 0xd2, 0xa1, 0x1e, 0xe7); 2235 2236 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT 2237 { 2238 D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; 2239 2240 HANDLE DeviceHandle; 2241 HANDLE CryptoSessionHandle; 2242 UINT OutputIDIndex; 2243 2244 } D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT; 2245 2246 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT 2247 { 2248 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2249 2250 HANDLE DeviceHandle; 2251 HANDLE CryptoSessionHandle; 2252 UINT OutputIDIndex; 2253 UINT64 OutputID; 2254 2255 } D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT; 2256 2257 2258 DEFINE_GUID(D3DAUTHENTICATEDQUERY_ACCESSIBILITYATTRIBUTES, 2259 0x6214d9d2, 0x432c, 0x4abb, 0x9f, 0xce, 0x21, 0x6e, 0xea, 0x26, 0x9e, 0x3b); 2260 2261 typedef enum _D3DBUSTYPE 2262 { 2263 D3DBUSTYPE_OTHER = 0x00000000, 2264 D3DBUSTYPE_PCI = 0x00000001, 2265 D3DBUSTYPE_PCIX = 0x00000002, 2266 D3DBUSTYPE_PCIEXPRESS = 0x00000003, 2267 D3DBUSTYPE_AGP = 0x00000004, 2268 D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET = 0x00010000, 2269 D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 0x00020000, 2270 D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 0x00030000, 2271 D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 0x00040000, 2272 D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 0x00050000, 2273 D3DBUSIMPL_MODIFIER_NON_STANDARD = 0x80000000, 2274 } D3DBUSTYPE; 2275 2276 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT 2277 { 2278 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2279 2280 D3DBUSTYPE BusType; 2281 BOOL bAccessibleInContiguousBlocks; 2282 BOOL bAccessibleInNonContiguousBlocks; 2283 2284 } D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT; 2285 2286 2287 DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUIDCOUNT, 2288 0xb30f7066, 0x203c, 0x4b07, 0x93, 0xfc, 0xce, 0xaa, 0xfd, 0x61, 0x24, 0x1e); 2289 2290 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT 2291 { 2292 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2293 2294 UINT NumEncryptionGuids; 2295 2296 } D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT; 2297 2298 2299 DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUID, 2300 0xf83a5958, 0xe986, 0x4bda, 0xbe, 0xb0, 0x41, 0x1f, 0x6a, 0x7a, 0x1, 0xb7); 2301 2302 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT 2303 { 2304 D3DAUTHENTICATEDCHANNEL_QUERY_INPUT Input; 2305 2306 UINT EncryptionGuidIndex; 2307 2308 } D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT; 2309 2310 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT 2311 { 2312 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2313 2314 UINT EncryptionGuidIndex; 2315 GUID EncryptionGuid; 2316 2317 } D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT; 2318 2319 2320 DEFINE_GUID(D3DAUTHENTICATEDQUERY_CURRENTENCRYPTIONWHENACCESSIBLE, 2321 0xec1791c7, 0xdad3, 0x4f15, 0x9e, 0xc3, 0xfa, 0xa9, 0x3d, 0x60, 0xd4, 0xf0); 2322 2323 typedef struct _D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT 2324 { 2325 D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT Output; 2326 2327 GUID EncryptionGuid; 2328 2329 } D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT; 2330 2331 2332 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT 2333 { 2334 D3D_OMAC omac; 2335 GUID ConfigureType; 2336 HANDLE hChannel; 2337 UINT SequenceNumber; 2338 2339 } D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT; 2340 2341 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT 2342 { 2343 D3D_OMAC omac; 2344 GUID ConfigureType; 2345 HANDLE hChannel; 2346 UINT SequenceNumber; 2347 HRESULT ReturnCode; 2348 2349 } D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT; 2350 2351 DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_INITIALIZE, 2352 0x6114bdb, 0x3523, 0x470a, 0x8d, 0xca, 0xfb, 0xc2, 0x84, 0x51, 0x54, 0xf0); 2353 2354 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE 2355 { 2356 D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; 2357 2358 UINT StartSequenceQuery; 2359 UINT StartSequenceConfigure; 2360 2361 } D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE; 2362 2363 2364 DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_PROTECTION, 2365 0x50455658, 0x3f47, 0x4362, 0xbf, 0x99, 0xbf, 0xdf, 0xcd, 0xe9, 0xed, 0x29); 2366 2367 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION 2368 { 2369 D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; 2370 2371 D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS Protections; 2372 2373 } D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION; 2374 2375 2376 DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_CRYPTOSESSION, 2377 0x6346cc54, 0x2cfc, 0x4ad4, 0x82, 0x24, 0xd1, 0x58, 0x37, 0xde, 0x77, 0x0); 2378 2379 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION 2380 { 2381 D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; 2382 2383 HANDLE DXVA2DecodeHandle; 2384 HANDLE CryptoSessionHandle; 2385 HANDLE DeviceHandle; 2386 2387 } D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION; 2388 2389 2390 DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_SHAREDRESOURCE, 2391 0x772d047, 0x1b40, 0x48e8, 0x9c, 0xa6, 0xb5, 0xf5, 0x10, 0xde, 0x9f, 0x1); 2392 2393 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE 2394 { 2395 D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; 2396 2397 D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ProcessIdentiferType; 2398 HANDLE ProcessHandle; 2399 BOOL AllowAccess; 2400 2401 } D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE; 2402 2403 2404 DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_ENCRYPTIONWHENACCESSIBLE, 2405 0x41fff286, 0x6ae0, 0x4d43, 0x9d, 0x55, 0xa4, 0x6e, 0x9e, 0xfd, 0x15, 0x8a); 2406 2407 typedef struct _D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION 2408 { 2409 D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT Parameters; 2410 2411 GUID EncryptionGuid; 2412 2413 } D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION; 2414 2415 typedef struct _D3DENCRYPTED_BLOCK_INFO 2416 { 2417 UINT NumEncryptedBytesAtBeginning; 2418 UINT NumBytesInSkipPattern; 2419 UINT NumBytesInEncryptPattern; 2420 } D3DENCRYPTED_BLOCK_INFO; 2421 2422 typedef struct _D3DAES_CTR_IV 2423 { 2424 UINT64 IV; // Big-Endian IV 2425 UINT64 Count; // Big-Endian Block Count 2426 } D3DAES_CTR_IV; 2427 2428 2429 2430 #endif // !D3D_DISABLE_9EX 2431 /* -- D3D9Ex only */ 2432 2433 #ifdef _MSC_VER 2434 #pragma pack() 2435 #if _MSC_VER >= 1200 2436 #pragma warning(pop) 2437 #else 2438 #pragma warning(default:4201) 2439 #endif 2440 #endif // _MSC_VER 2441 2442 #endif /* (DIRECT3D_VERSION >= 0x0900) */ 2443 #endif /* _d3d9TYPES(P)_H_ */ 2444 2445