d3d9types.h 87 KB

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