Clone of mesa.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

MESA_texture_array.spec 35KB

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