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.

1006 lines
32 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: mcdrv.h
  3. *
  4. * Server-side data structure for MCD driver interface. These structures and
  5. * values are used by the MCD driver to process calls made to the driver.
  6. *
  7. * Copyright (c) 1996-1997 Microsoft Corporation
  8. *
  9. \**************************************************************************/
  10. #ifndef _MCDRV_H
  11. #define _MCDRV_H
  12. //
  13. // The MCD version is defaulted to the most conservative version number.
  14. // Override these defines if you wish to compile a driver with different
  15. // version information.
  16. //
  17. #ifndef MCD_VER_MAJOR
  18. #define MCD_VER_MAJOR 1
  19. #endif
  20. #ifndef MCD_VER_MINOR
  21. #define MCD_VER_MINOR 0
  22. #endif
  23. #define MCD_MAX_USER_CLIP_PLANES 6
  24. #define MCDRV_MEM_BUSY 1
  25. #define MCDRV_MEM_NOT_BUSY 2
  26. typedef ENUMRECTS MCDENUMRECTS;
  27. typedef HANDLE MCDHANDLE;
  28. typedef float MCDFLOAT;
  29. typedef double MCDDOUBLE;
  30. #define MCDENGDLLNAME "MCDSRV32.DLL"
  31. #define MCDFUNCS 3076
  32. #define MCDRV_MEM_DMA 0x0001
  33. #define MCDRV_TEXTURE_RESIDENT 0x0001
  34. typedef struct _MCDRIVERINFO {
  35. ULONG verMajor;
  36. ULONG verMinor;
  37. ULONG verDriver;
  38. CHAR idStr[200];
  39. ULONG drvMemFlags;
  40. ULONG drvBatchMemSizeMax;
  41. } MCDDRIVERINFO;
  42. typedef struct _MCDWINDOW
  43. {
  44. RECTL clientRect; // Rectangle describing current window
  45. // client area
  46. RECTL clipBoundsRect; // Bounding rectangle for the individual
  47. // clipping rectangles
  48. MCDENUMRECTS *pClip; // List of rectangles describing the
  49. // current clip region intersected
  50. // with the current scissors rectangle
  51. MCDENUMRECTS *pClipUnscissored; // Unscissored version of above
  52. VOID *pvUser;
  53. } MCDWINDOW;
  54. // Rendering context
  55. // MCD context createFlags:
  56. //
  57. // MCDCONTEXT_SWAPSYNC If set, synchronize MCDrvSwap to VSYNC
  58. // for a tearless swap (if possible).
  59. //
  60. // MCDCONTEXT_IO_PRIORITY If set, allow OpenGL to have a higher priority
  61. // on the bus (if possible, let OpenGL "hog" the
  62. // bus).
  63. //
  64. #define MCDCONTEXT_SWAPSYNC 0x00000001
  65. #define MCDCONTEXT_IO_PRIORITY 0x00000002
  66. typedef struct _MCDRC
  67. {
  68. LONG iPixelFormat; // Pixel format for the RC
  69. LONG iLayerPlane; // Layer plane for the RC
  70. ULONG createFlags; // Creation flags
  71. ULONG userFlags; // User-specified flags
  72. VOID *pvUser; // User-specified pointer for expansion
  73. } MCDRC;
  74. #define MCDRCINFO_NOVIEWPORTADJUST 0x0001
  75. #define MCDRCINFO_Y_LOWER_LEFT 0x0002
  76. #define MCDRCINFO_DEVCOLORSCALE 0x0004
  77. #define MCDRCINFO_DEVZSCALE 0x0008
  78. // If set the system provides state updates
  79. // with fine-grained state updates rather
  80. // than through RENDERSTATE. This is
  81. // required if the driver exports
  82. // MCDrvProcess.
  83. #define MCDRCINFO_FINE_GRAINED_STATE 0x0010
  84. typedef struct _MCRCINFO
  85. {
  86. ULONG requestFlags;
  87. MCDFLOAT redScale;
  88. MCDFLOAT greenScale;
  89. MCDFLOAT blueScale;
  90. MCDFLOAT alphaScale;
  91. MCDDOUBLE zScale; // This is a double to preserve accuracy
  92. ULONG depthBufferMax;
  93. LONG viewportXAdjust;
  94. LONG viewportYAdjust;
  95. ULONG reserved[12];
  96. } MCDRCINFO;
  97. // MCD pixel format descriptor
  98. typedef struct _MCDPIXELFORMAT {
  99. WORD nSize;
  100. DWORD dwFlags; // Any combination of:
  101. //
  102. // PFD_DOUBLEBUFFER
  103. // PFD_NEED_PALETTE
  104. // PFD_NEED_SYSTEM_PALETTE
  105. // PFD_SWAP_EXCHANGE
  106. // PFD_SWAP_COPY
  107. // PFD_SWAP_LAYER_BUFFERS
  108. BYTE iPixelType; // One of the following:
  109. //
  110. // PFD_TYPE_RGBA
  111. // PFD_TYPE_COLORINDEX
  112. BYTE cColorBits;
  113. BYTE cRedBits;
  114. BYTE cRedShift;
  115. BYTE cGreenBits;
  116. BYTE cGreenShift;
  117. BYTE cBlueBits;
  118. BYTE cBlueShift;
  119. BYTE cAlphaBits;
  120. BYTE cAlphaShift;
  121. BYTE cDepthBits; // Number of significant depth bits
  122. BYTE cDepthShift;
  123. BYTE cDepthBufferBits; // Element size of depth buffer
  124. // (eg, a depth buffer with cDepthBits = 24
  125. // might have a cDepthBufferBits = 32)
  126. BYTE cStencilBits;
  127. BYTE cOverlayPlanes; // Count of up to 15 overlay planes
  128. BYTE cUnderlayPlanes; // Count of up to 15 underlay planes
  129. DWORD dwTransparentColor; // If there is an underlay plane, specifies
  130. // transparent color or index.
  131. } MCDPIXELFORMAT;
  132. // MCD layer plane descriptor
  133. typedef struct _MCDLAYERPLANE {
  134. WORD nSize;
  135. WORD nVersion;
  136. DWORD dwFlags; // Any combination of:
  137. //
  138. // LPD_SUPPORT_OPENGL
  139. // LPD_SUPPORT_GDI
  140. // LPD_DOUBLEBUFFER
  141. // LPD_STEREO
  142. // LPD_SWAP_EXCHANGE
  143. // LPD_SWAP_COPY
  144. // LPD_TRANSPARANT
  145. // LPD_SHARE_DEPTH
  146. // LPD_SHARE_STENCIL
  147. // LPD_SHARE_ACCUM
  148. BYTE iPixelType; // One of the following:
  149. //
  150. // LPD_TYPE_RGBA
  151. // LPD_TYPE_COLORINDEX
  152. BYTE cColorBits;
  153. BYTE cRedBits;
  154. BYTE cRedShift;
  155. BYTE cGreenBits;
  156. BYTE cGreenShift;
  157. BYTE cBlueBits;
  158. BYTE cBlueShift;
  159. BYTE cAlphaBits;
  160. BYTE cAlphaShift;
  161. BYTE cAuxBuffers;
  162. BYTE iLayerPlane;
  163. COLORREF crTransparent;
  164. } MCDLAYERPLANE;
  165. //
  166. // Basic rendering types:
  167. //
  168. typedef struct _MCDCOLOR {
  169. MCDFLOAT r, g, b, a;
  170. } MCDCOLOR;
  171. typedef struct _MCDCOORD {
  172. MCDFLOAT x, y, z, w;
  173. } MCDCOORD;
  174. //
  175. // Texture structures:
  176. //
  177. typedef struct __MCDMIPMAPLEVEL {
  178. UCHAR *pTexels; // pointer to client texture data
  179. LONG width, height;
  180. LONG widthImage, heightImage; // Image dimensions without the border
  181. MCDFLOAT widthImagef, heightImagef; // Floatin-point versions of above
  182. LONG widthLog2, heightLog2; // Log2 of above
  183. LONG border; // Border size
  184. LONG requestedFormat; // Requested internal format
  185. LONG baseFormat; // Base format
  186. LONG internalFormat; // Actual internal format
  187. LONG redSize; // Component resolution
  188. LONG greenSize;
  189. LONG blueSize;
  190. LONG alphaSize;
  191. LONG luminanceSize;
  192. LONG intensitySize;
  193. ULONG reserved;
  194. } MCDMIPMAPLEVEL;
  195. typedef struct __MCDTEXTURESTATE {
  196. ULONG sWrapMode; // Wrap modes
  197. ULONG tWrapMode;
  198. ULONG minFilter; // Min/mag filters
  199. ULONG magFilter;
  200. MCDCOLOR borderColor; // Border color
  201. } MCDTEXTURESTATE;
  202. typedef struct __MCDTEXTUREOBJSTATE {
  203. ULONG name; // "name" of texture object
  204. MCDFLOAT priority; // priority of the texture object
  205. } MCDTEXTUREOBJSTATE;
  206. typedef struct __MCDTEXTUREDATA {
  207. MCDTEXTURESTATE textureState;
  208. MCDTEXTUREOBJSTATE textureObjState;
  209. MCDMIPMAPLEVEL *level;
  210. ULONG textureDimension;
  211. // Support for texture palettes:
  212. ULONG paletteSize;
  213. RGBQUAD *paletteData;
  214. ULONG paletteBaseFormat; // Type of palette data
  215. ULONG paletteRequestedFormat;
  216. } MCDTEXTUREDATA;
  217. typedef struct _MCDTEXTURE {
  218. MCDTEXTUREDATA *pMCDTextureData;
  219. VOID *pSurface;
  220. ULONG createFlags;
  221. ULONG_PTR textureKey; // Must be filled in by the driver
  222. ULONG userFlags;
  223. VOID *pvUser;
  224. } MCDTEXTURE;
  225. //
  226. // Memory block.
  227. //
  228. typedef struct _MCDMEM {
  229. ULONG memSize;
  230. ULONG createFlags;
  231. UCHAR *pMemBase;
  232. ULONG userFlags;
  233. VOID *pvUser;
  234. } MCDMEM;
  235. //
  236. // Generic description prefix for any state change.
  237. //
  238. typedef struct _MCDSTATE_PREFIX {
  239. ULONG state;
  240. ULONG size;
  241. } MCDSTATE_PREFIX;
  242. typedef struct _MCDSTATE {
  243. ULONG state;
  244. ULONG size;
  245. ULONG stateValue;
  246. } MCDSTATE;
  247. #define MCD_RENDER_STATE 0
  248. #define MCD_PIXEL_STATE 1
  249. #define MCD_SCISSOR_RECT_STATE 2
  250. #define MCD_TEXENV_STATE 3
  251. #define MCD_ENABLE_STATE 4
  252. #define MCD_TEXTURE_ENABLE_STATE 5
  253. #define MCD_FOG_STATE 6
  254. #define MCD_SHADEMODEL_STATE 7
  255. #define MCD_POINTDRAW_STATE 8
  256. #define MCD_LINEDRAW_STATE 9
  257. #define MCD_POLYDRAW_STATE 10
  258. #define MCD_ALPHATEST_STATE 11
  259. #define MCD_DEPTHTEST_STATE 12
  260. #define MCD_BLEND_STATE 13
  261. #define MCD_LOGICOP_STATE 14
  262. #define MCD_FRAMEBUF_STATE 15
  263. #define MCD_LIGHT_MODEL_STATE 16
  264. #define MCD_HINT_STATE 17
  265. #define MCD_CLIP_STATE 18
  266. #define MCD_STENCILTEST_STATE 19
  267. //
  268. // MCDSTATE_RENDER is derived from the MCDSTATE_PREFIX structure and is used
  269. // to pass all MCD rendering state (MCDRENDERSTATE) in a single command
  270. // via MCDrvState.
  271. //
  272. // State field names are derived from the GLenum constant names by removing
  273. // the GL_ prefix, replacing the "_" separators with case changes, and
  274. // adding the "Enable" suffix to state enables.
  275. //
  276. // For example:
  277. //
  278. // GL_FOG_COLOR becomes fogColor
  279. // GL_POINT_SMOOTH becomes pointSmoothEnable
  280. //
  281. // In addition, there are few multiple values that are accessed via a single
  282. // GLenum. For example, GL_POLYGON_MODE returns both a front and a back
  283. // polygon mode, so:
  284. //
  285. // GL_POLYGON_MODE becomes polygonModeFront *and* polygonModeBack
  286. //
  287. // Enable flags for enables field in MCDRENDERSTATE
  288. #define MCD_ALPHA_TEST_ENABLE (1 << 0)
  289. #define MCD_BLEND_ENABLE (1 << 1)
  290. #define MCD_INDEX_LOGIC_OP_ENABLE (1 << 2)
  291. #define MCD_DITHER_ENABLE (1 << 3)
  292. #define MCD_DEPTH_TEST_ENABLE (1 << 4)
  293. #define MCD_FOG_ENABLE (1 << 5)
  294. #define MCD_LIGHTING_ENABLE (1 << 6)
  295. #define MCD_COLOR_MATERIAL_ENABLE (1 << 7)
  296. #define MCD_LINE_STIPPLE_ENABLE (1 << 8)
  297. #define MCD_LINE_SMOOTH_ENABLE (1 << 9)
  298. #define MCD_POINT_SMOOTH_ENABLE (1 << 10)
  299. #define MCD_POLYGON_SMOOTH_ENABLE (1 << 11)
  300. #define MCD_CULL_FACE_ENABLE (1 << 12)
  301. #define MCD_POLYGON_STIPPLE_ENABLE (1 << 13)
  302. #define MCD_SCISSOR_TEST_ENABLE (1 << 14)
  303. #define MCD_STENCIL_TEST_ENABLE (1 << 15)
  304. #define MCD_TEXTURE_1D_ENABLE (1 << 16)
  305. #define MCD_TEXTURE_2D_ENABLE (1 << 17)
  306. #define MCD_TEXTURE_GEN_S_ENABLE (1 << 18)
  307. #define MCD_TEXTURE_GEN_T_ENABLE (1 << 19)
  308. #define MCD_TEXTURE_GEN_R_ENABLE (1 << 20)
  309. #define MCD_TEXTURE_GEN_Q_ENABLE (1 << 21)
  310. #define MCD_NORMALIZE_ENABLE (1 << 22)
  311. #define MCD_AUTO_NORMAL_ENABLE (1 << 23) // Not currently used
  312. #define MCD_POLYGON_OFFSET_POINT_ENABLE (1 << 24)
  313. #define MCD_POLYGON_OFFSET_LINE_ENABLE (1 << 25)
  314. #define MCD_POLYGON_OFFSET_FILL_ENABLE (1 << 26)
  315. #define MCD_COLOR_LOGIC_OP_ENABLE (1 << 27)
  316. #define MCD_SPECULAR_FOG_ENABLE (1 << 29)
  317. typedef struct _MCDRENDERSTATE {
  318. // state enables
  319. ULONG enables;
  320. // texture state
  321. BOOL textureEnabled;
  322. // fog state
  323. MCDCOLOR fogColor;
  324. MCDFLOAT fogIndex;
  325. MCDFLOAT fogDensity;
  326. MCDFLOAT fogStart;
  327. MCDFLOAT fogEnd;
  328. ULONG fogMode;
  329. // shading model state
  330. ULONG shadeModel;
  331. // point drawing state
  332. MCDFLOAT pointSize;
  333. // line drawing state
  334. MCDFLOAT lineWidth;
  335. USHORT lineStipplePattern;
  336. SHORT lineStippleRepeat;
  337. // polygon drawing state
  338. ULONG cullFaceMode;
  339. ULONG frontFace;
  340. ULONG polygonModeFront;
  341. ULONG polygonModeBack;
  342. BYTE polygonStipple[4*32];
  343. MCDFLOAT zOffsetFactor;
  344. MCDFLOAT zOffsetUnits;
  345. // stencil test state
  346. BOOL stencilTestFunc;
  347. USHORT stencilMask;
  348. USHORT stencilRef;
  349. ULONG stencilFail;
  350. ULONG stencilDepthFail;
  351. ULONG stencilDepthPass;
  352. // alpha test state
  353. ULONG alphaTestFunc;
  354. MCDFLOAT alphaTestRef;
  355. // depth test state
  356. ULONG depthTestFunc;
  357. // blend state
  358. ULONG blendSrc;
  359. ULONG blendDst;
  360. // logic op state
  361. ULONG logicOpMode;
  362. // frame buffer control state
  363. ULONG drawBuffer;
  364. ULONG indexWritemask;
  365. BOOL colorWritemask[4];
  366. BOOL depthWritemask; // Called mask, but really a write enable
  367. USHORT stencilWritemask;
  368. MCDCOLOR colorClearValue;
  369. MCDFLOAT indexClearValue;
  370. MCDDOUBLE depthClearValue;
  371. USHORT stencilClearValue;
  372. // lighting
  373. BOOL twoSided;
  374. // clipping control
  375. MCDCOORD userClipPlanes[MCD_MAX_USER_CLIP_PLANES];
  376. // hints
  377. ULONG perspectiveCorrectionHint;
  378. ULONG pointSmoothHint;
  379. ULONG lineSmoothHint;
  380. ULONG polygonSmoothHint;
  381. ULONG fogHint;
  382. } MCDRENDERSTATE;
  383. typedef struct _MCDSTATE_RENDER {
  384. ULONG state; // must be MCD_RENDER_STATE
  385. ULONG size; // must be sizeof(MCDSTATE_RENDER)
  386. MCDRENDERSTATE allState;
  387. } MCDSTATE_RENDER;
  388. //
  389. // MCDSTATEPIXEL is a variant of the MCDSTATE structure that is used
  390. // to pass all pixel state (MCDPIXELSTATE) in a single command
  391. // via MCDrvState.
  392. //
  393. // Note: for MCDrvDrawPixels, the MCDUNPACK structure can be overridden by
  394. // the packed parameter to the function. If set, the source of the data is
  395. // a display list and the structure of the data for that call may be assumed
  396. // to be:
  397. //
  398. // swapEndian = FALSE
  399. // lsbFirst = FALSE
  400. // lineLength = width (from MCDrvDrawPixels parameter list)
  401. // skipLines = 0
  402. // skipPixels = 0
  403. // alignment = 1
  404. //
  405. typedef struct _MCDPIXELTRANSFER {
  406. MCDFLOAT redScale, greenScale, blueScale, alphaScale, depthScale;
  407. MCDFLOAT redbias, greenBias, blueBias, aalphaBias, depthBias;
  408. MCDFLOAT zoomX;
  409. MCDFLOAT zoomY;
  410. LONG indexShift;
  411. LONG indexOffset;
  412. BOOL mapColor;
  413. BOOL mapStencil;
  414. } MCDPIXELTRANSFER;
  415. typedef struct _MCDPIXELPACK {
  416. BYTE swapEndian;
  417. BYTE lsbFirst;
  418. LONG lineLength;
  419. LONG skipLines;
  420. LONG skipPixels;
  421. LONG alignment;
  422. LONG lReserved;
  423. } MCDPIXELPACK;
  424. typedef struct _MCDPIXELUNPACK {
  425. BYTE swapEndian;
  426. BYTE lsbFirst;
  427. LONG lineLength;
  428. LONG skipLines;
  429. LONG skipPixels;
  430. LONG alignment;
  431. LONG lReserved;
  432. } MCDPIXELUNPACK;
  433. typedef struct _MCDPIXELSTATE {
  434. MCDPIXELTRANSFER pixelTransferModes;
  435. MCDPIXELPACK pixelPackModes;
  436. MCDPIXELUNPACK pixelUnpackModes;
  437. ULONG readBuffer;
  438. MCDCOORD rasterPos;
  439. } MCDPIXELSTATE;
  440. typedef struct _MCDSTATE_PIXEL {
  441. ULONG state; // must be MCD_PIXEL_STATE
  442. ULONG size; // must be sizeof(MCDSTATE_PIXEL)
  443. MCDPIXELSTATE pixelState;
  444. } MCDSTATE_PIXEL;
  445. //
  446. // MCDSTATE_SCISSOR_RECT is a variant of the MCDSTATE structure
  447. // that is used to pass the scissor rectangle to the MCD driver
  448. // via MCDrvState.
  449. //
  450. typedef struct _MCDSTATE_SCISSOR_RECT {
  451. ULONG state; // must be MCD_SCISSOR_RECT_STATE
  452. ULONG size; // must be sizeof(MCDSTATE_SCISSOR_RECT)
  453. RECTL scissorRect;
  454. } MCDSTATE_SCISSOR_RECT;
  455. //
  456. // MCDSTATE_TEXENV is a variant of the MCDSTATE structure that is
  457. // used to pass the texture environment state to the MCD driver
  458. // via MCDrvState.
  459. //
  460. typedef struct _MCDTEXENVSTATE {
  461. ULONG texEnvMode;
  462. MCDCOLOR texEnvColor;
  463. } MCDTEXENVSTATE;
  464. typedef struct _MCDSTATE_TEXENV {
  465. ULONG state; // must be MCD_TEXENV_STATE
  466. ULONG size; // must be sizeof(MCDSTATE_TEXENV)
  467. MCDTEXENVSTATE texEnvState;
  468. } MCDSTATE_TEXENV;
  469. //
  470. // MCDVIEWPORT is used to pass viewport state to the MCD driver
  471. // via MCDrvViewport.
  472. typedef struct _MCDVIEWPORT {
  473. MCDFLOAT xScale, xCenter;
  474. MCDFLOAT yScale, yCenter;
  475. MCDFLOAT zScale, zCenter;
  476. } MCDVIEWPORT;
  477. //
  478. // Fine-grained state updates. Sent to a driver only if
  479. // MCDRCINFO_FINE_GRAINED_STATE was returned on context creation.
  480. //
  481. // Enable state.
  482. typedef struct _MCDENABLESTATE {
  483. ULONG enables;
  484. } MCDENABLESTATE;
  485. // Texture enable state. Different from plain enables in that it
  486. // indicates whether all texturing state is consistent and ready for
  487. // texturing.
  488. typedef struct _MCDTEXTUREENABLESTATE {
  489. BOOL textureEnabled;
  490. } MCDTEXTUREENABLESTATE;
  491. // Fog state.
  492. typedef struct _MCDFOGSTATE {
  493. MCDCOLOR fogColor;
  494. MCDFLOAT fogIndex;
  495. MCDFLOAT fogDensity;
  496. MCDFLOAT fogStart;
  497. MCDFLOAT fogEnd;
  498. ULONG fogMode;
  499. } MCDFOGSTATE;
  500. // Shading model state.
  501. typedef struct _MCDSHADELMODELSTATE {
  502. ULONG shadeModel;
  503. } MCDSHADEMODELSTATE;
  504. // Point drawing state.
  505. typedef struct _MCDPOINTDRAWSTATE {
  506. MCDFLOAT pointSize;
  507. } MCDPOINTDRAWSTATE;
  508. // Line drawing state.
  509. typedef struct _MCDLINEDRAWSTATE {
  510. MCDFLOAT lineWidth;
  511. USHORT lineStipplePattern;
  512. SHORT lineStippleRepeat;
  513. } MCDLINEDRAWSTATE;
  514. // Polygon drawing state.
  515. typedef struct _MCDPOLYDRAWSTATE {
  516. ULONG cullFaceMode;
  517. ULONG frontFace;
  518. ULONG polygonModeFront;
  519. ULONG polygonModeBack;
  520. BYTE polygonStipple[4*32];
  521. MCDFLOAT zOffsetFactor;
  522. MCDFLOAT zOffsetUnits;
  523. } MCDPOLYDRAWSTATE;
  524. // Alpha test state.
  525. typedef struct _MCDALPHATESTSTATE {
  526. ULONG alphaTestFunc;
  527. MCDFLOAT alphaTestRef;
  528. } MCDALPHATESTSTATE;
  529. // Depth test state.
  530. typedef struct _MCDDEPTHTESTSTATE {
  531. ULONG depthTestFunc;
  532. } MCDDEPTHTESTSTATE;
  533. // Blend state.
  534. typedef struct _MCDBLENDSTATE {
  535. ULONG blendSrc;
  536. ULONG blendDst;
  537. } MCDBLENDSTATE;
  538. // Logic op state.
  539. typedef struct _MCDLOGICOPSTATE {
  540. ULONG logicOpMode;
  541. } MCDLOGICOPSTATE;
  542. // Frame buffer control state.
  543. typedef struct _MCDFRAMEBUFSTATE {
  544. ULONG drawBuffer;
  545. ULONG indexWritemask;
  546. BOOL colorWritemask[4];
  547. BOOL depthWritemask; // Called mask, but really a write enable.
  548. USHORT stencilWritemask;
  549. MCDCOLOR colorClearValue;
  550. MCDFLOAT indexClearValue;
  551. MCDDOUBLE depthClearValue;
  552. USHORT stencilClearValue;
  553. } MCDFRAMEBUFSTATE;
  554. // Light model state.
  555. typedef struct _MCDLIGHTMODELSTATE {
  556. MCDCOLOR ambient; // Scaled
  557. BOOL localViewer;
  558. BOOL twoSided;
  559. } MCDLIGHTMODELSTATE;
  560. // Hint state.
  561. typedef struct _MCDHINTSTATE {
  562. ULONG perspectiveCorrectionHint;
  563. ULONG pointSmoothHint;
  564. ULONG lineSmoothHint;
  565. ULONG polygonSmoothHint;
  566. ULONG fogHint;
  567. } MCDHINTSTATE;
  568. // Clipping state.
  569. typedef struct _MCDCLIPSTATE {
  570. ULONG userClipEnables;
  571. // Given by program
  572. MCDCOORD userClipPlanes[MCD_MAX_USER_CLIP_PLANES];
  573. // userClipPlanes transformed by modelview inverse
  574. MCDCOORD userClipPlanesInv[MCD_MAX_USER_CLIP_PLANES];
  575. } MCDCLIPSTATE;
  576. // Stencil test state.
  577. typedef struct _MCDSTENCILTESTSTATE {
  578. BOOL stencilTestFunc;
  579. USHORT stencilMask;
  580. USHORT stencilRef;
  581. ULONG stencilFail;
  582. ULONG stencilDepthFail;
  583. ULONG stencilDepthPass;
  584. } MCDSTENCILTESTSTATE;
  585. //
  586. // MCDBUF.bufFlags flags:
  587. //
  588. // MCDBUF_ENABLED If set, direct buffer access is enabled (i.e., the
  589. // bufOffset and bufStride values are valid and may
  590. // be used to access the buffer).
  591. //
  592. // MCDBUF_NOCLIP If set, indicates that clipping is not required
  593. // for the current state of the window.
  594. //
  595. #define MCDBUF_ENABLED 0x00000001
  596. #define MCDBUF_NOCLIP 0x00000002
  597. typedef struct _MCDBUF {
  598. ULONG bufFlags;
  599. LONG bufOffset; // offset relative to beginning of framebuffer
  600. LONG bufStride;
  601. } MCDBUF;
  602. typedef struct _MCDBUFFERS {
  603. MCDBUF mcdFrontBuf;
  604. MCDBUF mcdBackBuf;
  605. MCDBUF mcdDepthBuf;
  606. } MCDBUFFERS;
  607. //
  608. // MCD surface flags:
  609. //
  610. // MCDSURFACE_HWND
  611. #define MCDSURFACE_HWND 0x00000001
  612. typedef struct _MCDSURFACE {
  613. MCDWINDOW *pWnd; // Region support
  614. SURFOBJ *pso;
  615. WNDOBJ *pwo;
  616. ULONG reserved[4];
  617. ULONG surfaceFlags;
  618. } MCDSURFACE;
  619. #define MCDSPAN_FRONT 1
  620. #define MCDSPAN_BACK 2
  621. #define MCDSPAN_DEPTH 3
  622. typedef struct _MCDSPAN {
  623. LONG x;
  624. LONG y;
  625. LONG numPixels;
  626. ULONG type;
  627. VOID *pPixels;
  628. } MCDSPAN;
  629. //
  630. // MCDrvSwap flags
  631. //
  632. #define MCDSWAP_MAIN_PLANE 0x00000001
  633. #define MCDSWAP_OVERLAY1 0x00000002
  634. #define MCDSWAP_OVERLAY2 0x00000004
  635. #define MCDSWAP_OVERLAY3 0x00000008
  636. #define MCDSWAP_OVERLAY4 0x00000010
  637. #define MCDSWAP_OVERLAY5 0x00000020
  638. #define MCDSWAP_OVERLAY6 0x00000040
  639. #define MCDSWAP_OVERLAY7 0x00000080
  640. #define MCDSWAP_OVERLAY8 0x00000100
  641. #define MCDSWAP_OVERLAY9 0x00000200
  642. #define MCDSWAP_OVERLAY10 0x00000400
  643. #define MCDSWAP_OVERLAY11 0x00000800
  644. #define MCDSWAP_OVERLAY12 0x00001000
  645. #define MCDSWAP_OVERLAY13 0x00002000
  646. #define MCDSWAP_OVERLAY14 0x00004000
  647. #define MCDSWAP_OVERLAY15 0x00008000
  648. #define MCDSWAP_UNDERLAY1 0x00010000
  649. #define MCDSWAP_UNDERLAY2 0x00020000
  650. #define MCDSWAP_UNDERLAY3 0x00040000
  651. #define MCDSWAP_UNDERLAY4 0x00080000
  652. #define MCDSWAP_UNDERLAY5 0x00100000
  653. #define MCDSWAP_UNDERLAY6 0x00200000
  654. #define MCDSWAP_UNDERLAY7 0x00400000
  655. #define MCDSWAP_UNDERLAY8 0x00800000
  656. #define MCDSWAP_UNDERLAY9 0x01000000
  657. #define MCDSWAP_UNDERLAY10 0x02000000
  658. #define MCDSWAP_UNDERLAY11 0x04000000
  659. #define MCDSWAP_UNDERLAY12 0x08000000
  660. #define MCDSWAP_UNDERLAY13 0x10000000
  661. #define MCDSWAP_UNDERLAY14 0x20000000
  662. #define MCDSWAP_UNDERLAY15 0x40000000
  663. //
  664. // Clip codes:
  665. //
  666. #define MCD_CLIP_LEFT 0x00000001
  667. #define MCD_CLIP_RIGHT 0x00000002
  668. #define MCD_CLIP_BOTTOM 0x00000004
  669. #define MCD_CLIP_TOP 0x00000008
  670. #define MCD_CLIP_NEAR 0x00000010
  671. #define MCD_CLIP_FAR 0x00000020
  672. #define MCD_CLIP_MASK 0x0000003f
  673. //
  674. // Vertex flags:
  675. //
  676. #define MCDVERTEX_EDGEFLAG 0x00000001
  677. //
  678. // Color indices:
  679. //
  680. #define MCDVERTEX_FRONTFACE 0
  681. #define MCDVERTEX_BACKFACE 1
  682. //
  683. // Note: vertex colors are scaled to the color depths reported in the
  684. // pixel format.
  685. //
  686. typedef struct _MCDVERTEX {
  687. ULONG flags; // vertex flags
  688. MCDCOLOR *pColor; // pointer to active vertex color
  689. ULONG clipCode; // clip code
  690. MCDFLOAT fog; // fog value (0..1)
  691. MCDCOORD clipCoord; // clip-space coordinate
  692. MCDCOORD windowCoord; // window coordinate
  693. MCDCOORD texCoord; // texture coordinate
  694. MCDCOORD normal; // vertex normal
  695. MCDCOLOR colors[2]; // front and back vertex colors
  696. MCDCOORD eyeCoord; // eye coordinate
  697. } MCDVERTEX;
  698. typedef struct _MCDCOMMAND MCDCOMMAND;
  699. #define MCDCOMMAND_RESET_STIPPLE 0x00004000
  700. #define MCDCOMMAND_RENDER_PRIMITIVE 0x00008000
  701. #define MCDCOMMAND_SAME_COLOR 0x00040000
  702. typedef struct _MCDCOMMAND {
  703. ULONG flags; // flags for this command
  704. MCDVERTEX *pEndVertex;
  705. ULONG reserved2;
  706. ULONG reserved3;
  707. ULONG reserved4;
  708. ULONG reserved5;
  709. MCDVERTEX *pStartVertex;
  710. ULONG reserved7;
  711. ULONG reserved8;
  712. MCDVERTEX *pVertexBuffer;
  713. ULONG reserved10;
  714. ULONG reserved11;
  715. ULONG reserved12;
  716. ULONG reserved13;
  717. ULONG reserved14;
  718. ULONG command; // primitive type or command (GL_TRIANGLES, etc.)
  719. ULONG clipCodes;
  720. ULONG reserved17;
  721. ULONG reserved18;
  722. MCDCOMMAND *pNextCmd;
  723. ULONG numIndices;
  724. UCHAR *pIndices;
  725. ULONG reserved22;
  726. ULONG textureKey;
  727. } MCDCOMMAND;
  728. // MCDDRIVER structure containing driver functions
  729. typedef LONG (*MCDRVDESCRIBEPIXELFORMATFUNC)(MCDSURFACE *pMCDSurface, LONG iPixelFormat,
  730. ULONG nBytes, MCDPIXELFORMAT *pMCDPixelFmt, ULONG flags);
  731. typedef BOOL (*MCDRVDESCRIBELAYERPLANEFUNC)(MCDSURFACE *pMCDSurface, LONG iPixelFormat,
  732. LONG iLayerPlane, ULONG nBytes, MCDLAYERPLANE *pMCDLayerPlane,
  733. ULONG flags);
  734. typedef LONG (*MCDRVSETLAYERPALETTEFUNC)(MCDSURFACE *pMCDSurface, LONG iLayerPlane, BOOL bRealize, LONG cEntries, COLORREF *pcr);
  735. typedef BOOL (*MCDRVINFOFUNC)(MCDSURFACE *pMCDSurface, MCDDRIVERINFO *pMCDDriverInfo);
  736. typedef ULONG (*MCDRVCREATECONTEXTFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDRCINFO *pDrvRcInfo);
  737. typedef ULONG (*MCDRVDELETECONTEXTFUNC)(MCDRC *pRc, DHPDEV dhpdev);
  738. typedef ULONG (*MCDRVCREATETEXTUREFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex);
  739. typedef ULONG (*MCDRVUPDATESUBTEXTUREFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex,
  740. ULONG lod, RECTL *pRect);
  741. typedef ULONG (*MCDRVUPDATETEXTUREPALETTEFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex,
  742. ULONG start, ULONG numEntries);
  743. typedef ULONG (*MCDRVUPDATETEXTUREPRIORITYFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex);
  744. typedef ULONG (*MCDRVUPDATETEXTURESTATEFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex);
  745. typedef ULONG (*MCDRVTEXTURESTATUSFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDTEXTURE *pTex);
  746. typedef ULONG (*MCDRVDELETETEXTUREFUNC)(MCDTEXTURE *pTex, DHPDEV dhpdev);
  747. typedef ULONG (*MCDRVCREATEMEMFUNC)(MCDSURFACE *pMCDSurface, MCDMEM *pMCDMem);
  748. typedef ULONG (*MCDRVDELETEMEMFUNC)(MCDMEM *pMCDMem, DHPDEV dhpdev);
  749. typedef ULONG_PTR (*MCDRVDRAWFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDMEM *pMCDExecMem, UCHAR *pStart, UCHAR *pEnd);
  750. typedef ULONG (*MCDRVCLEARFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, ULONG buffers);
  751. typedef ULONG (*MCDRVSWAPFUNC)(MCDSURFACE *pMCDSurface, ULONG flags);
  752. typedef ULONG (*MCDRVSTATEFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDMEM *pMCDMem,
  753. UCHAR *pStart, LONG length, ULONG numStates);
  754. typedef ULONG (*MCDRVVIEWPORTFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDVIEWPORT *pMCDViewport);
  755. typedef HDEV (*MCDRVGETHDEVFUNC)(MCDSURFACE *pMCDSurface);
  756. typedef ULONG (*MCDRVSPANFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDMEM *pMCDMem,
  757. MCDSPAN *pMCDSpan, BOOL bRead);
  758. typedef VOID (*MCDRVTRACKWINDOWFUNC)(WNDOBJ *pWndObj, MCDWINDOW *pMCDWnd, ULONG flags);
  759. typedef ULONG (*MCDRVGETBUFFERSFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc, MCDBUFFERS *pMCDBuffers);
  760. typedef ULONG (*MCDRVALLOCBUFFERSFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc);
  761. typedef ULONG (*MCDRVBINDCONTEXTFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc);
  762. typedef ULONG (*MCDRVSYNCFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc);
  763. typedef ULONG (*MCDRVDRAWPIXELS)(MCDSURFACE *pMcdSurface, MCDRC *pRc,
  764. ULONG width, ULONG height, ULONG format,
  765. ULONG type, VOID *pPixels, BOOL packed);
  766. typedef ULONG (*MCDRVREADPIXELS)(MCDSURFACE *pMcdSurface, MCDRC *pRc,
  767. LONG x, LONG y, ULONG width, ULONG height, ULONG format,
  768. ULONG type, VOID *pPixels);
  769. typedef ULONG (*MCDRVCOPYPIXELS)(MCDSURFACE *pMcdSurface, MCDRC *pRc,
  770. LONG x, LONG y, ULONG width, ULONG height, ULONG type);
  771. typedef ULONG (*MCDRVPIXELMAP)(MCDSURFACE *pMcdSurface, MCDRC *pRc,
  772. ULONG mapType, ULONG mapSize, VOID *pMap);
  773. #define MCDDRIVER_V10_SIZE (sizeof(ULONG)+31*sizeof(void *))
  774. typedef struct _MCDDRIVER {
  775. ULONG ulSize;
  776. MCDRVDESCRIBEPIXELFORMATFUNC pMCDrvDescribePixelFormat;
  777. MCDRVDESCRIBELAYERPLANEFUNC pMCDrvDescribeLayerPlane;
  778. MCDRVSETLAYERPALETTEFUNC pMCDrvSetLayerPalette;
  779. MCDRVINFOFUNC pMCDrvInfo;
  780. MCDRVCREATECONTEXTFUNC pMCDrvCreateContext;
  781. MCDRVDELETECONTEXTFUNC pMCDrvDeleteContext;
  782. MCDRVBINDCONTEXTFUNC pMCDrvBindContext;
  783. MCDRVCREATETEXTUREFUNC pMCDrvCreateTexture;
  784. MCDRVDELETETEXTUREFUNC pMCDrvDeleteTexture;
  785. MCDRVUPDATESUBTEXTUREFUNC pMCDrvUpdateSubTexture;
  786. MCDRVUPDATETEXTUREPALETTEFUNC pMCDrvUpdateTexturePalette;
  787. MCDRVUPDATETEXTUREPRIORITYFUNC pMCDrvUpdateTexturePriority;
  788. MCDRVUPDATETEXTURESTATEFUNC pMCDrvUpdateTextureState;
  789. MCDRVTEXTURESTATUSFUNC pMCDrvTextureStatus;
  790. MCDRVCREATEMEMFUNC pMCDrvCreateMem;
  791. MCDRVDELETEMEMFUNC pMCDrvDeleteMem;
  792. MCDRVDRAWFUNC pMCDrvDraw;
  793. MCDRVCLEARFUNC pMCDrvClear;
  794. MCDRVSWAPFUNC pMCDrvSwap;
  795. MCDRVSTATEFUNC pMCDrvState;
  796. MCDRVVIEWPORTFUNC pMCDrvViewport;
  797. MCDRVGETHDEVFUNC pMCDrvGetHdev;
  798. MCDRVSPANFUNC pMCDrvSpan;
  799. MCDRVTRACKWINDOWFUNC pMCDrvTrackWindow;
  800. MCDRVALLOCBUFFERSFUNC pMCDrvAllocBuffers;
  801. MCDRVGETBUFFERSFUNC pMCDrvGetBuffers;
  802. MCDRVSYNCFUNC pMCDrvSync;
  803. MCDRVDRAWPIXELS pMCDrvDrawPixels;
  804. MCDRVREADPIXELS pMCDrvReadPixels;
  805. MCDRVCOPYPIXELS pMCDrvCopyPixels;
  806. MCDRVPIXELMAP pMCDrvPixelMap;
  807. } MCDDRIVER;
  808. // Top-level (global) driver functions established at DLL initialization time
  809. // through MCD initialization. All other driver functions are obtained through
  810. // the MCDrvGetEntryPoints funtion:
  811. typedef BOOL (*MCDRVGETENTRYPOINTSFUNC)(MCDSURFACE *pMCDSurface,
  812. MCDDRIVER *pMCDDriver);
  813. typedef struct _MCDGLOBALDRIVERFUNCS {
  814. ULONG ulSize;
  815. MCDRVGETENTRYPOINTSFUNC pMCDrvGetEntryPoints;
  816. } MCDGLOBALDRIVERFUNCS;
  817. // MCD Server engine functions:
  818. #define MCDENGINITFUNCNAME "MCDEngInit"
  819. #define MCDENGINITEXFUNCNAME "MCDEngInitEx"
  820. #define MCDENGUNINITFUNCNAME "MCDEngUninit"
  821. #define MCDENGESCFILTERNAME "MCDEngEscFilter"
  822. #define MCDENGSETMEMSTATUSNAME "MCDEngSetMemStatus"
  823. typedef BOOL (WINAPI *MCDENGINITFUNC)(SURFOBJ *pso,
  824. MCDRVGETENTRYPOINTSFUNC);
  825. typedef BOOL (WINAPI *MCDENGINITEXFUNC)(SURFOBJ *pso,
  826. MCDGLOBALDRIVERFUNCS *pMCDGlobalDriverFuncs,
  827. void *pReserved);
  828. typedef void (WINAPI *MCDENGUNINITFUNC)(SURFOBJ *pso);
  829. typedef BOOL (WINAPI *MCDENGESCFILTERFUNC)(SURFOBJ *pso, ULONG iEsc,
  830. ULONG cjIn, VOID *pvIn,
  831. ULONG cjOut, VOID *pvOut,
  832. ULONG *pRetVal);
  833. typedef BOOL (WINAPI *MCDENGSETMEMSTATUSFUNC)(MCDMEM *pMCDMem, ULONG status);
  834. #endif