Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

725 lines
31 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: D3D8ddi.h
  6. * Content: Defines the interface between DirectDraw / Direct3D and the
  7. * OS specific layer (win32k.sys on NT and ddraw.dll on Win9X).
  8. *@@BEGIN_MSINTERNAL
  9. * History:
  10. * Date By Reason
  11. * ==== == ======
  12. * 04-nov-99 smac initial implementation
  13. *@@END_MSINTERNAL
  14. *
  15. ***************************************************************************/
  16. #ifndef __D3D8DDI_INCLUDED__
  17. #define __D3D8DDI_INCLUDED__
  18. /*
  19. * These definitions are required to allow polymorphic structure members (i.e. those
  20. * that are referred to both as DWORDs and as pointers) to resolve into a type
  21. * of correct size to hold the largest of those two types (i.e. pointer) on 64 bit
  22. * systems. For 32 bit environments, ULONG_PTR resolves to a DWORD.
  23. */
  24. #ifndef MAXULONG_PTR
  25. #define ULONG_PTR DWORD
  26. #define PULONG_PTR LPDWORD
  27. #endif //MAXULONG_PTR
  28. // Caps:
  29. // Note this struct is identical in content to D3DHAL_GLOBALDRIVERDATA.
  30. // The only thing that has changed is the name of the texture list, reflecting
  31. // the fact that this struct holds a list of DX8-style pixel format operations.
  32. typedef struct _D3DD8_GLOBALDRIVERDATA {
  33. DWORD dwSize; // Size of this structure
  34. D3DDEVICEDESC_V1 hwCaps; // Capabilities of the hardware
  35. DWORD dwNumVertices; // see following comment
  36. DWORD dwNumClipVertices; // see following comment
  37. DWORD GDD8NumSupportedFormatOps;
  38. DDSURFACEDESC *pGDD8SupportedFormatOps;
  39. } D3D8_GLOBALDRIVERDATA;
  40. typedef struct _D3D8_DRIVERCAPS
  41. {
  42. D3DCAPS8 D3DCaps;
  43. DWORD DisplayWidth; // Current display width
  44. DWORD DisplayHeight; // Current display height
  45. D3DFORMAT DisplayFormatWithoutAlpha; // Current display format
  46. D3DFORMAT DisplayFormatWithAlpha; // Current display format
  47. DWORD DisplayFrequency; // Current refresh rate
  48. DWORD NLVCaps; // AGP->Video blt caps
  49. DWORD SVBCaps; // Sys->Video blt caps
  50. DWORD VSBCaps; // Video->Sys blt caps
  51. DWORD SVBCaps2; // More Sys->Video blt caps
  52. DWORD dwFlags;
  53. DWORD GDD8NumSupportedFormatOps;
  54. DDSURFACEDESC *pGDD8SupportedFormatOps;
  55. DWORD KnownDriverFlags;
  56. } D3D8_DRIVERCAPS, * PD3D8_DRIVERCAPS;
  57. // Flags
  58. #define DDIFLAG_D3DCAPS8 0x00000001
  59. // Known driver flags
  60. #define KNOWN_LIGHTWEIGHT 0x00000001 // Device can support lightweight surfaces
  61. #define KNOWN_HWCURSOR 0x00000002 // Device can support hardware cursors in Hi-Res
  62. #define KNOWN_MIPPEDCUBEMAPS 0x00000004 // Device can support mipped cubemaps
  63. #define KNOWN_ZSTENCILDEPTH 0x00000010 // Device cannot support Z/Stencil depths different than the render target
  64. #define KNOWN_HWCURSORLOWRES 0x00000020 // Device can support hardware cursors in LowRes
  65. #define KNOWN_NOTAWINDOWEDBLTQUEUER 0x00000040 // Device has no drivers known to over-queue windowed presentation blts
  66. #define KNOWN_D16_LOCKABLE 0x00000080 // Device supports lockable D16 format correctly
  67. #define KNOWN_RTTEXTURE_R5G6B5 0x00000100 // RT+Tex formats that are supported
  68. #define KNOWN_RTTEXTURE_X8R8G8B8 0x00000200
  69. #define KNOWN_RTTEXTURE_A8R8G8B8 0x00000400
  70. #define KNOWN_RTTEXTURE_A1R5G5B5 0x00000800
  71. #define KNOWN_RTTEXTURE_A4R4G4B4 0x00001000
  72. #define KNOWN_RTTEXTURE_X1R5G5B5 0x00002000
  73. #define KNOWN_CANMISMATCHRT 0x00004000 // All given RT+Tex formats can be used regardless of current display depth.
  74. // (If this bit is not set, then any known RT+Tex formats must match bitdepth of display)
  75. /****************************************************************************
  76. *
  77. * D3D8 structures for Surface Object callbacks
  78. *
  79. ***************************************************************************/
  80. typedef struct _D3D8_BLTDATA
  81. {
  82. HANDLE hDD; // driver struct
  83. HANDLE hDestSurface;// dest surface
  84. RECTL rDest; // dest rect
  85. HANDLE hSrcSurface; // src surface
  86. RECTL rSrc; // src rect
  87. DWORD dwFlags; // blt flags
  88. DWORD dwROPFlags; // ROP flags (valid for ROPS only)
  89. DDBLTFX bltFX; // blt FX
  90. union
  91. {
  92. BOOL IsClipped; // clipped blt?
  93. HWND hWnd; // Window Handle to clip against
  94. };
  95. RECTL rOrigDest; // unclipped dest rect
  96. // (only valid if IsClipped)
  97. RECTL rOrigSrc; // unclipped src rect
  98. // (only valid if IsClipped)
  99. DWORD dwRectCnt; // count of dest rects
  100. // (only valid if IsClipped)
  101. LPRECT prDestRects; // array of dest rects
  102. DWORD dwAFlags; // DDABLT_ flags (for AlphaBlt DDI)
  103. DDARGB ddargbScaleFactors; // RGBA scaling factors (AlphaBlt)
  104. DWORD msLastPresent; // Time of last blt with DDBLT_COPYVSYNC
  105. DWORD threshold; // Display Frequency related for adapter need
  106. // for DDBLT_COPYVSYNC
  107. HRESULT ddRVal; // return value
  108. } D3D8_BLTDATA, * PD3D8_BLTDATA;
  109. typedef struct _D3D8_LOCKDATA
  110. {
  111. HANDLE hDD; // driver struct
  112. HANDLE hSurface; // surface struct
  113. DWORD bHasRange; // range is valid
  114. D3DRANGE range; // range for locking
  115. DWORD bHasRect; // rArea is valid
  116. RECTL rArea; // area being locked
  117. DWORD bHasBox; // box is valid
  118. D3DBOX box; // sub-box locking for volumes
  119. LPVOID lpSurfData; // pointer to screen memory (return value)
  120. long lPitch; // row pitch
  121. long lSlicePitch;// slice pitch for volumes
  122. DWORD dwFlags; // DDLOCK flags
  123. } D3D8_LOCKDATA, * PD3D8_LOCKDATA;
  124. typedef struct _D3D8_UNLOCKDATA
  125. {
  126. HANDLE hDD; // driver struct
  127. HANDLE hSurface; // surface struct
  128. } D3D8_UNLOCKDATA, * PD3D8_UNLOCKDATA;
  129. typedef struct _D3D8_FLIPDATA
  130. {
  131. HANDLE hDD; // driver struct
  132. HANDLE hSurfCurr; // current surface
  133. HANDLE hSurfTarg; // target surface (to flip to)
  134. HANDLE hSurfCurrLeft; // current surface
  135. HANDLE hSurfTargLeft; // target surface (to flip to)
  136. DWORD dwFlags; // flags
  137. HRESULT ddRVal; // return value
  138. } D3D8_FLIPDATA, * PD3D8_FLIPDATA;
  139. typedef struct _D3D8_DESTROYSURFACEDATA
  140. {
  141. HANDLE hDD; // driver struct
  142. HANDLE hSurface; // surface struct
  143. HRESULT ddRVal; // return value
  144. } D3D8_DESTROYSURFACEDATA, * PD3D8_DESTROYSURFACEDATA;
  145. typedef struct _D3D8_ADDATTACHEDSURFACEDATA
  146. {
  147. HANDLE hDD; // driver struct
  148. HANDLE hSurface; // surface struct
  149. HANDLE hSurfAttached; // surface to attach
  150. HRESULT ddRVal; // return value
  151. } D3D8_ADDATTACHEDSURFACEDATA, * PD3D8_ADDATTACHEDSURFACEDATA;
  152. typedef struct _D3D8_GETBLTSTATUSDATA
  153. {
  154. HANDLE hDD; // driver struct
  155. HANDLE hSurface; // surface struct
  156. DWORD dwFlags; // flags
  157. HRESULT ddRVal; // return value
  158. } D3D8_GETBLTSTATUSDATA, * PD3D8_GETBLTSTATUSDATA;
  159. typedef struct _D3D8_GETFLIPSTATUSDATA
  160. {
  161. HANDLE hDD; // driver struct
  162. HANDLE hSurface; // surface struct
  163. DWORD dwFlags; // flags
  164. HRESULT ddRVal; // return value
  165. } D3D8_GETFLIPSTATUSDATA, * PD3D8_GETFLIPSTATUSDATA;
  166. typedef struct _DDSURFACEINFO
  167. {
  168. DWORD cpWidth; // For linear, surface and volume
  169. DWORD cpHeight; // For surface and volume
  170. DWORD cpDepth; // For volumes
  171. BYTE *pbPixels; // Pointer to Memory for sys-mem surface
  172. LONG iPitch; // Row Pitch for sys-mem surface
  173. LONG iSlicePitch; // Slice Pitch for sys-mem volume
  174. HANDLE hKernelHandle; // Handle returned by the kernel
  175. } DDSURFACEINFO, *LPDDSURFACEINFO;
  176. typedef struct _D3D8_CREATESURFACEDATA
  177. {
  178. HANDLE hDD; // driver struct
  179. LPDDSURFACEINFO pSList; // list of created surface objects
  180. DWORD dwSCnt; // number of surfaces in SList
  181. D3DRESOURCETYPE Type; // Type: MipMap, CubeMap, MipVolume, VertexBuffer, IndexBuffer, CommandBuffer
  182. DWORD dwUsage; // Usage: Texture or RenderTarget
  183. D3DPOOL Pool; // SysMem/VidMem/NonLocal
  184. D3DFORMAT Format; // Format
  185. D3DMULTISAMPLE_TYPE MultiSampleType;
  186. DWORD dwFVF; // FVF format for vertex buffers
  187. BOOL bTreatAsVidMem; // Set if Sys-Mem object was created with POOL_DEFAULT by user.
  188. BOOL bReUse; // Set if are trying to create driver managed surfaces marked deferred
  189. } D3D8_CREATESURFACEDATA, * PD3D8_CREATESURFACEDATA;
  190. #define DDWAITVB_I_TESTVB 0x80000006l
  191. typedef struct _D3D8_WAITFORVERTICALBLANKDATA
  192. {
  193. HANDLE hDD; // driver struct
  194. DWORD dwFlags; // flags
  195. DWORD bIsInVB; // is in vertical blank
  196. HRESULT ddRVal; // return value
  197. } D3D8_WAITFORVERTICALBLANKDATA, * PD3D8_WAITFORVERTICALBLANKDATA;
  198. typedef struct _D3D8_SETMODEDATA
  199. {
  200. HANDLE hDD; // driver struct
  201. DWORD dwWidth;
  202. DWORD dwHeight;
  203. D3DFORMAT Format;
  204. DWORD dwRefreshRate;
  205. BOOL bRestore;
  206. HRESULT ddRVal; // return value
  207. } D3D8_SETMODEDATA, * PD3D8_SETMODEDATA;
  208. typedef struct _D3D8_GETSCANLINEDATA
  209. {
  210. HANDLE hDD; // driver struct
  211. DWORD dwScanLine; // returned scan line
  212. BOOL bInVerticalBlank;
  213. HRESULT ddRVal; // return value
  214. } D3D8_GETSCANLINEDATA, * PD3D8_GETSCANLINEDATA;
  215. typedef struct _D3D8_SETEXCLUSIVEMODEDATA
  216. {
  217. HANDLE hDD; // driver struct
  218. DWORD dwEnterExcl; // TRUE if entering exclusive mode, FALSE is leaving
  219. HRESULT ddRVal; // return value
  220. } D3D8_SETEXCLUSIVEMODEDATA, * PD3D8_SETEXCLUSIVEMODEDATA;
  221. typedef struct _D3D8_FLIPTOGDISURFACEDATA
  222. {
  223. HANDLE hDD; // driver struct
  224. DWORD dwToGDI; // TRUE if flipping to the GDI surface, FALSE if flipping away
  225. HRESULT ddRVal; // return value
  226. } D3D8_FLIPTOGDISURFACEDATA, * PD3D8_FLIPTOGDISURFACEDATA;
  227. typedef struct _D3D8_SETCOLORKEYDATA
  228. {
  229. HANDLE hDD;
  230. HANDLE hSurface;
  231. DWORD ColorValue;
  232. HRESULT ddRVal;
  233. } D3D8_SETCOLORKEYDATA, * PD3D8_SETCOLORKEYDATA;
  234. typedef struct _D3D8_GETAVAILDRIVERMEMORYDATA
  235. {
  236. HANDLE hDD; // driver struct
  237. D3DPOOL Pool; // Pool they are interested in
  238. DWORD dwUsage; // What the pool is used for
  239. DWORD dwFree; // free memory for this kind of surface
  240. HRESULT ddRVal; // return value
  241. } D3D8_GETAVAILDRIVERMEMORYDATA, * PD3D8_GETAVAILDRIVERMEMORYDATA;
  242. typedef struct _D3D8_GETDRIVERSTATEDATA
  243. {
  244. DWORD dwFlags; // Flags to indicate the data
  245. // required
  246. ULONG_PTR dwhContext; // d3d context
  247. LPDWORD lpdwStates; // ptr to the state data
  248. // to be filled in by the
  249. // driver
  250. DWORD dwLength;
  251. HRESULT ddRVal; // return value
  252. } D3D8_GETDRIVERSTATEDATA, * PD3D8_GETDRIVERSTATEDATA;
  253. typedef struct _D3D8_DESTROYDDLOCALDATA
  254. {
  255. DWORD dwFlags;
  256. HANDLE hDD;
  257. HRESULT ddRVal;
  258. } D3D8_DESTROYDDLOCALDATA, * PD3D8_DESTROYDDLOCALDATA;
  259. typedef struct _D3D8_CONTEXTCREATEDATA
  260. {
  261. HANDLE hDD; // in: Driver struct
  262. HANDLE hSurface; // in: Surface to be used as target
  263. HANDLE hDDSZ; // in: Surface to be used as Z
  264. DWORD dwPID; // in: Current process id
  265. ULONG_PTR dwhContext; // in/out: Context handle
  266. HRESULT ddrval;
  267. // Private buffer information. To make it similar to
  268. // D3DNTHAL_CONTEXTCREATEI
  269. PVOID pvBuffer;
  270. ULONG cjBuffer;
  271. } D3D8_CONTEXTCREATEDATA, * PD3D8_CONTEXTCREATEDATA;
  272. typedef struct _D3D8_CONTEXTDESTROYDATA
  273. {
  274. ULONG_PTR dwhContext; // in: Context handle
  275. HRESULT ddrval; // out: Return value
  276. } D3D8_CONTEXTDESTROYDATA, * PD3D8_CONTEXTDESTROYDATA;
  277. typedef struct _D3D8_CONTEXTDESTROYALLDATA
  278. {
  279. DWORD dwPID; // in: Process id to destroy contexts for
  280. HRESULT ddrval; // out: Return value
  281. } D3D8_CONTEXTDESTROYALLDATA, * PD3D8_CONTEXTDESTROYALLDATA;
  282. typedef struct _D3D8_RENDERSTATEDATA
  283. {
  284. ULONG_PTR dwhContext; // in: Context handle
  285. DWORD dwOffset; // in: Where to find states in buffer
  286. DWORD dwCount; // in: How many states to process
  287. HANDLE hExeBuf; // in: Execute buffer containing data
  288. HRESULT ddrval; // out: Return value
  289. } D3D8_RENDERSTATEDATA, *PD3D8_RENDERSTATEDATA;
  290. typedef struct _D3D8_RENDERPRIMITIVEDATA
  291. {
  292. ULONG_PTR dwhContext; // in: Context handle
  293. DWORD dwOffset; // in: Where to find primitive data in buffer
  294. DWORD dwStatus; // in/out: Condition branch status
  295. HANDLE hExeBuf; // in: Execute buffer containing data
  296. DWORD dwTLOffset; // in: Byte offset in lpTLBuf for start of vertex data
  297. HANDLE hTLBuf; // in: Execute buffer containing TLVertex data
  298. D3DINSTRUCTION diInstruction; // in: Primitive instruction
  299. HRESULT ddrval; // out: Return value
  300. } D3D8_RENDERPRIMITIVEDATA, *PD3D8_RENDERPRIMITIVEDATA;
  301. typedef struct _D3D8_DRAWPRIMITIVES2DATA
  302. {
  303. ULONG_PTR dwhContext; // in: Context handle
  304. DWORD dwFlags; // in: flags
  305. DWORD dwVertexType; // in: vertex type
  306. HANDLE hDDCommands; // in: vertex buffer command data
  307. DWORD dwCommandOffset; // in: offset to start of vertex buffer commands
  308. DWORD dwCommandLength; // in: number of bytes of command data
  309. union
  310. { // based on D3DHALDP2_USERMEMVERTICES flag
  311. HANDLE hDDVertex; // in: surface containing vertex data
  312. LPVOID lpVertices; // in: User mode pointer to vertices
  313. };
  314. DWORD dwVertexOffset; // in: offset to start of vertex data
  315. DWORD dwVertexLength; // in: number of vertices of vertex data
  316. DWORD dwReqVertexBufSize; // in: number of bytes required for the next vertex buffer
  317. DWORD dwReqCommandBufSize; // in: number of bytes required for the next commnand buffer
  318. LPDWORD lpdwRStates; // in: Pointer to the array where render states are updated
  319. union
  320. {
  321. DWORD dwVertexSize; // in: Size of each vertex in bytes
  322. HRESULT ddrval; // out: return value
  323. };
  324. DWORD dwErrorOffset; // out: offset in lpDDCommands to first D3DHAL_COMMAND not handled
  325. // Private data for the thunk
  326. ULONG_PTR fpVidMem_CB; // out: fpVidMem for the command buffer
  327. DWORD dwLinearSize_CB; // out: dwLinearSize for the command buffer
  328. ULONG_PTR fpVidMem_VB; // out: fpVidMem for the vertex buffer
  329. DWORD dwLinearSize_VB; // out: dwLinearSize for the vertex buffer
  330. } D3D8_DRAWPRIMITIVES2DATA, *PD3D8_DRAWPRIMITIVES2DATA;
  331. typedef struct _D3D8_VALIDATETEXTURESTAGESTATEDATA
  332. {
  333. ULONG_PTR dwhContext; // in: Context handle
  334. DWORD dwFlags; // in: Flags, currently set to 0
  335. ULONG_PTR dwReserved; //
  336. DWORD dwNumPasses; // out: Number of passes the hardware
  337. // can perform the operation in
  338. HRESULT ddrval; // out: return value
  339. } D3D8_VALIDATETEXTURESTAGESTATEDATA, * PD3D8_VALIDATETEXTURESTAGESTATEDATA;
  340. typedef struct _D3D8_SCENECAPTUREDATA
  341. {
  342. ULONG_PTR dwhContext; // in: Context handle
  343. DWORD dwFlag; // in: Indicates beginning or end
  344. HRESULT ddrval; // out: Return value
  345. } D3D8_SCENECAPTUREDATA, * PD3D8_SCENECAPTUREDATA;
  346. typedef struct _D3D8_CLEAR2DATA
  347. {
  348. ULONG_PTR dwhContext; // in: Context handle
  349. // dwFlags can contain D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, and/or D3DCLEAR_STENCIL
  350. DWORD dwFlags; // in: surfaces to clear
  351. DWORD dwFillColor; // in: Color value for rtarget
  352. D3DVALUE dvFillDepth; // in: Depth value for Z buffer (0.0-1.0)
  353. DWORD dwFillStencil; // in: value used to clear stencil buffer
  354. LPD3DRECT lpRects; // in: Rectangles to clear
  355. DWORD dwNumRects; // in: Number of rectangles
  356. HRESULT ddrval; // out: Return value
  357. // This is extra stuff passed down to the thunk layer for emulation
  358. // of Clear for those drivers (DX6) that cant do it themselves.
  359. HANDLE hDDS; // in: render target
  360. HANDLE hDDSZ; // in: Z buffer
  361. } D3D8_CLEAR2DATA, * PD3D8_CLEAR2DATA;
  362. typedef struct _D3D8_CLEARDATA
  363. {
  364. ULONG_PTR dwhContext; // in: Context handle
  365. // dwFlags can contain D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER
  366. DWORD dwFlags; // in: surfaces to clear
  367. DWORD dwFillColor; // in: Color value for rtarget
  368. DWORD dwFillDepth; // in: Depth value for Z buffer
  369. LPD3DRECT lpRects; // in: Rectangles to clear
  370. DWORD dwNumRects; // in: Number of rectangles
  371. HRESULT ddrval; // out: Return value
  372. } D3D8_CLEARDATA, * PD3D8_CLEARDATA;
  373. typedef struct _D3D8_SETRENDERTARGETDATA
  374. {
  375. ULONG_PTR dwhContext; // in: Context handle
  376. HANDLE hDDS; // in: new render target
  377. HANDLE hDDSZ; // in: new Z buffer
  378. HRESULT ddrval; // out: Return value
  379. BOOL bNeedUpdate;// out: Does runtime need to update
  380. // driver state.
  381. } D3D8_SETRENDERTARGETDATA, * PD3D8_SETRENDERTARGETDATA;
  382. typedef struct _D3D8_SETPALETTEDATA
  383. {
  384. HANDLE hDD; // in: Driver struct
  385. HANDLE hSurface; // in: Surface to be used as target
  386. DWORD Palette; // in: Palette identifier
  387. HRESULT ddRVal; // out: Return value
  388. } D3D8_SETPALETTEDATA, * PD3D8_SETPALETTEDATA;
  389. typedef struct _D3D8_UPDATEPALETTEDATA
  390. {
  391. HANDLE hDD; // in: Driver struct
  392. DWORD Palette; // in: Palette identifier
  393. LPPALETTEENTRY ColorTable; // in: 256 entry color table
  394. HRESULT ddRVal; // out: Return value
  395. } D3D8_UPDATEPALETTEDATA, * PD3D8_UPDATEPALETTEDATA;
  396. //
  397. // Driver callback table
  398. //
  399. DEFINE_GUID( GUID_D3D8Callbacks, 0xb497a1f3, 0x46cc, 0x4fc7, 0xb4, 0xf2, 0x32, 0xd8, 0x9e, 0xf9, 0xcc, 0x27);
  400. typedef HRESULT (FAR PASCAL *PD3D8DDI_CREATESURFACE)(PD3D8_CREATESURFACEDATA);
  401. typedef HRESULT (FAR PASCAL *PD3D8DDI_DESTROYSURFACE)(PD3D8_DESTROYSURFACEDATA);
  402. typedef HRESULT (FAR PASCAL *PD3D8DDI_LOCK)(PD3D8_LOCKDATA);
  403. typedef HRESULT (FAR PASCAL *PD3D8DDI_UNLOCK)(PD3D8_UNLOCKDATA);
  404. typedef DWORD (FAR PASCAL *PD3D8DDI_CONTEXTCREATE)(PD3D8_CONTEXTCREATEDATA);
  405. typedef DWORD (FAR PASCAL *PD3D8DDI_CONTEXTDESTROY)(PD3D8_CONTEXTDESTROYDATA);
  406. typedef DWORD (FAR PASCAL *PD3D8DDI_CONTEXTDESTROYALL)(PD3D8_CONTEXTDESTROYALLDATA);
  407. typedef DWORD (FAR PASCAL *PD3D8DDI_RENDERSTATE) (PD3D8_RENDERSTATEDATA);
  408. typedef DWORD (FAR PASCAL *PD3D8DDI_RENDERPRIMITIVE) (PD3D8_RENDERPRIMITIVEDATA);
  409. typedef DWORD (FAR PASCAL *PD3D8DDI_DRAWPRIM2)(PD3D8_DRAWPRIMITIVES2DATA);
  410. typedef DWORD (FAR PASCAL *PD3D8DDI_GETDRIVERSTATE)(PD3D8_GETDRIVERSTATEDATA);
  411. typedef DWORD (FAR PASCAL *PD3D8DDI_VALIDATETEXTURESTAGESTATE)(PD3D8_VALIDATETEXTURESTAGESTATEDATA);
  412. typedef DWORD (FAR PASCAL *PD3D8DDI_SCENECAPTURE)(PD3D8_SCENECAPTUREDATA);
  413. typedef DWORD (FAR PASCAL *PD3D8DDI_CLEAR2)(PD3D8_CLEAR2DATA);
  414. typedef DWORD (FAR PASCAL *PD3D8DDI_BLT)(PD3D8_BLTDATA);
  415. typedef DWORD (FAR PASCAL *PD3D8DDI_GETSCANLINE)(PD3D8_GETSCANLINEDATA);
  416. typedef DWORD (FAR PASCAL *PD3D8DDI_WAITFORVERTICALBLANK)(PD3D8_WAITFORVERTICALBLANKDATA);
  417. typedef DWORD (FAR PASCAL *PD3D8DDI_FLIP)(PD3D8_FLIPDATA);
  418. typedef DWORD (FAR PASCAL *PD3D8DDI_GETBLTSTATUS)(PD3D8_GETBLTSTATUSDATA);
  419. typedef DWORD (FAR PASCAL *PD3D8DDI_GETFLIPSTATUS)(PD3D8_GETFLIPSTATUSDATA);
  420. typedef DWORD (FAR PASCAL *PD3D8DDI_GETAVAILDRIVERMEMORY)(PD3D8_GETAVAILDRIVERMEMORYDATA);
  421. typedef DWORD (FAR PASCAL *PD3D8DDI_SETMODE)(PD3D8_SETMODEDATA);
  422. typedef DWORD (FAR PASCAL *PD3D8DDI_FLIPTOGDISURFACE)(PD3D8_FLIPTOGDISURFACEDATA);
  423. typedef DWORD (FAR PASCAL *PD3D8DDI_SETCOLORKEY)(PD3D8_SETCOLORKEYDATA);
  424. typedef DWORD (FAR PASCAL *PD3D8DDI_SETEXCLUSIVEMODE)(PD3D8_SETEXCLUSIVEMODEDATA);
  425. typedef DWORD (FAR PASCAL *PD3D8DDI_DESTROYDDLOCAL)(PD3D8_DESTROYDDLOCALDATA);
  426. typedef DWORD (FAR PASCAL *PD3D8DDI_SETRENDERTARGET)(PD3D8_SETRENDERTARGETDATA);
  427. typedef DWORD (FAR PASCAL *PD3D8DDI_CLEAR)(PD3D8_CLEARDATA);
  428. typedef DWORD (FAR PASCAL *PD3D8DDI_SETPALETTE)(PD3D8_SETPALETTEDATA);
  429. typedef DWORD (FAR PASCAL *PD3D8DDI_UPDATEPALETTE)(PD3D8_UPDATEPALETTEDATA);
  430. typedef struct _D3D8_CALLBACKS
  431. {
  432. PD3D8DDI_CREATESURFACE CreateSurface;
  433. PD3D8DDI_DESTROYSURFACE DestroySurface;
  434. PD3D8DDI_LOCK Lock;
  435. PD3D8DDI_UNLOCK Unlock;
  436. PD3D8DDI_CONTEXTCREATE CreateContext;
  437. PD3D8DDI_CONTEXTDESTROY ContextDestroy;
  438. PD3D8DDI_CONTEXTDESTROYALL ContextDestroyAll;
  439. PD3D8DDI_RENDERSTATE RenderState;
  440. PD3D8DDI_RENDERPRIMITIVE RenderPrimitive;
  441. PD3D8DDI_DRAWPRIM2 DrawPrimitives2;
  442. PD3D8DDI_GETDRIVERSTATE GetDriverState;
  443. PD3D8DDI_VALIDATETEXTURESTAGESTATE ValidateTextureStageState;
  444. PD3D8DDI_SCENECAPTURE SceneCapture;
  445. PD3D8DDI_CLEAR2 Clear2;
  446. PD3D8DDI_BLT Blt;
  447. PD3D8DDI_GETSCANLINE GetScanLine;
  448. PD3D8DDI_WAITFORVERTICALBLANK WaitForVerticalBlank;
  449. PD3D8DDI_FLIP Flip;
  450. PD3D8DDI_GETBLTSTATUS GetBltStatus;
  451. PD3D8DDI_GETFLIPSTATUS GetFlipStatus;
  452. PD3D8DDI_GETAVAILDRIVERMEMORY GetAvailDriverMemory;
  453. PD3D8DDI_GETBLTSTATUS GetSysmemBltStatus;
  454. PD3D8DDI_SETMODE SetMode;
  455. PD3D8DDI_SETEXCLUSIVEMODE SetExclusiveMode;
  456. PD3D8DDI_FLIPTOGDISURFACE FlipToGDISurface;
  457. PD3D8DDI_SETCOLORKEY SetColorkey;
  458. PD3D8DDI_DESTROYDDLOCAL DestroyDDLocal;
  459. PD3D8DDI_SETRENDERTARGET SetRenderTarget;
  460. PD3D8DDI_CLEAR Clear;
  461. PD3D8DDI_SETPALETTE SetPalette;
  462. PD3D8DDI_UPDATEPALETTE UpdatePalette;
  463. LPVOID Reserved1; // For device alignment
  464. LPVOID Reserved2; // For device alignment
  465. } D3D8_CALLBACKS, * PD3D8_CALLBACKS;
  466. //
  467. // D3D8xxx function prototypes to replace the NT Ddxxxx prototypes from GDI32.
  468. // On NT, these are internal functions, but on Win9X DDRAW.DLL must export
  469. // them, so we will change the export names
  470. //
  471. #ifdef WIN95
  472. #define D3D8CreateDirectDrawObject DdEntry1
  473. #define D3D8QueryDirectDrawObject DdEntry2
  474. #define D3D8DeleteDirectDrawObject DdEntry3
  475. #define D3D8GetDC DdEntry4
  476. #define D3D8ReleaseDC DdEntry5
  477. #define D3D8ReenableDirectDrawObject DdEntry6
  478. #define D3D8SetGammaRamp DdEntry7
  479. #define D3D8BuildModeTable DdEntry8
  480. #define D3D8IsDeviceLost DdEntry9
  481. #define D3D8CanRestoreNow DdEntry10
  482. #define D3D8RestoreDevice DdEntry11
  483. #define D3D8DoVidmemSurfacesExist DdEntry12
  484. #define D3D8SetMode DdEntry13
  485. #define D3D8BeginProfile DdEntry14
  486. #define D3D8EndProfile DdEntry15
  487. #define D3D8GetMode DdEntry16
  488. #define D3D8SetCooperativeLevel DdEntry17
  489. #define D3D8IsDummySurface DdEntry18
  490. #define D3D8LoseDevice DdEntry19
  491. #define D3D8GetHALName DdEntry20
  492. #endif
  493. #ifdef __cplusplus
  494. extern "C" {
  495. #endif
  496. #ifdef WIN95
  497. VOID APIENTRY D3D8CreateDirectDrawObject(
  498. LPGUID pGuid,
  499. char* szDeviceName,
  500. HANDLE* phDD,
  501. D3DDEVTYPE Type,
  502. HINSTANCE* phLibrary,
  503. VOID* pInitFunction
  504. );
  505. #else
  506. VOID APIENTRY D3D8CreateDirectDrawObject(
  507. HDC hdc,
  508. char* szDeviceName,
  509. HANDLE* phDD,
  510. D3DDEVTYPE Type,
  511. HINSTANCE* phLibrary,
  512. VOID* pInitFunction
  513. );
  514. #endif
  515. BOOL APIENTRY D3D8QueryDirectDrawObject(
  516. HANDLE hDD,
  517. PD3D8_DRIVERCAPS DriverCaps,
  518. PD3D8_CALLBACKS Callbacks,
  519. char* DeviceName,
  520. HINSTANCE hLibrary,
  521. D3D8_GLOBALDRIVERDATA* pGblDriverData,
  522. D3DHAL_D3DEXTENDEDCAPS* pExtendedCaps,
  523. LPDDSURFACEDESC pTextureFormats,
  524. LPDDPIXELFORMAT pZStencilFormats,
  525. UINT* pcTextureFormats,
  526. UINT* pcZStencilFormats
  527. );
  528. HDC APIENTRY D3D8GetDC(
  529. HANDLE hSurface,
  530. LPPALETTEENTRY pPalette
  531. );
  532. BOOL APIENTRY D3D8ReleaseDC(
  533. HANDLE hSurface,
  534. HDC hdc
  535. );
  536. BOOL APIENTRY D3D8ReenableDirectDrawObject(
  537. HANDLE hDD,
  538. BOOL* pbNewMode
  539. );
  540. BOOL APIENTRY D3D8SetGammaRamp(
  541. HANDLE hDD,
  542. HDC hdc,
  543. LPVOID lpGammaRamp
  544. );
  545. VOID APIENTRY D3D8BuildModeTable(
  546. char* pDeviceName,
  547. D3DDISPLAYMODE* pModeTable,
  548. DWORD* pNumEntries,
  549. D3DFORMAT Unknown16,
  550. HANDLE hProfile,
  551. BOOL b16bppSupported,
  552. BOOL b32bppSupported
  553. );
  554. BOOL APIENTRY D3D8IsDeviceLost(
  555. HANDLE hDD
  556. );
  557. BOOL APIENTRY D3D8CanRestoreNow(
  558. HANDLE hDD
  559. );
  560. VOID APIENTRY D3D8RestoreDevice(
  561. HANDLE hDD
  562. );
  563. BOOL APIENTRY D3D8DoVidmemSurfacesExist(
  564. HANDLE hDD
  565. );
  566. VOID APIENTRY D3D8DeleteDirectDrawObject(
  567. HANDLE hDD
  568. );
  569. HANDLE APIENTRY D3D8BeginProfile(
  570. char* pDeviceName
  571. );
  572. VOID APIENTRY D3D8EndProfile(
  573. HANDLE Handle
  574. );
  575. DWORD APIENTRY D3D8GetMode(
  576. HANDLE Handle,
  577. char* pDeviceName,
  578. D3DDISPLAYMODE* pMode,
  579. D3DFORMAT Unknown16
  580. );
  581. DWORD APIENTRY D3D8SetMode(
  582. HANDLE Handle,
  583. char* pDeviceName,
  584. UINT Width,
  585. UINT Height,
  586. UINT BPP,
  587. UINT RefreshRate,
  588. BOOL bRestore
  589. );
  590. DWORD APIENTRY D3D8SetCooperativeLevel(
  591. HANDLE hDD,
  592. HWND hWnd,
  593. DWORD dwFlags );
  594. VOID APIENTRY D3D8LoseDevice(
  595. HANDLE hDD);
  596. __inline DWORD D3D8GetDrawPrimHandle(HANDLE hSurface)
  597. {
  598. return *(DWORD *)(hSurface);
  599. }
  600. BOOL APIENTRY D3D8IsDummySurface(
  601. HANDLE hSurface );
  602. VOID APIENTRY D3D8GetHALName(
  603. char* pDisplayName,
  604. char *pDriverName );
  605. #ifdef __cplusplus
  606. }
  607. #endif
  608. typedef struct _D3D8_DEVICEDATA
  609. {
  610. D3D8_DRIVERCAPS DriverData;
  611. D3D8_CALLBACKS Callbacks;
  612. DWORD dwFlags;
  613. char DriverName[MAX_DRIVER_NAME];
  614. // RECT DeviceRect;
  615. HDC hDC;
  616. GUID Guid;
  617. HANDLE hDD;
  618. D3DDEVTYPE DeviceType;
  619. HINSTANCE hLibrary;
  620. struct _D3D8_DEVICEDATA* pLink;
  621. // D3DDISPLAYMODE* pModeTable;
  622. // DWORD dwNumModes;
  623. } D3D8_DEVICEDATA, * PD3D8_DEVICEDATA;
  624. #define DD_DISPLAYDRV 0x00000001
  625. #define DD_GDIDRV 0x00000002
  626. #endif