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.

246 lines
9.2 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: glarray.h
  3. *
  4. * Vertex array states.
  5. *
  6. * Created: 2-04-1996
  7. * Author: Hock San Lee [hockl]
  8. *
  9. * Copyright (c) 1996 Microsoft Corporation
  10. \**************************************************************************/
  11. #ifndef __glarray_h_
  12. #define __glarray_h_
  13. extern GLuint vaEnable[];
  14. typedef struct
  15. {
  16. GLuint iIn;
  17. GLushort next;
  18. } VAMAP;
  19. // Vertex array structures.
  20. typedef void (FASTCALL *PFNVAELEMENTBATCH)
  21. (__GLcontext *gc, GLint firstIndex, GLint nVertices);
  22. typedef void (FASTCALL *PFNVAELEMENTBATCHINDIRECT)
  23. (__GLcontext *gc, GLint nVertices, VAMAP* indices);
  24. typedef void (FASTCALL *PFNVAELEMENT)(__GLcontext *gc, GLint i);
  25. typedef void (APIENTRY *PFNGLVECTOR)(IN const GLvoid *v);
  26. typedef struct __GLarrayEdgeFlagRec {
  27. GLuint ibytes;
  28. GLsizei stride;
  29. const GLbyte *pointer;
  30. PFNGLVECTOR pfn;
  31. PFNGLVECTOR pfnCompile;
  32. } __GLarrayEdgeFlag;
  33. typedef struct __GLarrayTexCoordRec {
  34. GLint size;
  35. GLenum type;
  36. GLuint ibytes;
  37. GLsizei stride;
  38. const GLbyte *pointer;
  39. PFNGLVECTOR pfn;
  40. PFNGLVECTOR pfnCompile;
  41. } __GLarrayTexCoord;
  42. typedef struct __GLarrayIndexRec {
  43. GLenum type;
  44. GLuint ibytes;
  45. GLsizei stride;
  46. const GLbyte *pointer;
  47. PFNGLVECTOR pfn;
  48. PFNGLVECTOR pfnCompile;
  49. } __GLarrayIndex;
  50. typedef struct __GLarrayColorRec {
  51. GLint size;
  52. GLenum type;
  53. GLuint ibytes;
  54. GLsizei stride;
  55. const GLbyte *pointer;
  56. PFNGLVECTOR pfn;
  57. PFNGLVECTOR pfnCompile;
  58. } __GLarrayColor;
  59. typedef struct __GLarrayNormalRec {
  60. GLenum type;
  61. GLuint ibytes;
  62. GLsizei stride;
  63. const GLbyte *pointer;
  64. PFNGLVECTOR pfn;
  65. PFNGLVECTOR pfnCompile;
  66. } __GLarrayNormal;
  67. typedef struct __GLarrayVertexRec {
  68. GLint size;
  69. GLenum type;
  70. GLuint ibytes;
  71. GLsizei stride;
  72. const GLbyte *pointer;
  73. PFNGLVECTOR pfn;
  74. PFNGLVECTOR pfnCompile;
  75. } __GLarrayVertex;
  76. // Vertex array states.
  77. typedef struct __GLvertexArrayRec {
  78. GLuint flags;
  79. GLuint mask;
  80. PFNVAELEMENT pfnArrayElement;
  81. PFNVAELEMENTBATCH pfnArrayElementBatch;
  82. PFNVAELEMENTBATCHINDIRECT pfnArrayElementBatchIndirect;
  83. __GLarrayEdgeFlag edgeFlag;
  84. __GLarrayTexCoord texCoord;
  85. __GLarrayIndex index;
  86. __GLarrayColor color;
  87. __GLarrayNormal normal;
  88. __GLarrayVertex vertex;
  89. } __GLvertexArray;
  90. // Vertex array flags.
  91. #define __GL_VERTEX_ARRAY_DIRTY 0x0001
  92. // Mask that encapsulates the current vertex array settings.
  93. // It is maintained in the mask field in __GLvertexArray.
  94. // The mask is given in the following binary form in 24 bits:
  95. //
  96. // VeVsVsVtVtNeNtNtNtCeCsCtCtCtIeItItItTeTsTsTtTtEe
  97. // 232221201918171615141312111009080706050403020100
  98. //
  99. // where V:vertex pointer,
  100. // N:normal pointer,
  101. // C:color pointer,
  102. // I:index pointer,
  103. // T:texture coord pointer,
  104. // E:edge flag pointer,
  105. // e:enable flag,
  106. // s:size field,
  107. // t:type field.
  108. #define VAMASK_EDGEFLAG_ENABLE_SHIFT 0
  109. #define VAMASK_TEXCOORD_TYPE_SHIFT 1
  110. #define VAMASK_TEXCOORD_SIZE_SHIFT 3
  111. #define VAMASK_TEXCOORD_ENABLE_SHIFT 5
  112. #define VAMASK_INDEX_TYPE_SHIFT 6
  113. #define VAMASK_INDEX_ENABLE_SHIFT 9
  114. #define VAMASK_COLOR_TYPE_SHIFT 10
  115. #define VAMASK_COLOR_SIZE_SHIFT 13
  116. #define VAMASK_COLOR_ENABLE_SHIFT 14
  117. #define VAMASK_NORMAL_TYPE_SHIFT 15
  118. #define VAMASK_NORMAL_ENABLE_SHIFT 18
  119. #define VAMASK_VERTEX_TYPE_SHIFT 19
  120. #define VAMASK_VERTEX_SIZE_SHIFT 21
  121. #define VAMASK_VERTEX_ENABLE_SHIFT 23
  122. #define VAMASK_EDGEFLAG_ENABLE_MASK (1 << VAMASK_EDGEFLAG_ENABLE_SHIFT)
  123. #define VAMASK_TEXCOORD_TYPE_MASK (3 << VAMASK_TEXCOORD_TYPE_SHIFT)
  124. #define VAMASK_TEXCOORD_SIZE_MASK (3 << VAMASK_TEXCOORD_SIZE_SHIFT)
  125. #define VAMASK_TEXCOORD_ENABLE_MASK (1 << VAMASK_TEXCOORD_ENABLE_SHIFT)
  126. #define VAMASK_INDEX_TYPE_MASK (7 << VAMASK_INDEX_TYPE_SHIFT)
  127. #define VAMASK_INDEX_ENABLE_MASK (1 << VAMASK_INDEX_ENABLE_SHIFT)
  128. #define VAMASK_COLOR_TYPE_MASK (7 << VAMASK_COLOR_TYPE_SHIFT)
  129. #define VAMASK_COLOR_SIZE_MASK (1 << VAMASK_COLOR_SIZE_SHIFT)
  130. #define VAMASK_COLOR_ENABLE_MASK (1 << VAMASK_COLOR_ENABLE_SHIFT)
  131. #define VAMASK_NORMAL_TYPE_MASK (7 << VAMASK_NORMAL_TYPE_SHIFT)
  132. #define VAMASK_NORMAL_ENABLE_MASK (1 << VAMASK_NORMAL_ENABLE_SHIFT)
  133. #define VAMASK_VERTEX_TYPE_MASK (3 << VAMASK_VERTEX_TYPE_SHIFT)
  134. #define VAMASK_VERTEX_SIZE_MASK (3 << VAMASK_VERTEX_SIZE_SHIFT)
  135. #define VAMASK_VERTEX_ENABLE_MASK (1 << VAMASK_VERTEX_ENABLE_SHIFT)
  136. #define VAMASK_EDGEFLAG_TYPE_SIZE_MASK \
  137. (0)
  138. #define VAMASK_TEXCOORD_TYPE_SIZE_MASK \
  139. (VAMASK_TEXCOORD_TYPE_MASK | VAMASK_TEXCOORD_SIZE_MASK)
  140. #define VAMASK_INDEX_TYPE_SIZE_MASK \
  141. (VAMASK_INDEX_TYPE_MASK)
  142. #define VAMASK_COLOR_TYPE_SIZE_MASK \
  143. (VAMASK_COLOR_TYPE_MASK | VAMASK_COLOR_SIZE_MASK)
  144. #define VAMASK_NORMAL_TYPE_SIZE_MASK \
  145. (VAMASK_NORMAL_TYPE_MASK)
  146. #define VAMASK_VERTEX_TYPE_SIZE_MASK \
  147. (VAMASK_VERTEX_TYPE_MASK | VAMASK_VERTEX_SIZE_MASK)
  148. #define VAMASK_TEXCOORD_TYPE_SHORT (0 << VAMASK_TEXCOORD_TYPE_SHIFT)
  149. #define VAMASK_TEXCOORD_TYPE_INT (1 << VAMASK_TEXCOORD_TYPE_SHIFT)
  150. #define VAMASK_TEXCOORD_TYPE_FLOAT (2 << VAMASK_TEXCOORD_TYPE_SHIFT)
  151. #define VAMASK_TEXCOORD_TYPE_DOUBLE (3 << VAMASK_TEXCOORD_TYPE_SHIFT)
  152. #define VAMASK_TEXCOORD_SIZE_1 (0 << VAMASK_TEXCOORD_SIZE_SHIFT)
  153. #define VAMASK_TEXCOORD_SIZE_2 (1 << VAMASK_TEXCOORD_SIZE_SHIFT)
  154. #define VAMASK_TEXCOORD_SIZE_3 (2 << VAMASK_TEXCOORD_SIZE_SHIFT)
  155. #define VAMASK_TEXCOORD_SIZE_4 (3 << VAMASK_TEXCOORD_SIZE_SHIFT)
  156. #define VAMASK_INDEX_TYPE_UBYTE (0 << VAMASK_INDEX_TYPE_SHIFT)
  157. #define VAMASK_INDEX_TYPE_SHORT (1 << VAMASK_INDEX_TYPE_SHIFT)
  158. #define VAMASK_INDEX_TYPE_INT (2 << VAMASK_INDEX_TYPE_SHIFT)
  159. #define VAMASK_INDEX_TYPE_FLOAT (3 << VAMASK_INDEX_TYPE_SHIFT)
  160. #define VAMASK_INDEX_TYPE_DOUBLE (4 << VAMASK_INDEX_TYPE_SHIFT)
  161. #define VAMASK_COLOR_TYPE_BYTE (0 << VAMASK_COLOR_TYPE_SHIFT)
  162. #define VAMASK_COLOR_TYPE_UBYTE (1 << VAMASK_COLOR_TYPE_SHIFT)
  163. #define VAMASK_COLOR_TYPE_SHORT (2 << VAMASK_COLOR_TYPE_SHIFT)
  164. #define VAMASK_COLOR_TYPE_USHORT (3 << VAMASK_COLOR_TYPE_SHIFT)
  165. #define VAMASK_COLOR_TYPE_INT (4 << VAMASK_COLOR_TYPE_SHIFT)
  166. #define VAMASK_COLOR_TYPE_UINT (5 << VAMASK_COLOR_TYPE_SHIFT)
  167. #define VAMASK_COLOR_TYPE_FLOAT (6 << VAMASK_COLOR_TYPE_SHIFT)
  168. #define VAMASK_COLOR_TYPE_DOUBLE (7 << VAMASK_COLOR_TYPE_SHIFT)
  169. #define VAMASK_COLOR_SIZE_3 (0 << VAMASK_COLOR_SIZE_SHIFT)
  170. #define VAMASK_COLOR_SIZE_4 (1 << VAMASK_COLOR_SIZE_SHIFT)
  171. #define VAMASK_NORMAL_TYPE_BYTE (0 << VAMASK_NORMAL_TYPE_SHIFT)
  172. #define VAMASK_NORMAL_TYPE_SHORT (1 << VAMASK_NORMAL_TYPE_SHIFT)
  173. #define VAMASK_NORMAL_TYPE_INT (2 << VAMASK_NORMAL_TYPE_SHIFT)
  174. #define VAMASK_NORMAL_TYPE_FLOAT (3 << VAMASK_NORMAL_TYPE_SHIFT)
  175. #define VAMASK_NORMAL_TYPE_DOUBLE (4 << VAMASK_NORMAL_TYPE_SHIFT)
  176. #define VAMASK_VERTEX_TYPE_SHORT (0 << VAMASK_VERTEX_TYPE_SHIFT)
  177. #define VAMASK_VERTEX_TYPE_INT (1 << VAMASK_VERTEX_TYPE_SHIFT)
  178. #define VAMASK_VERTEX_TYPE_FLOAT (2 << VAMASK_VERTEX_TYPE_SHIFT)
  179. #define VAMASK_VERTEX_TYPE_DOUBLE (3 << VAMASK_VERTEX_TYPE_SHIFT)
  180. #define VAMASK_VERTEX_SIZE_2 (0 << VAMASK_VERTEX_SIZE_SHIFT)
  181. #define VAMASK_VERTEX_SIZE_3 (1 << VAMASK_VERTEX_SIZE_SHIFT)
  182. #define VAMASK_VERTEX_SIZE_4 (2 << VAMASK_VERTEX_SIZE_SHIFT)
  183. // Constants used by DrawElements. Do not modify them because
  184. // glcltDrawElements assumes they have these values!
  185. #define VA_DRAWELEM_MAP_SIZE 256
  186. #define VA_DRAWELEM_INDEX_SIZE (8*VA_DRAWELEM_MAP_SIZE)
  187. // Constants used by DrawRangeElementsEXT : currently these map identically
  188. // with DrawElements constants.
  189. #define VA_DRAWRANGEELEM_MAX_VERTICES VA_DRAWELEM_MAP_SIZE
  190. #define VA_DRAWRANGEELEM_MAX_INDICES VA_DRAWELEM_INDEX_SIZE
  191. void FASTCALL __glInitVertexArray(__GLcontext *gc);
  192. void FASTCALL VA_ValidateArrayPointers(__GLcontext *gc);
  193. void FASTCALL VA_DrawElementsBegin(POLYARRAY *pa, GLenum mode, GLsizei count);
  194. void FASTCALL VA_DrawElementsEnd(POLYARRAY *pa);
  195. void FASTCALL VA_DrawElementsFlushPartialPrimitive(POLYARRAY *pa, GLenum mode);
  196. extern GLint nReservedIndicesPartialBegin[];
  197. typedef void (FASTCALL *pfnReducedElementsHandler)
  198. (__GLcontext *gc, GLenum mode,
  199. GLsizei iVertexCount, GLsizei iVertexBase, VAMAP *pvmVertices,
  200. GLsizei iElementCount, GLubyte *pbElements,
  201. GLboolean fPartial);
  202. void FASTCALL glcltReducedElementsHandler(__GLcontext *gc,
  203. GLenum mode,
  204. GLsizei iVertexCount,
  205. GLsizei iVertexBase,
  206. VAMAP *pvmVertices,
  207. GLsizei iElementCount,
  208. GLubyte *pbElements,
  209. GLboolean fPartial);
  210. void FASTCALL ReduceDrawElements(__GLcontext *gc,
  211. GLenum mode, GLsizei count, GLenum type,
  212. const GLvoid *pIn,
  213. pfnReducedElementsHandler pfnHandler);
  214. #endif // __glarray_h_