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.

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