Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*
  2. * Mesa 3-D graphics library
  3. * Version: 7.7
  4. *
  5. * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
  6. * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the "Software"),
  10. * to deal in the Software without restriction, including without limitation
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. * and/or sell copies of the Software, and to permit persons to whom the
  13. * Software is furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included
  16. * in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  21. * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  22. * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. /**
  26. * \file mtypes.h
  27. * Main Mesa data structures.
  28. *
  29. * Please try to mark derived values with a leading underscore ('_').
  30. */
  31. #ifndef MTYPES_H
  32. #define MTYPES_H
  33. #define MAX_DRAW_BUFFERS 8
  34. #define MAX_VARYING 16
  35. #include <GL/gl.h>
  36. /**
  37. * Indexes for vertex program attributes.
  38. * GL_NV_vertex_program aliases generic attributes over the conventional
  39. * attributes. In GL_ARB_vertex_program shader the aliasing is optional.
  40. * In GL_ARB_vertex_shader / OpenGL 2.0 the aliasing is disallowed (the
  41. * generic attributes are distinct/separate).
  42. */
  43. typedef enum
  44. {
  45. VERT_ATTRIB_POS = 0,
  46. VERT_ATTRIB_WEIGHT = 1,
  47. VERT_ATTRIB_NORMAL = 2,
  48. VERT_ATTRIB_COLOR0 = 3,
  49. VERT_ATTRIB_COLOR1 = 4,
  50. VERT_ATTRIB_FOG = 5,
  51. VERT_ATTRIB_COLOR_INDEX = 6,
  52. VERT_ATTRIB_POINT_SIZE = 6, /*alias*/
  53. VERT_ATTRIB_EDGEFLAG = 7,
  54. VERT_ATTRIB_TEX0 = 8,
  55. VERT_ATTRIB_TEX1 = 9,
  56. VERT_ATTRIB_TEX2 = 10,
  57. VERT_ATTRIB_TEX3 = 11,
  58. VERT_ATTRIB_TEX4 = 12,
  59. VERT_ATTRIB_TEX5 = 13,
  60. VERT_ATTRIB_TEX6 = 14,
  61. VERT_ATTRIB_TEX7 = 15,
  62. VERT_ATTRIB_GENERIC0 = 16,
  63. VERT_ATTRIB_GENERIC1 = 17,
  64. VERT_ATTRIB_GENERIC2 = 18,
  65. VERT_ATTRIB_GENERIC3 = 19,
  66. VERT_ATTRIB_GENERIC4 = 20,
  67. VERT_ATTRIB_GENERIC5 = 21,
  68. VERT_ATTRIB_GENERIC6 = 22,
  69. VERT_ATTRIB_GENERIC7 = 23,
  70. VERT_ATTRIB_GENERIC8 = 24,
  71. VERT_ATTRIB_GENERIC9 = 25,
  72. VERT_ATTRIB_GENERIC10 = 26,
  73. VERT_ATTRIB_GENERIC11 = 27,
  74. VERT_ATTRIB_GENERIC12 = 28,
  75. VERT_ATTRIB_GENERIC13 = 29,
  76. VERT_ATTRIB_GENERIC14 = 30,
  77. VERT_ATTRIB_GENERIC15 = 31,
  78. VERT_ATTRIB_MAX = 32
  79. } gl_vert_attrib;
  80. /**
  81. * Bitflags for vertex attributes.
  82. * These are used in bitfields in many places.
  83. */
  84. /*@{*/
  85. #define VERT_BIT_POS (1 << VERT_ATTRIB_POS)
  86. #define VERT_BIT_WEIGHT (1 << VERT_ATTRIB_WEIGHT)
  87. #define VERT_BIT_NORMAL (1 << VERT_ATTRIB_NORMAL)
  88. #define VERT_BIT_COLOR0 (1 << VERT_ATTRIB_COLOR0)
  89. #define VERT_BIT_COLOR1 (1 << VERT_ATTRIB_COLOR1)
  90. #define VERT_BIT_FOG (1 << VERT_ATTRIB_FOG)
  91. #define VERT_BIT_COLOR_INDEX (1 << VERT_ATTRIB_COLOR_INDEX)
  92. #define VERT_BIT_EDGEFLAG (1 << VERT_ATTRIB_EDGEFLAG)
  93. #define VERT_BIT_TEX0 (1 << VERT_ATTRIB_TEX0)
  94. #define VERT_BIT_TEX1 (1 << VERT_ATTRIB_TEX1)
  95. #define VERT_BIT_TEX2 (1 << VERT_ATTRIB_TEX2)
  96. #define VERT_BIT_TEX3 (1 << VERT_ATTRIB_TEX3)
  97. #define VERT_BIT_TEX4 (1 << VERT_ATTRIB_TEX4)
  98. #define VERT_BIT_TEX5 (1 << VERT_ATTRIB_TEX5)
  99. #define VERT_BIT_TEX6 (1 << VERT_ATTRIB_TEX6)
  100. #define VERT_BIT_TEX7 (1 << VERT_ATTRIB_TEX7)
  101. #define VERT_BIT_GENERIC0 (1 << VERT_ATTRIB_GENERIC0)
  102. #define VERT_BIT_GENERIC1 (1 << VERT_ATTRIB_GENERIC1)
  103. #define VERT_BIT_GENERIC2 (1 << VERT_ATTRIB_GENERIC2)
  104. #define VERT_BIT_GENERIC3 (1 << VERT_ATTRIB_GENERIC3)
  105. #define VERT_BIT_GENERIC4 (1 << VERT_ATTRIB_GENERIC4)
  106. #define VERT_BIT_GENERIC5 (1 << VERT_ATTRIB_GENERIC5)
  107. #define VERT_BIT_GENERIC6 (1 << VERT_ATTRIB_GENERIC6)
  108. #define VERT_BIT_GENERIC7 (1 << VERT_ATTRIB_GENERIC7)
  109. #define VERT_BIT_GENERIC8 (1 << VERT_ATTRIB_GENERIC8)
  110. #define VERT_BIT_GENERIC9 (1 << VERT_ATTRIB_GENERIC9)
  111. #define VERT_BIT_GENERIC10 (1 << VERT_ATTRIB_GENERIC10)
  112. #define VERT_BIT_GENERIC11 (1 << VERT_ATTRIB_GENERIC11)
  113. #define VERT_BIT_GENERIC12 (1 << VERT_ATTRIB_GENERIC12)
  114. #define VERT_BIT_GENERIC13 (1 << VERT_ATTRIB_GENERIC13)
  115. #define VERT_BIT_GENERIC14 (1 << VERT_ATTRIB_GENERIC14)
  116. #define VERT_BIT_GENERIC15 (1 << VERT_ATTRIB_GENERIC15)
  117. #define VERT_BIT_TEX(u) (1 << (VERT_ATTRIB_TEX0 + (u)))
  118. #define VERT_BIT_GENERIC(g) (1 << (VERT_ATTRIB_GENERIC0 + (g)))
  119. /*@}*/
  120. /**
  121. * Indexes for vertex program result attributes
  122. */
  123. typedef enum
  124. {
  125. VERT_RESULT_HPOS = 0,
  126. VERT_RESULT_COL0 = 1,
  127. VERT_RESULT_COL1 = 2,
  128. VERT_RESULT_FOGC = 3,
  129. VERT_RESULT_TEX0 = 4,
  130. VERT_RESULT_TEX1 = 5,
  131. VERT_RESULT_TEX2 = 6,
  132. VERT_RESULT_TEX3 = 7,
  133. VERT_RESULT_TEX4 = 8,
  134. VERT_RESULT_TEX5 = 9,
  135. VERT_RESULT_TEX6 = 10,
  136. VERT_RESULT_TEX7 = 11,
  137. VERT_RESULT_PSIZ = 12,
  138. VERT_RESULT_BFC0 = 13,
  139. VERT_RESULT_BFC1 = 14,
  140. VERT_RESULT_EDGE = 15,
  141. VERT_RESULT_VAR0 = 16, /**< shader varying */
  142. VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING)
  143. } gl_vert_result;
  144. /**
  145. * Indexes for fragment program input attributes.
  146. */
  147. typedef enum
  148. {
  149. FRAG_ATTRIB_WPOS = 0,
  150. FRAG_ATTRIB_COL0 = 1,
  151. FRAG_ATTRIB_COL1 = 2,
  152. FRAG_ATTRIB_FOGC = 3,
  153. FRAG_ATTRIB_TEX0 = 4,
  154. FRAG_ATTRIB_TEX1 = 5,
  155. FRAG_ATTRIB_TEX2 = 6,
  156. FRAG_ATTRIB_TEX3 = 7,
  157. FRAG_ATTRIB_TEX4 = 8,
  158. FRAG_ATTRIB_TEX5 = 9,
  159. FRAG_ATTRIB_TEX6 = 10,
  160. FRAG_ATTRIB_TEX7 = 11,
  161. FRAG_ATTRIB_FACE = 12, /**< front/back face */
  162. FRAG_ATTRIB_PNTC = 13, /**< sprite/point coord */
  163. FRAG_ATTRIB_VAR0 = 14, /**< shader varying */
  164. FRAG_ATTRIB_MAX = (FRAG_ATTRIB_VAR0 + MAX_VARYING)
  165. } gl_frag_attrib;
  166. /**
  167. * Bitflags for fragment program input attributes.
  168. */
  169. /*@{*/
  170. #define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS)
  171. #define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0)
  172. #define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1)
  173. #define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC)
  174. #define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE)
  175. #define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC)
  176. #define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0)
  177. #define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1)
  178. #define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2)
  179. #define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3)
  180. #define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4)
  181. #define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5)
  182. #define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6)
  183. #define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7)
  184. #define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0)
  185. #define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U))
  186. #define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V))
  187. #define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \
  188. FRAG_BIT_TEX1| \
  189. FRAG_BIT_TEX2| \
  190. FRAG_BIT_TEX3| \
  191. FRAG_BIT_TEX4| \
  192. FRAG_BIT_TEX5| \
  193. FRAG_BIT_TEX6| \
  194. FRAG_BIT_TEX7)
  195. /*@}*/
  196. /**
  197. * Fragment program results
  198. */
  199. typedef enum
  200. {
  201. FRAG_RESULT_DEPTH = 0,
  202. FRAG_RESULT_COLOR = 1,
  203. FRAG_RESULT_DATA0 = 2,
  204. FRAG_RESULT_MAX = (FRAG_RESULT_DATA0 + MAX_DRAW_BUFFERS)
  205. } gl_frag_result;
  206. /**
  207. * Names of the various vertex/fragment program register files, etc.
  208. *
  209. * NOTE: first four tokens must fit into 2 bits (see t_vb_arbprogram.c)
  210. * All values should fit in a 4-bit field.
  211. *
  212. * NOTE: PROGRAM_ENV_PARAM, PROGRAM_STATE_VAR, PROGRAM_NAMED_PARAM,
  213. * PROGRAM_CONSTANT, and PROGRAM_UNIFORM can all be considered to
  214. * be "uniform" variables since they can only be set outside glBegin/End.
  215. * They're also all stored in the same Parameters array.
  216. */
  217. typedef enum
  218. {
  219. PROGRAM_TEMPORARY, /**< machine->Temporary[] */
  220. PROGRAM_INPUT, /**< machine->Inputs[] */
  221. PROGRAM_OUTPUT, /**< machine->Outputs[] */
  222. PROGRAM_VARYING, /**< machine->Inputs[]/Outputs[] */
  223. PROGRAM_LOCAL_PARAM, /**< gl_program->LocalParams[] */
  224. PROGRAM_ENV_PARAM, /**< gl_program->Parameters[] */
  225. PROGRAM_STATE_VAR, /**< gl_program->Parameters[] */
  226. PROGRAM_NAMED_PARAM, /**< gl_program->Parameters[] */
  227. PROGRAM_CONSTANT, /**< gl_program->Parameters[] */
  228. PROGRAM_UNIFORM, /**< gl_program->Parameters[] */
  229. PROGRAM_WRITE_ONLY, /**< A dummy, write-only register */
  230. PROGRAM_ADDRESS, /**< machine->AddressReg */
  231. PROGRAM_SAMPLER, /**< for shader samplers, compile-time only */
  232. PROGRAM_UNDEFINED, /**< Invalid/TBD value */
  233. PROGRAM_FILE_MAX
  234. } gl_register_file;
  235. #endif