Source code of Windows XP (NT5)
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.

261 lines
10 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: mcd.h
  3. *
  4. * Common data structures for MCD driver interface.
  5. *
  6. * Copyright (c) 1996 Microsoft Corporation
  7. *
  8. \**************************************************************************/
  9. #ifndef _MCD_H
  10. #define _MCD_H
  11. //
  12. // Maximum MCD scanline size assumed by OpenGL generic implementation.
  13. //
  14. #define MCD_MAX_SCANLINE 4096
  15. #define MCD_MEM_READY 0x0001
  16. #define MCD_MEM_BUSY 0x0002
  17. #define MCD_MEM_INVALID 0x0003
  18. #define MCD_MAXMIPMAPLEVEL 12
  19. typedef struct _MCDCONTEXT {
  20. HDC hdc;
  21. MCDHANDLE hMCDContext;
  22. LONG ipfd;
  23. LONG iLayer;
  24. ULONG_PTR dwMcdWindow;
  25. } MCDCONTEXT;
  26. typedef struct _MCDRCINFOPRIV {
  27. MCDRCINFO mri;
  28. ULONG_PTR dwMcdWindow;
  29. } MCDRCINFOPRIV;
  30. typedef struct _GENMCDSWAP
  31. {
  32. struct GLGENwindowRec *pwnd;
  33. WGLSWAP *pwswap;
  34. } GENMCDSWAP;
  35. typedef struct _GENMCDSTATE_ GENMCDSTATE;
  36. //
  37. // Shared memory allocated/freed via MCDAlloc and MCDFree, respectively.
  38. //
  39. typedef struct _GENMCDBUF_ {
  40. PVOID pv;
  41. ULONG size;
  42. HANDLE hmem;
  43. } GENMCDBUF;
  44. //
  45. // The GENMCDSURFACE retains information about the state of the MCD buffers
  46. // or surface. It exists per-WNDOBJ (window).
  47. //
  48. typedef struct _GENMCDSURFACE_ {
  49. GENMCDBUF McdColorBuf; // Color and depth span buffers used to
  50. GENMCDBUF McdDepthBuf; // read/write MCD buffers if not directly
  51. // accessible.
  52. ULONG *pDepthSpan; // Interchange buffer to present z-span in
  53. // generic format. If McdDepthBuf is 32-bit,
  54. // then this points to it (reformatted in
  55. // place). If 16-bit, then the interchange
  56. // buffer is allocated separately.
  57. ULONG depthBitMask;
  58. struct GLGENwindowRec *pwnd; // WNDOBJ this surface is bound to.
  59. } GENMCDSURFACE;
  60. //
  61. // The GENMCDSTATE retains information about the state of the MCD context.
  62. // It exists per-context.
  63. //
  64. typedef struct _GENMCDSTATE_ {
  65. MCDCONTEXT McdContext; // Created via MCDCreateContext.
  66. // NOTE: This must be the first field.
  67. GENMCDSURFACE *pMcdSurf; // pointer to MCD surface
  68. GENMCDBUF *pMcdPrimBatch; // Current shared memory window for batching
  69. // primitives
  70. GENMCDBUF McdCmdBatch; // Used to pass state to MCD driver.
  71. ULONG mcdDirtyState; // Set of flags that tracks when MCD state
  72. // is out of sync (i.e., "dirty") with respect
  73. // to generic state.
  74. ULONG *pDepthSpan; // Cached copy of the one in GENMCDSURFACE.
  75. // Fallback z-test span function.
  76. void *softZSpanFuncPtr;
  77. GENMCDBUF McdBuf1; // If using DMA, we swap pMcdPrimBatch
  78. GENMCDBUF McdBuf2; // between these two buffers. Otherwise,
  79. // only McdBuf1 is initialized.
  80. MCDRCINFO McdRcInfo; // Cache a copy of the MCD RC info structure.
  81. MCDRECTBUFFERS McdBuffers; // Describes accessibility of MCD buffers.
  82. ULONG mcdFlags; // Misc. other state flags.
  83. MCDPIXELFORMAT McdPixelFmt; // Cache a copy of the MCD pixel format.
  84. HANDLE hDdColor; // Kernel-mode handles for DirectDraw
  85. HANDLE hDdDepth;
  86. } GENMCDSTATE;
  87. //
  88. // Misc. flags for GENMCDSTATE.mcdFlags:
  89. //
  90. #define MCD_STATE_FORCEPICK 0x00000001
  91. #define MCD_STATE_FORCERESIZE 0x00000002
  92. //
  93. // Dirty state flags for GENMCDSTATE.mcdDirtyState:
  94. //
  95. #define MCD_DIRTY_ENABLES 0x00000001
  96. #define MCD_DIRTY_TEXTURE 0x00000002
  97. #define MCD_DIRTY_FOG 0x00000004
  98. #define MCD_DIRTY_SHADEMODEL 0x00000008
  99. #define MCD_DIRTY_POINTDRAW 0x00000010
  100. #define MCD_DIRTY_LINEDRAW 0x00000020
  101. #define MCD_DIRTY_POLYDRAW 0x00000040
  102. #define MCD_DIRTY_ALPHATEST 0x00000080
  103. #define MCD_DIRTY_DEPTHTEST 0x00000100
  104. #define MCD_DIRTY_BLEND 0x00000200
  105. #define MCD_DIRTY_LOGICOP 0x00000400
  106. #define MCD_DIRTY_FBUFCTRL 0x00000800
  107. #define MCD_DIRTY_LIGHTMODEL 0x00001000
  108. #define MCD_DIRTY_HINTS 0x00002000
  109. #define MCD_DIRTY_VIEWPORT 0x00004000
  110. #define MCD_DIRTY_SCISSOR 0x00008000
  111. #define MCD_DIRTY_CLIPCTRL 0x00010000
  112. #define MCD_DIRTY_STENCILTEST 0x00020000
  113. #define MCD_DIRTY_PIXELSTATE 0x00040000
  114. #define MCD_DIRTY_TEXENV 0x00080000
  115. #define MCD_DIRTY_TEXTRANSFORM 0x00100000
  116. #define MCD_DIRTY_TEXGEN 0x00200000
  117. #define MCD_DIRTY_MATERIAL 0x00400000
  118. #define MCD_DIRTY_LIGHTS 0x00800000
  119. #define MCD_DIRTY_COLORMATERIAL 0x01000000
  120. #define MCD_DIRTY_RENDERSTATE 0x0003ffff
  121. #define MCD_DIRTY_ALL 0x01ffffff
  122. // Internal driver information structure
  123. typedef struct _MCDDRIVERINFOI {
  124. MCDDRIVERINFO mcdDriverInfo;
  125. MCDDRIVER mcdDriver;
  126. } MCDDRIVERINFOI;
  127. //
  128. // Return values for MCDLock.
  129. // Zero must be used for the system error because it may be returned
  130. // from ExtEscape if the system is unable to make the escape call.
  131. //
  132. #define MCD_LOCK_SYSTEM_ERROR 0
  133. #define MCD_LOCK_BUSY 1
  134. #define MCD_LOCK_TAKEN 2
  135. BOOL APIENTRY MCDGetDriverInfo(HDC hdc, struct _MCDDRIVERINFOI *pMCDDriverInfo);
  136. LONG APIENTRY MCDDescribeMcdPixelFormat(HDC hdc, LONG iPixelFormat,
  137. MCDPIXELFORMAT *pMcdPixelFmt);
  138. LONG APIENTRY MCDDescribePixelFormat(HDC hdc, LONG iPixelFormat,
  139. LPPIXELFORMATDESCRIPTOR ppfd);
  140. BOOL APIENTRY MCDCreateContext(MCDCONTEXT *pMCDContext,
  141. MCDRCINFOPRIV *pDrvRcInfo,
  142. struct _GLSURF *pgsurf,
  143. int ipfd,
  144. ULONG flags);
  145. BOOL APIENTRY MCDDeleteContext(MCDCONTEXT *pMCDContext);
  146. UCHAR * APIENTRY MCDAlloc(MCDCONTEXT *pMCDContext, ULONG numBytes, MCDHANDLE *pMCDHandle,
  147. ULONG flags);
  148. BOOL APIENTRY MCDFree(MCDCONTEXT *pMCDContext, VOID *pMCDMem);
  149. VOID APIENTRY MCDBeginState(MCDCONTEXT *pMCDContext, VOID *pMCDMem);
  150. BOOL APIENTRY MCDFlushState(VOID *pMCDMem);
  151. BOOL APIENTRY MCDAddState(VOID *pMCDMem, ULONG stateToChange,
  152. ULONG stateValue);
  153. BOOL APIENTRY MCDAddStateStruct(VOID *pMCDMem, ULONG stateToChange,
  154. VOID *pStateValue, ULONG stateValueSize);
  155. BOOL APIENTRY MCDSetViewport(MCDCONTEXT *pMCDContext, VOID *pMCDMem,
  156. MCDVIEWPORT *pMCDViewport);
  157. BOOL APIENTRY MCDSetScissorRect(MCDCONTEXT *pMCDContext, RECTL *pRect,
  158. BOOL bEnabled);
  159. ULONG APIENTRY MCDQueryMemStatus(VOID *pMCDMem);
  160. PVOID APIENTRY MCDProcessBatch(MCDCONTEXT *pMCDContext, VOID *pMCDMem,
  161. ULONG batchSize, VOID *pMCDFirstCmd,
  162. int cExtraSurfaces,
  163. struct IDirectDrawSurface **pddsExtra);
  164. BOOL APIENTRY MCDReadSpan(MCDCONTEXT *pMCDContext, VOID *pMCDMem,
  165. ULONG x, ULONG y, ULONG numPixels, ULONG type);
  166. BOOL APIENTRY MCDWriteSpan(MCDCONTEXT *pMCDContext, VOID *pMCDMem,
  167. ULONG x, ULONG y, ULONG numPixels, ULONG type);
  168. BOOL APIENTRY MCDClear(MCDCONTEXT *pMCDContext, RECTL rect, ULONG buffers);
  169. BOOL APIENTRY MCDSwap(MCDCONTEXT *pMCDContext, ULONG flags);
  170. BOOL APIENTRY MCDGetBuffers(MCDCONTEXT *pMCDContext,
  171. MCDRECTBUFFERS *pMCDBuffers);
  172. BOOL APIENTRY MCDAllocBuffers(MCDCONTEXT *pMCDContext, RECTL *pWndRect);
  173. BOOL APIENTRY MCDBindContext(MCDCONTEXT *pMCDContext, HDC hdc,
  174. struct GLGENwindowRec *pwnd);
  175. BOOL APIENTRY MCDSync(MCDCONTEXT *pMCDContext);
  176. MCDHANDLE APIENTRY MCDCreateTexture(MCDCONTEXT *pMCDContext,
  177. MCDTEXTUREDATA *pTexData,
  178. ULONG flags,
  179. VOID *pSurface);
  180. BOOL APIENTRY MCDDeleteTexture(MCDCONTEXT *pMCDContext, MCDHANDLE hTex);
  181. BOOL APIENTRY MCDUpdateSubTexture(MCDCONTEXT *pMCDContext,
  182. MCDTEXTUREDATA *pTexData, MCDHANDLE hTex,
  183. ULONG lod, RECTL *pRect);
  184. BOOL APIENTRY MCDUpdateTexturePalette(MCDCONTEXT *pMCDContext,
  185. MCDTEXTUREDATA *pTexData, MCDHANDLE hTex,
  186. ULONG start, ULONG numEntries);
  187. BOOL APIENTRY MCDUpdateTexturePriority(MCDCONTEXT *pMCDContext,
  188. MCDTEXTUREDATA *pTexData,
  189. MCDHANDLE hTex);
  190. BOOL APIENTRY MCDUpdateTextureState(MCDCONTEXT *pMCDContext,
  191. MCDTEXTUREDATA *pTexData,
  192. MCDHANDLE hTex);
  193. ULONG APIENTRY MCDTextureStatus(MCDCONTEXT *pMCDContext, MCDHANDLE hTex);
  194. ULONG APIENTRY MCDTextureKey(MCDCONTEXT *pMCDContext, MCDHANDLE hTex);
  195. BOOL APIENTRY MCDDescribeMcdLayerPlane(HDC hdc, LONG iPixelFormat,
  196. LONG iLayerPlane,
  197. MCDLAYERPLANE *pMcdPixelFmt);
  198. BOOL APIENTRY MCDDescribeLayerPlane(HDC hdc, LONG iPixelFormat,
  199. LONG iLayerPlane,
  200. LPLAYERPLANEDESCRIPTOR ppfd);
  201. LONG APIENTRY MCDSetLayerPalette(HDC hdc, LONG iLayerPlane, BOOL bRealize,
  202. LONG cEntries, COLORREF *pcr);
  203. ULONG APIENTRY MCDDrawPixels(MCDCONTEXT *pMCDContext, ULONG width, ULONG height,
  204. ULONG format, ULONG type, VOID *pPixels, BOOL packed);
  205. ULONG APIENTRY MCDReadPixels(MCDCONTEXT *pMCDContext, LONG x, LONG y, ULONG width, ULONG height,
  206. ULONG format, ULONG type, VOID *pPixels);
  207. ULONG APIENTRY MCDCopyPixels(MCDCONTEXT *pMCDContext, LONG x, LONG y, ULONG width, ULONG height,
  208. ULONG type);
  209. ULONG APIENTRY MCDPixelMap(MCDCONTEXT *pMCDContext, ULONG mapType, ULONG mapSize,
  210. VOID *pMap);
  211. void APIENTRY MCDDestroyWindow(HDC hdc, ULONG_PTR dwMcdWindow);
  212. int APIENTRY MCDGetTextureFormats(MCDCONTEXT *pMCDContext, int nFmts,
  213. struct _DDSURFACEDESC *pddsd);
  214. ULONG APIENTRY MCDLock(MCDCONTEXT *pMCDContext);
  215. VOID APIENTRY MCDUnlock(MCDCONTEXT *pMCDContext);
  216. #ifdef MCD95
  217. typedef LPCRITICAL_SECTION (APIENTRY *MCDGETMCDCRITSECTFUNC)(void);
  218. #endif
  219. #endif