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

MESA_texture_array.spec 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  1. Name
  2. MESA_texture_array
  3. Name Strings
  4. GL_MESA_texture_array
  5. Contact
  6. Ian Romanick, IBM (idr 'at' us.ibm.com)
  7. IP Status
  8. No known IP issues.
  9. Status
  10. Shipping in Mesa 7.1
  11. Version
  12. $Date: 2007/05/16$ $Revision: 0.4$
  13. Number
  14. TBD
  15. Dependencies
  16. OpenGL 1.2 or GL_EXT_texture3D is required.
  17. Support for ARB_fragment_program is assumed, but not required.
  18. Support for ARB_fragment_program_shadow is assumed, but not required.
  19. Support for EXT_framebuffer_object is assumed, but not required.
  20. Written based on the wording of the OpenGL 2.0 specification and
  21. ARB_fragment_program_shadow but not dependent on them.
  22. Overview
  23. There are a number of circumstances where an application may wish to
  24. blend two textures out of a larger set of textures. Moreover, in some
  25. cases the selected textures may vary on a per-fragment basis within
  26. a polygon. Several examples include:
  27. 1. High dynamic range textures. The application stores several
  28. different "exposures" of an image as different textures. On a
  29. per-fragment basis, the application selects which exposures are
  30. used.
  31. 2. A terrain engine where the altitude of a point determines the
  32. texture applied to it. If the transition is from beach sand to
  33. grass to rocks to snow, the application will store each texture
  34. in a different texture map, and dynamically select which two
  35. textures to blend at run-time.
  36. 3. Storing short video clips in textures. Each depth slice is a
  37. single frame of video.
  38. Several solutions to this problem have been proposed, but they either
  39. involve using a separate texture unit for each texture map or using 3D
  40. textures without mipmaps. Both of these options have major drawbacks.
  41. This extension provides a third alternative that eliminates the major
  42. drawbacks of both previous methods. A new texture target,
  43. TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in
  44. all aspects except the sizes of the non-base level images. In
  45. traditional 3D texturing, the size of the N+1 LOD is half the size
  46. of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target,
  47. the height and width of the N+1 LOD is halved, but the depth is the
  48. same for all levels of detail. The texture then becomes an array of
  49. 2D textures. The per-fragment texel is selected by the R texture
  50. coordinate.
  51. References:
  52. http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557
  53. http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516
  54. http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903
  55. http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm
  56. New Procedures and Functions
  57. All functions come directly from EXT_texture_array.
  58. void FramebufferTextureLayerEXT(enum target, enum attachment,
  59. uint texture, int level, int layer);
  60. New Tokens
  61. All token names and values come directly from EXT_texture_array.
  62. Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
  63. the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
  64. GetDoublev, and by the <target> parameter of TexImage3D, GetTexImage,
  65. GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and
  66. GetTexParameterfv:
  67. TEXTURE_1D_ARRAY_EXT 0x8C18
  68. TEXTURE_2D_ARRAY_EXT 0x8C1A
  69. Accepted by the <target> parameter of TexImage2D, TexSubImage2D,
  70. CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D,
  71. CompressedTexSubImage2D, GetTexLevelParameteriv, and
  72. GetTexLevelParameterfv:
  73. TEXTURE_1D_ARRAY_EXT
  74. PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
  75. Accepted by the <target> parameter of TexImage3D, TexSubImage3D,
  76. CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D,
  77. GetTexLevelParameteriv, and GetTexLevelParameterfv:
  78. TEXTURE_2D_ARRAY_EXT
  79. PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
  80. Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
  81. GetFloatv, and GetDoublev
  82. TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
  83. TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
  84. MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
  85. Accepted by the <param> parameter of TexParameterf, TexParameteri,
  86. TexParameterfv, and TexParameteriv when the <pname> parameter is
  87. TEXTURE_COMPARE_MODE_ARB:
  88. COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
  89. (Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the
  90. existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name
  91. reflects the fact that the R coordinate is not always used.)
  92. Accepted by the <internalformat> parameter of TexImage3D and
  93. CompressedTexImage3D, and by the <format> parameter of
  94. CompressedTexSubImage3D:
  95. COMPRESSED_RGB_S3TC_DXT1_EXT
  96. COMPRESSED_RGBA_S3TC_DXT1_EXT
  97. COMPRESSED_RGBA_S3TC_DXT3_EXT
  98. COMPRESSED_RGBA_S3TC_DXT5_EXT
  99. Accepted by the <pname> parameter of
  100. GetFramebufferAttachmentParameterivEXT:
  101. FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
  102. (Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the
  103. FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in
  104. EXT_framebuffer_object. This extension generalizes the notion of
  105. "<zoffset>" to include layers of an array texture.)
  106. Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
  107. None
  108. Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
  109. -- Section 3.8.1 "Texture Image Specification"
  110. Change the first paragraph (page 150) to say (spec changes identical to
  111. EXT_texture_array):
  112. "The command
  113. void TexImage3D(enum target, int level, int internalformat,
  114. sizei width, sizei height, sizei depth, int border,
  115. enum format, enum type, void *data);
  116. is used to specify a three-dimensional texture image. target must be one
  117. one of TEXTURE_3D for a three-dimensional texture or
  118. TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture.
  119. Additionally, target may be either PROXY_TEXTURE_3D for a
  120. three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a
  121. two-dimensional proxy array texture."
  122. Change the fourth paragraph on page 151 to say (spec changes identical
  123. to EXT_texture_array):
  124. "Textures with a base internal format of DEPTH_COMPONENT are supported
  125. by texture image specification commands only if target is TEXTURE_1D,
  126. TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT,
  127. PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or
  128. PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any
  129. other target will result in an INVALID_OPERATION error."
  130. Change the fourth paragraph on page 156 to say (spec changes identical
  131. to EXT_texture_array):
  132. "The command
  133. void TexImage2D(enum target, int level,
  134. int internalformat, sizei width, sizei height,
  135. int border, enum format, enum type, void *data);
  136. is used to specify a two-dimensional texture image. target must be one
  137. of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a
  138. one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X,
  139. TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
  140. TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
  141. TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally,
  142. target may be either PROXY_TEXTURE_2D for a two-dimensional proxy
  143. texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array
  144. texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the
  145. special case discussed in section 3.8.11. The other parameters match
  146. the corresponding parameters of TexImage3D.
  147. For the purposes of decoding the texture image, TexImage2D is
  148. equivalent to calling TexImage3D with corresponding arguments and depth
  149. of 1, except that
  150. * The border depth, d_b, is zero, and the depth of the image is
  151. always 1 regardless of the value of border.
  152. * The border height, h_b, is zero if <target> is
  153. TEXTURE_1D_ARRAY_EXT, and <border> otherwise.
  154. * Convolution will be performed on the image (possibly changing its
  155. width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled.
  156. * UNPACK SKIP IMAGES is ignored."
  157. -- Section 3.8.2 "Alternate Texture Image Specification Commands"
  158. Change the second paragraph (page 159) (spec changes identical
  159. to EXT_texture_array):
  160. "The command
  161. void CopyTexImage2D(enum target, int level,
  162. enum internalformat, int x, int y, sizei width,
  163. sizei height, int border);
  164. defines a two-dimensional texture image in exactly the manner of
  165. TexImage2D, except that the image data are taken from the framebuffer
  166. rather than from client memory. Currently, target must be one of
  167. TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X,
  168. TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y,
  169. TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
  170. TEXTURE_CUBE_MAP_NEGATIVE_Z.
  171. Change the last paragraph on page 160 to say (spec changes identical
  172. to EXT_texture_array):
  173. "Currently the target arguments of TexSubImage1D and CopyTexSubImage1D
  174. must be TEXTURE_1D, the target arguments of TexSubImage2D and
  175. CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT,
  176. TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
  177. TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
  178. TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the
  179. target arguments of TexSubImage3D and CopyTexSubImage3D must be
  180. TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..."
  181. -- Section 3.8.4 "Texture Parameters"
  182. Change the first paragraph (page 166) to say:
  183. "Various parameters control how the texel array is treated when
  184. specified or changed, and when applied to a fragment. Each parameter is
  185. set by calling
  186. void TexParameter{if}(enum target, enum pname, T param);
  187. void TexParameter{if}v(enum target, enum pname, T params);
  188. target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
  189. TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT."
  190. -- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail"
  191. Change the first paragraph (page 172) to say:
  192. "Let s(x,y) be the function that associates an s texture coordinate
  193. with each set of window coordinates (x,y) that lie within a primitive;
  194. define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y),
  195. v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t,
  196. and d_t are as defined by equations 3.15, 3.16, and 3.17 with
  197. w_s, h_s, and d_s equal to the width, height, and depth of the
  198. image array whose level is level_base. For a one-dimensional
  199. texture or a one-dimensional array texture, define v(x,y) = 0 and
  200. w(x,y) = 0; for a two-dimensional texture or a two-dimensional array
  201. texture, define w(x,y) = 0..."
  202. -- Section 3.8.8 "Texture Minification" in the section "Mipmapping"
  203. Change the third paragraph (page 174) to say:
  204. "For a two-dimensional texture, two-dimensional array texture, or
  205. cube map texture,"
  206. Change the fourth paragraph (page 174) to say:
  207. "And for a one-dimensional texture or a one-dimensional array texture,"
  208. After the first paragraph (page 175) add:
  209. "For one-dimensional array textures, h_b and d_b are treated as 1,
  210. regardless of the actual values, when performing mipmap calculations.
  211. For two-dimensional array textures, d_b is always treated as one,
  212. regardless of the actual value, when performing mipmap calculations."
  213. -- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping"
  214. Change the third paragraph (page 176) to say (spec changes identical
  215. to EXT_texture_array):
  216. "The contents of the derived arrays are computed by repeated, filtered
  217. reduction of the level_base array. For one- and two-dimensional array
  218. textures, each layer is filtered independently. ..."
  219. -- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping"
  220. Change first paragraph to say (spec changes identical to
  221. EXT_texture_array):
  222. "Mipmaps can be generated manually with the command
  223. void GenerateMipmapEXT(enum target);
  224. where <target> is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP,
  225. TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation
  226. affects the texture image attached to <target>. ..."
  227. -- Section 3.8.10 "Texture Completeness"
  228. Change the second paragaph (page 177) to say (spec changes identical
  229. to EXT_texture_array):
  230. "For one-, two-, or three-dimensional textures and one- or
  231. two-dimensional array textures, a texture is complete if the following
  232. conditions all hold true:"
  233. -- Section 3.8.11 "Texture State and Proxy State"
  234. Change the second and third paragraphs (page 179) to say (spec changes
  235. identical to EXT_texture_array):
  236. "In addition to image arrays for one-, two-, and three-dimensional
  237. textures, one- and two-dimensional array textures, and the six image
  238. arrays for the cube map texture, partially instantiated image arrays
  239. are maintained for one-, two-, and three-dimensional textures and one-
  240. and two-dimensional array textures. Additionally, a single proxy image
  241. array is maintained for the cube map texture. Each proxy image array
  242. includes width, height, depth, border width, and internal format state
  243. values, as well as state for the red, green, blue, alpha, luminance,
  244. and intensity component resolutions. Proxy image arrays do not include
  245. image data, nor do they include texture properties. When TexImage3D is
  246. executed with target specified as PROXY_TEXTURE_3D, the
  247. three-dimensional proxy state values of the specified level-of-detail
  248. are recomputed and updated. If the image array would not be supported
  249. by TexImage3D called with target set to TEXTURE 3D, no error is
  250. generated, but the proxy width, height, depth, border width, and
  251. component resolutions are set to zero. If the image array would be
  252. supported by such a call to TexImage3D, the proxy state values are set
  253. exactly as though the actual image array were being specified. No pixel
  254. data are transferred or processed in either case.
  255. Proxy arrays for one- and two-dimensional textures and one- and
  256. two-dimensional array textures are operated on in the same way when
  257. TexImage1D is executed with target specified as PROXY_TEXTURE_1D,
  258. TexImage2D is executed with target specified as PROXY_TEXTURE_2D or
  259. PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target
  260. specified as PROXY_TETXURE_2D_ARRAY_EXT."
  261. -- Section 3.8.12 "Texture Objects"
  262. Change section (page 180) to say (spec changes identical to
  263. EXT_texture_array):
  264. "In addition to the default textures TEXTURE_1D, TEXTURE_2D,
  265. TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT,
  266. named one-, two-, and three-dimensional, cube map, and one- and
  267. two-dimensional array texture objects can be created and operated upon.
  268. The name space for texture objects is the unsigned integers, with zero
  269. reserved by the GL.
  270. A texture object is created by binding an unused name to TEXTURE_1D,
  271. TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
  272. TEXTURE_2D_ARRAY_EXT. The binding is effected by calling
  273. void BindTexture(enum target, uint texture);
  274. with <target> set to the desired texture target and <texture> set to
  275. the unused name. The resulting texture object is a new state vector,
  276. comprising all the state values listed in section 3.8.11, set to the
  277. same initial values. If the new texture object is bound to TEXTURE_1D,
  278. TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
  279. TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-,
  280. three-dimensional, cube map, one- or two-dimensional array texture
  281. respectively until it is deleted.
  282. BindTexture may also be used to bind an existing texture object to
  283. either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
  284. TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error
  285. INVALID_OPERATION is generated if an attempt is made to bind a texture
  286. object of different dimensionality than the specified target. If the
  287. bind is successful no change is made to the state of the bound texture
  288. object, and any previous binding to target is broken.
  289. While a texture object is bound, GL operations on the target to which
  290. it is bound affect the bound object, and queries of the target to which
  291. it is bound return state from the bound object. If texture mapping of
  292. the dimensionality of the target to which a texture object is bound is
  293. enabled, the state of the bound texture object directs the texturing
  294. operation.
  295. In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
  296. TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have
  297. one-, two-, three-dimensional, cube map, and one- and two-dimensional
  298. array texture state vectors respectively associated with them. In order
  299. that access to these initial textures not be lost, they are treated as
  300. texture objects all of whose names are 0. The initial one-, two-,
  301. three-dimensional, cube map, one- and two-dimensional array textures
  302. are therefore operated upon, queried, and applied as TEXTURE_1D,
  303. TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and
  304. TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding
  305. targets.
  306. Change second paragraph on page 181 to say (spec changes identical to
  307. EXT_texture_array):
  308. "... If a texture that is currently bound to one of the targets
  309. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
  310. TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as
  311. though BindTexture had been executed with the same target and texture
  312. zero. ..."
  313. Change second paragraph on page 182 to say (spec changes identical to
  314. EXT_texture_array):
  315. "The texture object name space, including the initial one-, two-, and
  316. three dimensional, cube map, and one- and two-dimensional array texture
  317. objects, is shared among all texture units. ..."
  318. -- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes"
  319. Change second through fourth paragraphs (page 188) to say:
  320. "Let D_t be the depth texture value, in the range [0, 1]. For
  321. texture lookups from one- and two-dimesional, rectangle, and
  322. one-dimensional array targets, let R be the interpolated <r>
  323. texture coordinate, clamped to the range [0, 1]. For texture lookups
  324. from two-dimesional array texture targets, let R be the interpolated
  325. <q> texture coordinate, clamped to the range [0, 1]. Then the
  326. effective texture value L_t, I_t, or A_t is computed as follows:
  327. If the value of TEXTURE_COMPARE_MODE is NONE, then
  328. r = Dt
  329. If the value of TEXTURE_COMPARE_MODE is
  330. COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture
  331. comparison function as shown in table 3.27."
  332. -- Section 3.8.15 "Texture Application"
  333. Change the first paragraph (page 189) to say:
  334. "Texturing is enabled or disabled using the generic Enable and Disable
  335. commands, respectively, with the symbolic constants TEXTURE_1D,
  336. TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
  337. TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube
  338. map, one-dimensional array, or two-dimensional array texture,
  339. respectively. If both two- and one-dimensional textures are enabled,
  340. the two-dimensional texture is used. If the three-dimensional and
  341. either of the two- or one-dimensional textures is enabled, the
  342. three-dimensional texture is used. If the cube map texture and any of
  343. the three-, two-, or one-dimensional textures is enabled, then cube map
  344. texturing is used. If one-dimensional array texture is enabled and any
  345. of cube map, three-, two-, or one-dimensional textures is enabled,
  346. one-dimensional array texturing is used. If two-dimensional array
  347. texture is enabled and any of cube map, three-, two-, one-dimensional
  348. textures or one-dimensional array texture is enabled, two-dimensional
  349. array texturing is used..."
  350. -- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions):
  351. (mostly add to existing grammar rules)
  352. <optionName> ::= "MESA_texture_array"
  353. <texTarget> ::= "1D"
  354. | "2D"
  355. | "3D"
  356. | "CUBE"
  357. | "RECT"
  358. | <arrayTarget> (if program option is present)
  359. | <shadowTarget> (if program option is present)
  360. <arrayTarget> ::= "ARRAY1D"
  361. | "ARRAY2D"
  362. <shadowTarget> ::= "SHADOW1D"
  363. | "SHADOW2D"
  364. | "SHADOWRECT"
  365. | <shadowArrayTarget> (if program option is present)
  366. <shadowArrayTarget> ::= "SHADOWARRAY1D"
  367. | "SHADOWARRAY2D"
  368. -- Add Section 3.11.4.5.4 "Texture Stack Option"
  369. "If a fragment program specifies the "MESA_texture_array" program
  370. option, the <texTarget> rule is modified to add the texture targets
  371. ARRAY1D and ARRAY2D (See Section 3.11.2)."
  372. -- Section 3.11.6 "Fragment Program Texture Instruction Set"
  373. (replace 1st and 2nd paragraphs with the following paragraphs)
  374. "The first three texture instructions described below specify the
  375. mapping of 4-tuple input vectors to 4-tuple output vectors.
  376. The sampling of the texture works as described in section 3.8,
  377. except that texture environments and texture functions are not
  378. applicable, and the texture enables hierarchy is replaced by explicit
  379. references to the desired texture target (i.e., 1D, 2D, 3D, cube map,
  380. rectangle, ARRAY1D, ARRAY2D). These texture instructions specify
  381. how the 4-tuple is mapped into the coordinates used for sampling. The
  382. following function is used to describe the texture sampling in the
  383. descriptions below:
  384. vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit,
  385. enum texTarget);
  386. Note that not all four components of the texture coordinates <coord>
  387. are used by all texture targets. Component usage for each <texTarget>
  388. is defined in table X.
  389. coordinates used
  390. texTarget Texture Type s t r layer shadow
  391. ---------------- --------------------- ----- ----- ------
  392. 1D TEXTURE_1D x - - - -
  393. 2D TEXTURE_2D x y - - -
  394. 3D TEXTURE_3D x y z - -
  395. CUBE TEXTURE_CUBE_MAP x y z - -
  396. RECT TEXTURE_RECTANGLE_ARB x y - - -
  397. ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y -
  398. ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z -
  399. SHADOW1D TEXTURE_1D x - - - z
  400. SHADOW2D TEXTURE_2D x y - - z
  401. SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z
  402. SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z
  403. SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w
  404. Table X: Texture types accessed for each of the <texTarget>, and
  405. coordinate mappings. The "coordinates used" column indicate the
  406. input values used for each coordinate of the texture lookup, the
  407. layer selector for array textures, and the reference value for
  408. texture comparisons."
  409. -- Section 3.11.6.2 "TXP: Project coordinate and map to color"
  410. Add to the end of the section:
  411. "A program will fail to load if the TXP instruction is used in
  412. conjunction with the SHADOWARRAY2D target."
  413. Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations)
  414. -- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer"
  415. Add to the end of the section (spec changes identical to
  416. EXT_texture_array):
  417. "The command
  418. void FramebufferTextureLayerEXT(enum target, enum attachment,
  419. uint texture, int level, int layer);
  420. operates identically to FramebufferTexture3DEXT, except that it
  421. attaches a single layer of a three-dimensional texture or a one- or
  422. two-dimensional array texture. <layer> is an integer indicating the
  423. layer number, and is treated identically to the <zoffset> parameter in
  424. FramebufferTexture3DEXT. The error INVALID_VALUE is generated if
  425. <layer> is negative. The error INVALID_OPERATION is generated if
  426. <texture> is non-zero and is not the name of a three dimensional
  427. texture or one- or two-dimensional array texture. Unlike
  428. FramebufferTexture3D, no <textarget> parameter is accepted.
  429. If <texture> is non-zero and the command does not result in an error,
  430. the framebuffer attachment state corresponding to <attachment> is
  431. updated as in the other FramebufferTexture commands, except that
  432. FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to <layer>."
  433. -- Section 4.4.4.1 "Framebuffer Attachment Completeness"
  434. Add to the end of the list of completeness rules (spec changes
  435. identical to EXT_texture_array):
  436. "* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
  437. FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or
  438. two-dimensional array texture, then
  439. FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the
  440. number of layers in the texture."
  441. Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
  442. -- Section 5.4 "Display Lists"
  443. Change the first paragraphi on page 242 to say (spec changes
  444. identical to EXT_texture_array):
  445. "TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are
  446. executed immediately when called with the corresponding proxy arguments
  447. PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D,
  448. PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT;
  449. PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE,
  450. PROXY_POST_CONVOLUTION_COLOR_TABLE, or
  451. PROXY_POST_COLOR_MATRIX_COLOR_TABLE."
  452. Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests)
  453. -- Section 6.1.3 "Enumerated Queries"
  454. Add after the line beginning "If the value of
  455. FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes
  456. identical to EXT_texture_array):
  457. "If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the
  458. texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a
  459. three-dimensional texture or a one- or two-dimensional array texture,
  460. then <params> will contain the number of texture layer attached to the
  461. attachment point. Otherwise, <params> will contain the value zero."
  462. -- Section 6.1.4 "Texture Queries"
  463. Change the first three paragraphs (page 248) to say (spec changes
  464. identical to EXT_texture_array):
  465. "The command
  466. void GetTexImage(enum tex, int lod, enum format,
  467. enum type, void *img);
  468. is used to obtain texture images. It is somewhat different from the
  469. other get commands; tex is a symbolic value indicating which texture
  470. (or texture face in the case of a cube map texture target name) is to
  471. be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT,
  472. and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional
  473. texture, or one- or two-dimensional array texture, respectively.
  474. TEXTURE_CUBE_MAP_POSITIVE_X, ...
  475. GetTexImage obtains... from the first image to the last for
  476. three-dimensional textures. One- and two-dimensional array textures
  477. are treated as two- and three-dimensional images, respectively, where
  478. the layers are treated as rows or images. These groups are then...
  479. For three-dimensional and two-dimensional array textures, pixel storage
  480. operations are applied as if the image were two-dimensional, except
  481. that the additional pixel storage state values PACK_IMAGE_HEIGHT and
  482. PACK_SKIP_IMAGES are applied. ..."
  483. Additions to Appendix A of the OpenGL 2.0 Specification (Invariance)
  484. None
  485. Additions to the AGL/GLX/WGL Specifications
  486. None
  487. GLX Protocol
  488. None
  489. Dependencies on ARB_fragment_program
  490. If ARB_fragment_program is not supported, the changes to section 3.11
  491. should be ignored.
  492. Dependencies on EXT_framebuffer_object
  493. If EXT_framebuffer_object is not supported, the changes to section
  494. 3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored.
  495. Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc
  496. (Identical dependency as EXT_texture_array.)
  497. S3TC texture compression is supported for two-dimensional array textures.
  498. When <target> is TEXTURE_2D_ARRAY_EXT, each layer is stored independently
  499. as a compressed two-dimensional textures. When specifying or querying
  500. compressed images using one of the S3TC formats, the images are provided
  501. and/or returned as a series of two-dimensional textures stored
  502. consecutively in memory, with the layer closest to zero specified first.
  503. For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in
  504. the three-dimensional compression format provided in the
  505. EXT_texture_compression_vtc extension. Pixel store parameters, including
  506. those specific to three-dimensional images, are ignored when compressed
  507. image data are provided or returned, as in the
  508. EXT_texture_compression_s3tc extension.
  509. S3TC compression is not supported for one-dimensional texture targets in
  510. EXT_texture_compression_s3tc, and is not supported for one-dimensional
  511. array textures in this extension. If compressed one-dimensional arrays
  512. are needed, use a two-dimensional texture with a height of one.
  513. This extension allows the use of the four S3TC internal format types in
  514. TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls.
  515. Errors
  516. None
  517. New State
  518. (add to table 6.15, p. 276)
  519. Initial
  520. Get Value Type Get Command Value Description Sec. Attribute
  521. ---------------------------- ----- ----------- ----- -------------------- ------ ---------
  522. TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
  523. to TEXTURE_1D_ARRAY
  524. TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
  525. to TEXTURE_2D_ARRAY
  526. New Implementation Dependent State
  527. (add to Table 6.32, p. 293)
  528. Minimum
  529. Get Value Type Get Command Value Description Sec. Attribute
  530. ---------------------------- ---- ----------- ------- ------------------ ----- ---------
  531. MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 -
  532. layers for texture
  533. arrays
  534. Issues
  535. (1) Is "texture stack" a good name for this functionality?
  536. NO. The name is changed to "array texture" to match the
  537. nomenclature used by GL_EXT_texture_array.
  538. (2) Should the R texture coordinate be treated as normalized or
  539. un-normalized? If it were un-normalized, floor(R) could be thought
  540. of as a direct index into the array texture. This may be more
  541. convenient for applications.
  542. RESOLVED. All texture coordinates are normalized. The issue of
  543. un-normalized texture coordinates has been discussed in the ARB
  544. before and should be left for a layered extension.
  545. RE-RESOLVED. The R coordinate is un-normalized. Accessing an array
  546. using [0, layers-1] coordinates is much more natural.
  547. (3) How does LOD selection work for stacked textures?
  548. RESOLVED. For 2D array textures the R coordinate is ignored, and
  549. the LOD selection equations for 2D textures are used. For 1D
  550. array textures the T coordinate is ignored, and the LOD selection
  551. equations for 1D textures are used. The expected usage is in a
  552. fragment program with an explicit LOD selection.
  553. (4) What is the maximum size of a 2D array texture? Is it the same
  554. as for a 3D texture, or should a new query be added? How about for 1D
  555. array textures?
  556. RESOLVED. A new query is added.
  557. (5) How are array textures exposed in GLSL?
  558. RESOLVED. Use GL_EXT_texture_array.
  559. (6) Should a 1D array texture also be exposed?
  560. RESOLVED. For orthogonality, yes.
  561. (7) How are stacked textures attached to framebuffer objects?
  562. RESOLVED. Layers of both one- and two-dimensional array textures
  563. are attached using FreambufferTextureLayerEXT. Once attached, the
  564. array texture layer behaves exactly as either a one- or
  565. two-dimensional texture.
  566. (8) How is this extension related to GL_EXT_texture_array?
  567. This extension adapats GL_MESAX_texture_stack to the notation,
  568. indexing, and FBO access of GL_EXT_texture_array. This extension
  569. replaces the GLSL support of GL_EXT_texture_array with
  570. GL_ARB_fragment_program support.
  571. Assembly program support is also provided by GL_NV_gpu_program4.
  572. GL_NV_gpu_program4 also adds support for other features that are
  573. specific to Nvidia hardware, while this extension adds only support
  574. for array textures.
  575. Much of text of this extension that has changed since
  576. GL_MESAX_texture_stack comes directly from either
  577. GL_EXT_texture_array or GL_NV_gpu_program4.
  578. Revision History
  579. ||2005/11/15||0.1||idr||Initial draft MESAX version.||
  580. ||2005/12/07||0.2||idr||Added framebuffer object interactions.||
  581. ||2005/12/12||0.3||idr||Updated fragment program interactions.||
  582. ||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.||