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.

281 lines
8.4 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. * This is a private copy of mcdrv.h with all the 1.0 stuff
  10. * stripped out. It allows OpenGL to build for MCD 2.0 even though the
  11. * public header file doesn't include the necessary information.
  12. * Some things changed from 1.0 on and these cannot be redefined in
  13. * a safe manner so they are not present here, causing some weirdness in
  14. * the code but much less than ifdefing everything.
  15. *
  16. \**************************************************************************/
  17. #ifndef _MCD2HACK_H
  18. #define _MCD2HACK_H
  19. #define MCD_MAX_LIGHTS 8
  20. // MCDTEXTURE create flags
  21. #define MCDTEXTURE_DIRECTDRAW_SURFACES 0x00000001
  22. //
  23. // Different matrix forms, for optimizing transforms.
  24. // Types go from most general to least general.
  25. //
  26. // No information about matrix type
  27. #define MCDMATRIX_GENERAL 0
  28. // W row is 0 0 0 1
  29. #define MCDMATRIX_W0001 1
  30. // 2D matrix terms only
  31. #define MCDMATRIX_2D 2
  32. // 2D non-rotational matrix
  33. #define MCDMATRIX_2DNR 3
  34. // Identity
  35. #define MCDMATRIX_IDENTITY 4
  36. //
  37. // A 4x4 matrix augmented with additional information about its layout.
  38. //
  39. // matrixType is one of the above matrix types.
  40. // nonScaling is TRUE if the diagonal terms are one.
  41. //
  42. typedef struct _MCDMATRIX {
  43. MCDFLOAT matrix[4][4];
  44. ULONG matrixType;
  45. ULONG reserved[5];
  46. BOOL nonScaling;
  47. } MCDMATRIX;
  48. //
  49. // Texture generation information for a single coordinate.
  50. //
  51. typedef struct _MCDTEXTURECOORDGENERATION {
  52. ULONG mode;
  53. MCDCOORD eyePlane; // Given by program
  54. MCDCOORD eyePlaneInv; // eyePlane transformed by modelview inverse
  55. MCDCOORD objectPlane;
  56. } MCDTEXTURECOORDGENERATION;
  57. //
  58. // Light source description.
  59. //
  60. typedef struct _MCDLIGHT {
  61. MCDCOLOR ambient; // Scaled
  62. MCDCOLOR diffuse; // Scaled
  63. MCDCOLOR specular; // Scaled
  64. MCDCOORD position; // Given by program
  65. MCDCOORD positionEye; // position transformed by modelview
  66. MCDCOORD direction; // Given by program
  67. MCDCOORD directionInv; // direction transformed by modelview inverse,
  68. // normalized
  69. MCDFLOAT spotLightExponent;
  70. MCDFLOAT spotLightCutOffAngle;
  71. MCDFLOAT constantAttenuation;
  72. MCDFLOAT linearAttenuation;
  73. MCDFLOAT quadraticAttenuation;
  74. } MCDLIGHT;
  75. //
  76. // Material description.
  77. //
  78. typedef struct _MCDMATERIAL {
  79. MCDCOLOR ambient; // Unscaled
  80. MCDCOLOR diffuse; // Unscaled
  81. MCDCOLOR specular; // Unscaled
  82. MCDCOLOR emissive; // Scaled
  83. MCDFLOAT specularExponent;
  84. MCDFLOAT ambientColorIndex;
  85. MCDFLOAT diffuseColorIndex;
  86. MCDFLOAT specularColorIndex;
  87. } MCDMATERIAL;
  88. #define MCD_TEXTURE_TRANSFORM_STATE 20
  89. #define MCD_TEXTURE_GENERATION_STATE 21
  90. #define MCD_MATERIAL_STATE 22
  91. #define MCD_LIGHT_SOURCE_STATE 23
  92. #define MCD_COLOR_MATERIAL_STATE 24
  93. // Texture transform state.
  94. typedef struct _MCDTEXTURETRANSFORMSTATE {
  95. MCDMATRIX transform;
  96. } MCDTEXTURETRANSFORMSTATE;
  97. // Texture generation state.
  98. typedef struct _MCDTEXTUREGENERATIONSTATE {
  99. MCDTEXTURECOORDGENERATION s, t, r, q;
  100. } MCDTEXTUREGENERATIONSTATE;
  101. // Material state.
  102. typedef struct _MCDMATERIALSTATE {
  103. MCDMATERIAL materials[2];
  104. } MCDMATERIALSTATE;
  105. // Light source state.
  106. typedef struct _MCDLIGHTSOURCESTATE {
  107. ULONG enables;
  108. ULONG changed;
  109. // Followed by one MCDLIGHT structure per set bit
  110. // in changed, starting from bit 0. changed may be zero
  111. // if only the enables changed.
  112. } MCDLIGHTSOURCESTATE;
  113. // ColorMaterial state.
  114. typedef struct _MCDCOLORMATERIALSTATE {
  115. ULONG face;
  116. ULONG mode;
  117. } MCDCOLORMATERIALSTATE;
  118. typedef struct _MCDRECTBUF {
  119. ULONG bufFlags;
  120. LONG bufOffset; // offset relative to beginning of framebuffer
  121. LONG bufStride;
  122. RECTL bufPos;
  123. } MCDRECTBUF;
  124. typedef struct _MCDRECTBUFFERS {
  125. MCDRECTBUF mcdFrontBuf;
  126. MCDRECTBUF mcdBackBuf;
  127. MCDRECTBUF mcdDepthBuf;
  128. } MCDRECTBUFFERS;
  129. #define MCDSURFACE_DIRECT 0x00000002
  130. // User-defined clip plane bits starting position
  131. #define MCD_CLIP_USER0 0x00000040
  132. #define MCDVERTEX_EDGEFLAG_VALID 0x00000002
  133. #define MCDVERTEX_COLOR_VALID 0x00000004
  134. #define MCDVERTEX_NORMAL_VALID 0x00000008
  135. #define MCDVERTEX_TEXTURE_VALID 0x00000010
  136. #define MCDVERTEX_VERTEX2 0x00000020 // same as MCDCOMMAND
  137. #define MCDVERTEX_VERTEX3 0x00000040 // same as MCDCOMMAND
  138. #define MCDVERTEX_VERTEX4 0x00000080 // same as MCDCOMMAND
  139. #define MCDVERTEX_MATERIAL_FRONT 0x10000000 // same as MCDCOMMAND
  140. #define MCDVERTEX_MATERIAL_BACK 0x20000000 // same as MCDCOMMAND
  141. #define MCDCOMMAND_PRIMITIVE_CONTINUED 0x00000008
  142. #define MCDCOMMAND_PRIMITIVE_INCOMPLETE 0x00000010
  143. #define MCDCOMMAND_VERTEX2 0x00000020 // same as MCDVERTEX
  144. #define MCDCOMMAND_VERTEX3 0x00000040 // same as MCDVERTEX
  145. #define MCDCOMMAND_VERTEX4 0x00000080 // same as MCDVERTEX
  146. #define MCDCOMMAND_TEXTURE1 0x00100000
  147. #define MCDCOMMAND_TEXTURE2 0x00200000
  148. #define MCDCOMMAND_TEXTURE3 0x00400000
  149. #define MCDCOMMAND_TEXTURE4 0x00800000
  150. #define MCDCOMMAND_MATERIAL_FRONT 0x10000000 // same as MCDVERTEX
  151. #define MCDCOMMAND_MATERIAL_BACK 0x20000000 // same as MCDVERTEX
  152. //
  153. // Primitive type bits for indicating what kinds of primitives are in
  154. // a command batch:
  155. //
  156. #define MCDPRIM_POINTS_BIT 0x00000001
  157. #define MCDPRIM_LINES_BIT 0x00000002
  158. #define MCDPRIM_LINE_LOOP_BIT 0x00000004
  159. #define MCDPRIM_LINE_STRIP_BIT 0x00000008
  160. #define MCDPRIM_TRIANGLES_BIT 0x00000010
  161. #define MCDPRIM_TRIANGLE_STRIP_BIT 0x00000020
  162. #define MCDPRIM_TRIANGLE_FAN_BIT 0x00000040
  163. #define MCDPRIM_QUADS_BIT 0x00000080
  164. #define MCDPRIM_QUAD_STRIP_BIT 0x00000100
  165. #define MCDPRIM_POLYGON_BIT 0x00000200
  166. //
  167. // Current transform information for MCD 2.0.
  168. // The first matrix is the model-view matrix.
  169. // The second matrix is the MV matrix composed with the current projection
  170. // matrix.
  171. //
  172. // flags indicates whether the mvp matrix has changed since the last
  173. // time it was presented to the driver.
  174. //
  175. #define MCDTRANSFORM_CHANGED 0x00000001
  176. typedef struct _MCDTRANSFORM {
  177. MCDMATRIX matrix;
  178. MCDMATRIX mvp;
  179. ULONG flags;
  180. } MCDTRANSFORM;
  181. //
  182. // Bit values for changes to materials.
  183. //
  184. #define MCDMATERIAL_AMBIENT 0x00000001
  185. #define MCDMATERIAL_DIFFUSE 0x00000002
  186. #define MCDMATERIAL_SPECULAR 0x00000004
  187. #define MCDMATERIAL_EMISSIVE 0x00000008
  188. #define MCDMATERIAL_SPECULAREXPONENT 0x00000010
  189. #define MCDMATERIAL_COLORINDEXES 0x00000020
  190. #define MCDMATERIAL_ALL 0x0000003f
  191. //
  192. // Material change description.
  193. //
  194. typedef struct _MCDMATERIALCHANGE {
  195. ULONG dirtyBits;
  196. MCDCOLOR ambient;
  197. MCDCOLOR diffuse;
  198. MCDCOLOR specular;
  199. MCDCOLOR emissive;
  200. MCDFLOAT specularExponent;
  201. MCDFLOAT ambientColorIndex;
  202. MCDFLOAT diffuseColorIndex;
  203. MCDFLOAT specularColorIndex;
  204. } MCDMATERIALCHANGE;
  205. //
  206. // Material changes for both faces.
  207. //
  208. typedef struct _MCDMATERIALCHANGES {
  209. MCDMATERIALCHANGE *front, *back;
  210. } MCDMATERIALCHANGES;
  211. typedef int (*MCDRVGETTEXTUREFORMATSFUNC)(MCDSURFACE *pMcdSurface,
  212. int nFmts,
  213. struct _DDSURFACEDESC *pddsd);
  214. typedef ULONG_PTR (*MCDRVSWAPMULTIPLEFUNC)(SURFOBJ *pso,
  215. UINT cBuffers,
  216. MCDWINDOW **pMcdWindows,
  217. UINT *puiFlags);
  218. typedef ULONG_PTR (*MCDRVPROCESSFUNC)(MCDSURFACE *pMCDSurface, MCDRC *pRc,
  219. MCDMEM *pMCDExecMem,
  220. UCHAR *pStart, UCHAR *pEnd,
  221. ULONG cmdFlagsAll, ULONG primFlags,
  222. MCDTRANSFORM *pMCDTransform,
  223. MCDMATERIALCHANGES *pMCDMatChanges);
  224. #define MCDDRIVER_V11_SIZE (MCDDRIVER_V10_SIZE+2*sizeof(void *))
  225. #define MCDDRIVER_V20_SIZE (MCDDRIVER_V11_SIZE+1*sizeof(void *))
  226. #endif // _MCD2HACK_H