blob: fd629e7b3a5b95e59f9b8790cc9b1b05f9b228b3 [file] [log] [blame]
daniel@transgaming.com5933c442011-11-12 04:44:03 +00001Name
2
3 EXT_texture_storage
4
5Name Strings
6
7 GL_EXT_texture_storage
8
9Contact
10
11 Bruce Merry (bmerry 'at' gmail.com)
12 Ian Romanick, Intel (ian.d.romanick 'at' intel.com)
13
14Contributors
15
16 Jeremy Sandmel, Apple
17 Bruce Merry, ARM
18 Tom Olson, ARM
19 Benji Bowman, Imagination Technologies
20 Ian Romanick, Intel
21 Jeff Bolz, NVIDIA
22 Pat Brown, NVIDIA
23 Maurice Ribble, Qualcomm
24 Lingjun Chen, Qualcomm
25 Daniel Koch, Transgaming Inc
26
27Status
28
29 Complete.
30
31Version
32
33 Last Modified Date: November 11, 2011
34 Author Revision: 24
35
36Number
37
daniel@transgaming.com55693832012-01-17 14:28:13 +000038 OpenGL ES Extension #108
daniel@transgaming.com5933c442011-11-12 04:44:03 +000039
40Dependencies
41
42 OpenGL ES 1.0, OpenGL ES 2.0 or OpenGL 1.2 is required.
43
44 OES_texture_npot, OES_texture_cube_map, OES_texture_3D,
45 OES_depth_texture, OES_packed_depth_stencil,
46 OES_compressed_paletted_texture, OES_texture_float, OES_texture_half_float
47 EXT_texture_type_2_10_10_10_REV, EXT_texture_format_BGRA8888,
48 EXT_texture3D, OES_texture_npot, APPLE_texture_2D_limited_npot,
49 ARB_texture_cube_map, ARB_texture_cube_map_array,
50 ARB_texture_rectangle, SGIS_generate_mipmap,
51 EXT_direct_state_access, OES_EGL_image, WGL_ARB_render_texture,
52 GLX_EXT_texture_from_pixmap, and core specifications that
53 incorporate these extensions affect the definition of this
54 extension.
55
56 This extension is written against the OpenGL 3.2 Core Profile
57 specification.
58
59Overview
60
61 The texture image specification commands in OpenGL allow each level
62 to be separately specified with different sizes, formats, types and
63 so on, and only imposes consistency checks at draw time. This adds
64 overhead for implementations.
65
66 This extension provides a mechanism for specifying the entire
67 structure of a texture in a single call, allowing certain
68 consistency checks and memory allocations to be done up front. Once
69 specified, the format and dimensions of the image array become
70 immutable, to simplify completeness checks in the implementation.
71
72 When using this extension, it is no longer possible to supply texture
73 data using TexImage*. Instead, data can be uploaded using TexSubImage*,
74 or produced by other means (such as render-to-texture, mipmap generation,
75 or rendering to a sibling EGLImage).
76
77 This extension has complicated interactions with other extensions.
78 The goal of most of these interactions is to ensure that a texture
79 is always mipmap complete (and cube complete for cubemap textures).
80
81IP Status
82
83 No known IP claims
84
85New Procedures and Functions
86
87 void TexStorage1DEXT(enum target, sizei levels,
88 enum internalformat,
89 sizei width);
90
91 void TexStorage2DEXT(enum target, sizei levels,
92 enum internalformat,
93 sizei width, sizei height);
94
95 void TexStorage3DEXT(enum target, sizei levels,
96 enum internalformat,
97 sizei width, sizei height, sizei depth);
98
99 void TextureStorage1DEXT(uint texture, enum target, sizei levels,
100 enum internalformat,
101 sizei width);
102
103 void TextureStorage2DEXT(uint texture, enum target, sizei levels,
104 enum internalformat,
105 sizei width, sizei height);
106
107 void TextureStorage3DEXT(uint texture, enum target, sizei levels,
108 enum internalformat,
109 sizei width, sizei height, sizei depth);
110
111New Types
112
113 None
114
115New Tokens
116
117 Accepted by the <value> parameter of GetTexParameter{if}v:
118
119 TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
120
121 Accepted by the <internalformat> parameter of TexStorage* when
122 implemented on OpenGL ES:
123
124 ALPHA8_EXT 0x803C /* reuse tokens from EXT_texture */
125 LUMINANCE8_EXT 0x8040
126 LUMINANCE8_ALPHA8_EXT 0x8045
127
128 (if OES_texture_float is supported)
129 RGBA32F_EXT 0x8814 /* reuse tokens from ARB_texture_float */
130 RGB32F_EXT 0x8815
131 ALPHA32F_EXT 0x8816
132 LUMINANCE32F_EXT 0x8818
133 LUMINANCE_ALPHA32F_EXT 0x8819
134
135 (if OES_texture_half_float is supported)
136 RGBA16F_EXT 0x881A /* reuse tokens from ARB_texture_float */
137 RGB16F_EXT 0x881B
138 ALPHA16F_EXT 0x881C
139 LUMINANCE16F_EXT 0x881E
140 LUMINANCE_ALPHA16F_EXT 0x881F
141
142 (if EXT_texture_type_2_10_10_10_REV is supported)
143 RGB10_A2_EXT 0x8059 /* reuse tokens from EXT_texture */
144 RGB10_EXT 0x8052
145
146 (if EXT_texture_format_BGRA8888 is supported)
147 BGRA8_EXT 0x93A1
148
149
150Additions to Chapter 2 of the OpenGL 3.2 Core Profile Specification
151(OpenGL Operation)
152
153 None
154
155Additions to Chapter 3 of the OpenGL 3.2 Core Profile Specification
156(Rasterization)
157
158 After section 3.8.1 (Texture Image Specification) add a new
159 subsection called "Immutable-format texture images":
160
161 "An alterative set of commands is provided for specifying the
162 properties of all levels of a texture at once. Once a texture is
163 specified with such a command, the format and dimensions of all
164 levels becomes immutable, unless it is a proxy texture (since
165 otherwise it would no longer be possible to use the proxy). The
166 contents of the images and the parameters can still be modified.
167 Such a texture is referred to as an "immutable-format" texture. The
168 immutability status of a texture can be determined by calling
169 GetTexParameter with <pname> TEXTURE_IMMUTABLE_FORMAT_EXT.
170
171 Each of the commands below is described by pseudo-code which
172 indicates the effect on the dimensions and format of the texture.
173 For all of the commands, the following apply in addition to the
174 pseudo-code:
175
176 - If the default texture object is bound to <target>, an
177 INVALID_OPERATION error is generated.
178 - If executing the pseudo-code would lead to an error, the error is
179 generated and the command will have no effect.
180 - Any existing levels that are not replaced are reset to their
181 initial state.
182 - If <width>, <height>, <depth> or <levels> is less than 1, the
183 error INVALID_VALUE is generated.
184 - Since no pixel data are provided, the <format> and <type> values
185 used in the pseudo-code are irrelevant; they can be considered to
186 be any values that are legal to use with <internalformat>.
187 - If the command is successful, TEXTURE_IMMUTABLE_FORMAT_EXT becomes
188 TRUE.
189 - If <internalformat> is a specific compressed texture format, then
190 references to TexImage* should be replaced by CompressedTexImage*,
191 with <format>, <type> and <data> replaced by any valid <imageSize> and
192 <data>. If there is no <imageSize> for which this command would have
193 been valid, an INVALID_OPERATION error is generated [fn: This
194 condition is not required for OpenGL, but is necessary for OpenGL
195 ES which does not support on-the-fly compression.]
196 - If <internalformat> is one of the internal formats listed in table
197 3.11, an INVALID_ENUM error is generated. [fn: The corresponding table
198 in OpenGL ES 2.0 is table 3.8.]
199
200 The command
201
202 void TexStorage1DEXT(enum target, sizei levels,
203 enum internalformat,
204 sizei width);
205
206 specifies all the levels of a one-dimensional texture (or proxy) at
207 the same time. It is described by the pseudo-code below:
208
209 for (i = 0; i < levels; i++)
210 {
211 TexImage1D(target, i, internalformat, width, 0,
212 format, type, NULL);
213 width = max(1, floor(width / 2));
214 }
215
216 If <target> is not TEXTURE_1D or PROXY_TEXTURE_1D then INVALID_ENUM
217 is generated. If <levels> is greater than floor(log_2(width)) + 1
218 then INVALID_OPERATION is generated.
219
220 The command
221
222 void TexStorage2DEXT(enum target, sizei levels,
223 enum internalformat,
224 sizei width, sizei height);
225
226 specifies all the levels of a two-dimensional, cube-map,
227 one-dimension array or rectangle texture (or proxy) at the same
228 time. The pseudo-code depends on the <target>:
229
230 [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_RECTANGLE or
231 PROXY_TEXTURE_CUBE_MAP:
232
233 for (i = 0; i < levels; i++)
234 {
235 TexImage2D(target, i, internalformat, width, height, 0,
236 format, type, NULL);
237 width = max(1, floor(width / 2));
238 height = max(1, floor(height / 2));
239 }
240
241 TEXTURE_CUBE_MAP:
242
243 for (i = 0; i < levels; i++)
244 {
245 for face in (+X, -X, +Y, -Y, +Z, -Z)
246 {
247 TexImage2D(face, i, internalformat, width, height, 0,
248 format, type, NULL);
249 }
250 width = max(1, floor(width / 2));
251 height = max(1, floor(height / 2));
252 }
253
254 [PROXY_]TEXTURE_1D_ARRAY:
255
256 for (i = 0; i < levels; i++)
257 {
258 TexImage2D(target, i, internalformat, width, height, 0,
259 format, type, NULL);
260 width = max(1, floor(width / 2));
261 }
262
263 If <target> is not one of those listed above, the error INVALID_ENUM
264 is generated.
265
266 The error INVALID_OPERATION is generated if any of the following
267 conditions hold:
268 - <target> is [PROXY_]TEXTURE_1D_ARRAY and <levels> is greater than
269 floor(log_2(width)) + 1
270 - <target> is not [PROXY_]TEXTURE_1D_ARRAY and <levels> is greater
271 than floor(log_2(max(width, height))) + 1
272
273 The command
274
275 void TexStorage3DEXT(enum target, sizei levels, enum internalformat,
276 sizei width, sizei height, sizei depth);
277
278 specifies all the levels of a three-dimensional, two-dimensional
279 array texture, or cube-map array texture (or proxy). The pseudo-code
280 depends on <target>:
281
282 [PROXY_]TEXTURE_3D:
283
284 for (i = 0; i < levels; i++)
285 {
286 TexImage3D(target, i, internalformat, width, height, depth, 0,
287 format, type, NULL);
288 width = max(1, floor(width / 2));
289 height = max(1, floor(height / 2));
290 depth = max(1, floor(depth / 2));
291 }
292
293 [PROXY_]TEXTURE_2D_ARRAY, [PROXY_]TEXTURE_CUBE_MAP_ARRAY_ARB:
294
295 for (i = 0; i < levels; i++)
296 {
297 TexImage3D(target, i, internalformat, width, height, depth, 0,
298 format, type, NULL);
299 width = max(1, floor(width / 2));
300 height = max(1, floor(height / 2));
301 }
302
303 If <target> is not one of those listed above, the error INVALID_ENUM
304 is generated.
305
306 The error INVALID_OPERATION is generated if any of the following
307 conditions hold:
308 - <target> is [PROXY_]TEXTURE_3D and <levels> is greater than
309 floor(log_2(max(width, height, depth))) + 1
310 - <target> is [PROXY_]TEXTURE_2D_ARRAY or
311 [PROXY_]TEXTURE_CUBE_MAP_ARRAY_EXT and <levels> is greater than
312 floor(log_2(max(width, height))) + 1
313
314 After a successful call to any TexStorage* command with a non-proxy
315 target, the value of TEXTURE_IMMUTABLE_FORMAT_EXT for this texture
316 object is set to TRUE, and no further changes to the dimensions or
317 format of the texture object may be made. Other commands may only
318 alter the texel values and texture parameters. Using any of the
319 following commands with the same texture will result in the error
320 INVALID_OPERATION being generated, even if it does not affect the
321 dimensions or format:
322
323 - TexImage*
324 - CompressedTexImage*
325 - CopyTexImage*
326 - TexStorage*
327
328 The TextureStorage* commands operate identically to the
329 corresponding command where "Texture" is substituted for "Tex"
330 except, rather than updating the current bound texture for the
331 texture unit indicated by the current active texture state and the
332 target parameter, these "Texture" commands update the texture object
333 named by the initial texture parameter. The error INVALID_VALUE
334 is generated if <texture> is zero.
335 "
336
337 In section 3.8.6 (Texture Parameters), after the sentence
338
339 "In the remainder of section 3.8, denote by lod_min, lod_max,
340 level_base, and level_max the values of the texture parameters
341 TEXTURE_MIN_LOD, TEXTURE_MAX_LOD, TEXTURE_BASE_LEVEL, and
342 TEXTURE_MAX_LEVEL respectively."
343
344 add
345
346 "However, if TEXTURE_IMMUTABLE_FORMAT_EXT is
347 TRUE, then level_base is clamped to the range [0, <levels> - 1] and
348 level_max is then clamped to the range [level_base, <levels> - 1],
349 where <levels> is the parameter passed the call to TexStorage* for
350 the texture object.
351
352 In section 3.8.9 (Rendering feedback loops) replace all references
353 to TEXTURE_BASE_LEVEL by level_base.
354
355 In section 3.8.9 (Mipmapping), replace the paragraph starting "Each
356 array in a mipmap is defined..." by
357
358 "Each array in a mipmap is defined using TexImage3D, TexImage2D,
359 CopyTexImage2D, TexImage1D, CopyTexImage1D, or by functions that are
360 defined in terms of these functions. Level-of-detail numbers proceed
361 from level_base for the original texel array through the maximum
362 level p, with each unit increase indicating an array of half the
363 dimensions of the previous one (rounded down to the next integer if
364 fractional) as already described. For immutable-format textures,
365 p is one less than the <levels> parameter passed to TexStorage*;
366 otherwise p = floor(log_2(maxsize)) + level_base. All arrays from
367 level_base through q = min(p, level_max) must be defined, as
368 discussed in section 3.8.12."
369
370 In section 3.8.12 (Texture Completeness), modify the last sentence
371 to avoid refering to level_base and level_max:
372
373 "An implementation may allow a texture image array of level 1 or
374 greater to be created only if a mipmap complete set of image arrays
375 consistent with the requested array can be supported where the
376 values of TEXTURE_BASE_LEVEL and TEXTURE_MAX_LEVEL are 0 and 1000
377 respectively."
378
379 Modify section 3.8.13 (Texture State and Proxy State) to add the new
380 state:
381
382 "Each set consists of ..., and a boolean flag indicating whether the
383 format and dimensions of the texture are immutable."
384
385 Add
386 "The initial value of TEXTURE_IMMUTABLE_FORMAT_EXT is FALSE."
387
388Additions to Chapter 4 of the OpenGL 3.2 Core Profile Specification
389(Per-Fragment Operations and the Frame Buffer)
390
391 None
392
393Additions to Chapter 5 of the OpenGL 3.2 Compatibility Profile Specification
394(Special Functions)
395
396 In section 5.4.1 (Commands Not Usable in Display Lists), add
397 TexStorage* to the list of commands that cannot be used.
398
399Additions to Chapter 6 of the OpenGL 3.2 Core Profile Specification
400(State and State Requests)
401
402 Replace the following statement in 6.1.3 (Enumerated Queries):
403
404 "<value> must be one of the symbolic values in table 3.10."
405
406 with
407
408 "<value> must be TEXTURE_IMMUTABLE_FORMAT_EXT or one of the symbolic
409 values in table 3.22."
410
411Additions to the AGL/EGL/GLX/WGL Specifications
412
413 None
414
415Additions to OES_compressed_ETC1_RGB8_texture
416
417 Add the following to the additions to Chapter 3:
418
419 "Since ETC1 images are easily edited along 4x4 texel boundaries, the
420 limitations on CompressedTexSubImage2D are relaxed.
421 CompressedTexSubImage2D will result in an INVALID_OPERATION error
422 only if one of the following conditions occurs:
423
424 * <width> is not a multiple of four, and <width> plus <xoffset> is not
425 equal to the texture width;
426
427 * <height> is not a multiple of four, and <height> plus <yoffset> is
428 not equal to the texture height; or
429
430 * <xoffset> or <yoffset> is not a multiple of four.
431
432 Remove CompressedTexSubImage2D from this error:
433
434 "INVALID_OPERATION is generated by CompressedTexSubImage2D,
435 TexSubImage2D, or CopyTexSubImage2D if the texture image <level>
436 bound to <target> has internal format ETC1_RGB8_OES."
437
438 Add the following error:
439
440 "INVALID_OPERATION is generated by CompressedTexSubImage2D
441 if the region to be modified is not aligned to block boundaries
442 (refer to the extension text for details)."
443
444Additions to AMD_compressed_ATC_texture and AMD_compressed_3DC_texture:
445
446 Apply the same changes as for OES_compressed_ETC1_RGB8_texture
447 above, substituting the appropriate internal format tokens from
448 these extensions.
449
450Dependencies on EXT_direct_state_access
451
452 If EXT_direct_state_access is not present, references to
453 TextureStorage* should be ignored.
454
455Dependencies on OpenGL ES
456
457 On OpenGL ES without extensions introducing TEXTURE_MAX_LEVEL,
458 mipmapped textures specified with TexStorage are required to have a
459 full set of mipmaps. If TEXTURE_MAX_LEVEL is not supported, this
460 extension is modified as follows:
461
462 - Where an upper bound is placed on <levels> in this extension (i.e.
463 the maximum number of mipmap levels for a texture of the given
464 target and dimensions), an INVALID_OPERATION error is generated if
465 <levels> is neither 1 nor this upper bound.
466 - q (the effective maximum number of levels) is redefined to clamp
467 to the number of levels present in immutable-format textures.
468
469 OpenGL ES does not accept sized internal formats (e.g., RGBA8) and
470 instead derives an internal format from the <format> and <type>
471 parameters of TexImage2D. Since TexStorage* does not specify texel
472 data, the API doesn't include <format> and <type> parameters.
473 On an OpenGL ES implementation, the values in the <internalformat>
474 column in the tables below are accepted as <internalformat>
475 parameters, and base internal formats are not accepted. The
476 TexImage* calls in the TexStorage* pseudocode are modified so that
477 the <internalformat>, <format> and <type> parameters are
478 taken from the <format>, <format> and <type> columns (respectively)
479 in the tables below, according to the <internalformat>
480 specified in the TexStorage* command.
481
482 <internalformat> <format> <type>
483 ---------------- -------- ------
484 RGB565 RGB UNSIGNED_SHORT_5_6_5
485 RGBA4 RGBA UNSIGNED_SHORT_4_4_4_4
486 RGB5_A1 RGBA UNSIGNED_SHORT_5_5_5_1
487 RGB8_OES RGB UNSIGNED_BYTE
488 RGBA8_OES RGBA UNSIGNED_BYTE
489 LUMINANCE8_ALPHA8_EXT LUMINANCE_ALPHA UNSIGNED_BYTE
490 LUMINANCE8_EXT LUMINANCE UNSIGNED_BYTE
491 ALPHA8_EXT ALPHA UNSIGNED_BYTE
492
493 If OES_depth_texture is supported:
494
495 <internalformat> <format> <type>
496 ---------------- -------- ------
497 DEPTH_COMPONENT16_OES DEPTH_COMPONENT UNSIGNED_SHORT
498 DEPTH_COMPONENT32_OES DEPTH_COMPONENT UNSIGNED_INT
499
500 If OES_packed_depth_stencil is supported:
501
502 <internalformat> <format> <type>
503 ---------------- -------- ------
504 DEPTH24_STENCIL8_OES DEPTH_STENCIL_OES UNSIGNED_INT
505
506 If OES_texture_float is supported:
507
508 <internalformat> <format> <type>
509 ---------------- -------- ------
510 RGBA32F_EXT RGBA FLOAT
511 RGB32F_EXT RGB FLOAT
512 LUMINANCE_ALPHA32F_EXT LUMINANCE_ALPHA FLOAT
513 LUMINANCE32F_EXT LUMINANCE FLOAT
514 ALPHA32F_EXT ALPHA FLOAT
515
516 If OES_texture_half_float is supported:
517
518 <internalformat> <format> <type>
519 ---------------- -------- ------
520 RGBA16F_EXT RGBA HALF_FLOAT_OES
521 RGB16F_EXT RGB HALF_FLOAT_OES
522 LUMINANCE_ALPHA16F_EXT LUMINANCE_ALPHA HALF_FLOAT_OES
523 LUMINANCE16F_EXT LUMINANCE HALF_FLOAT_OES
524 ALPHA16F_EXT ALPHA HALF_FLOAT_OES
525
526 If EXT_texture_type_2_10_10_10_REV is supported:
527
528 <internalformat> <format> <type>
529 ---------------- -------- ------
530 RGB10_A2_EXT RGBA UNSIGNED_INT_2_10_10_10_REV_EXT
531 RGB10_EXT RGB UNSIGNED_INT_2_10_10_10_REV_EXT
532
533 If EXT_texture_format_BGRA8888 is supported:
534
535 <internalformat> <format> <type>
536 ---------------- -------- ------
537 BGRA8_EXT BGRA_EXT UNSIGNED_BYTE
538
539
540Dependencies on texture targets
541
542 If a particular texture target is not supported by the
543 implementation, passing it as a <target> to TexStorage* will
544 generate an INVALID_ENUM error. If as a result, any of the commands
545 defined in this extension would no longer have any valid <target>,
546 all references to the command should be ignored.
547
548 In particular, note that OpenGL ES 1.x/2.0 do not have proxy textures,
549 1D textures, or 3D textures, and thus only the TexStorage2DEXT
550 entry point is required. If OES_texture_3D is supported, the
551 TexStorage3DEXT entry point is also required.
552
553Dependencies on OES_texture_npot
554
555 If OpenGL ES 2.0 or APPLE_texture_2D_limited_npot is present but
556 OES_texture_npot is not present, then INVALID_OPERATION is
557 generated by TexStorage* and TexStorage3DEXT if <levels> is
558 not one and <width>, <height> or <depth> is not a power of
559 two.
560
561Dependencies on WGL_ARB_render_texture, GLX_EXT_texture_from_pixmap, EGL
5621.4 and GL_OES_EGL_image
563
564 The commands eglBindTexImage, wglBindTexImageARB, glXBindTexImageEXT or
565 EGLImageTargetTexture2DOES are not permitted on an immutable-format
566 texture.
567 They will generate the following errors:
568 - EGLImageTargetTexture2DOES: INVALID_OPERATION
569 - eglBindTexImage: EGL_BAD_MATCH
570 - wglBindTexImage: ERROR_INVALID_OPERATION
571 - glXBindTexImageEXT: BadMatch
572
573Dependencies on OES_compressed_paletted_texture
574
575 The compressed texture formats exposed by
576 OES_compressed_paletted_texture are not supported by TexStorage*.
577 Passing one of these tokens to TexStorage* will generate an
578 INVALID_ENUM error.
579
580Errors
581
582 Note that dependencies above modify the errors.
583
584 If TexStorage* is called with a <width>, <height>, <depth> or
585 <levels> parameter that is less than one, then the error
586 INVALID_VALUE is generated.
587
588 If the <target> parameter to TexStorage1DEXT is not
589 [PROXY_]TEXTURE_1D, then the error INVALID_ENUM is generated.
590
591 If the <target> parameter to TexStorage2DEXT is not
592 [PROXY_]TEXTURE_2D, [PROXY_]TEXTURE_CUBE_MAP,
593 [PROXY_]TEXTURE_RECTANGLE or [PROXY_]TEXTURE_1D_ARRAY, then the
594 error INVALID_ENUM is generated.
595
596 If the <target> parameter to TexStorage3DEXT is not
597 [PROXY_]TEXTURE_3D, [PROXY_]TEXTURE_2D_ARRAY or
598 [PROXY_]TEXTURE_CUBE_MAP_ARRAY then the error INVALID_ENUM is
599 generated.
600
601 If the <levels> parameter to TexStorage* is greater than the
602 <target>-specific value listed below then the error
603 INVALID_OPERATION is generated:
604 [PROXY_]TEXTURE_{1D,1D_ARRAY}:
605 floor(log_2(width)) + 1
606 [PROXY_]TEXTURE_{2D,2D_ARRAY,CUBE_MAP,CUBE_MAP_ARRAY}:
607 floor(log_2(max(width, height))) + 1
608 [PROXY_]TEXTURE_3D:
609 floor(log_2(max(width, height, depth))) + 1
610 [PROXY_]TEXTURE_RECTANGLE:
611 1
612
613 If the default texture object is bound to the <target> passed to
614 TexStorage*, then the error INVALID_OPERATION is generated.
615
616 If the <target> parameter to TextureStorage* does not match the
617 dimensionality of <texture>, then the error INVALID_OPERATION is
618 generated.
619
620 If the <texture> parameter to TextureStorage* is zero, then the
621 INVALID_VALUE is generated.
622
623 If any pseudo-code listed in this extension would generate an error,
624 then that error is generated.
625
626 Calling any of the following functions on a texture for which
627 TEXTURE_IMMUTABLE_FORMAT_EXT is TRUE will generate an
628 INVALID_OPERATION error:
629 - TexImage*
630 - CompressedTexImage*
631 - CopyTexImage*
632
633New State
634
635 Additions to Table 6.8 Textures (state per texture object)
636
637 Initial
638 Get Value Type Get Command Value Description Sec.
639 --------- ---- ----------- ------- ----------- ----
640 TEXTURE_IMMUTABLE_FORMAT_EXT B GetTexParameter FALSE Size and format immutable 2.6
641
642New Implementation Dependent State
643
644 None
645
646Issues
647
648 1. What should this extension be called?
649
650 RESOLVED: EXT_texture_storage is chosen for consistency with the
651 glRenderbufferStorage entry point.
652
653 2. Should TexStorage* accept a border parameter?
654
655 RESOLVED: no.
656
657 DISCUSSION: Currently it does not, since borders are a deprecated
658 feature which is not supported by all hardware. Users of the
659 compatibility profile can continue to use the existing texture
660 specification functions, but there is an argument that users of
661 compatibility profile may also want to use this extension.
662
663 3. What is the correct error when <levels> specifies a partial
664 mipmap pyramid for OpenGL ES?
665
666 RESOLVED: INVALID_OPERATION, since it is an interaction between
667 parameters rather than a single value being invalid. It also makes
668 sense to relax this condition for desktop GL where it makes sense to
669 use a truncated pyramid with TEXTURE_MAX_LEVEL.
670
671 4. Should use of these entry-points make the metadata (format and
672 dimensions) immutable?
673
674 RESOLVED: Yes.
675
676 DISCUSSION: The benefits of knowing metadata can't change will
677 probably outweigh the extra cost of checking the
678 TEXTURE_IMMUTABLE_FORMAT_EXT flag on each texture specification
679 call.
680
681 5. Should it be legal to completely replace the texture using a new call
682 to TexStorage*?
683
684 RESOLVED. It will not be allowed.
685
686 DISCUSSION: This is useful to invalidate all levels of a texture.
687 Allowing the metadata to be changed here seems easier than trying to
688 define a portable definition of what it means to change the metadata
689 (e.g. what if you used an unsized internal format the first time and
690 the corresponding sized internal format the second time, or vice
691 versa)?
692
693 However, while this is largely similar to deleting the old texture
694 object and replacing it with a new one, it does lose some of the
695 advantages of immutability. Specifically, because doing so does not
696 reset bindings, it doesn't allow a migration path to an API that
697 validates the texture format at bind time.
698
699 6. Should it be legal to use TexImage* after TexStorage* if it doesn't
700 affect the metadata?
701
702 RESOLVED: No.
703
704 DISCUSSION: A potential use case is to allow a single level of a
705 texture to be invalidated using a NULL pointer. However, as noted
706 above it is non-trivial to determine what constitutes a change.
707
708 7. How does this extension interact with APPLE_texture_2D_limited_npot?
709
710 RESOLVED. APPLE_texture_2D_limited_npot is equivalent to the NPOT
711 support in OpenGL ES 2.0.
712
713 8. Should this extension be written to work with desktop OpenGL?
714
715 RESOLVED: Yes.
716
717 DISCUSSION: There has been been interest and it will future-proof it
718 against further additions to OpenGL ES.
719
720 9. Which texture targets should be supported?
721
722 RESOLVED. All targets except multisample and buffer textures are
723 supported.
724
725 Initially all targets except TEXTURE_BUFFER were supported. It was
726 noted that the entrypoints for multisample targets added no useful
727 functionality, since multisample textures have no completeness
728 checks beyond being non-empty.
729
730 Rectangle textures have completeness checks to prevent filtering of
731 integer textures. However, since we decided to only force mipmap
732 completeness, this becomes less useful.
733
734 10. Should this extension support proxy textures?
735
736 RESOLVED: Yes.
737
738 DISCUSSION: It should be orthogonal.
739
740 11. Are the <format> and <type> parameters necessary?
741
742 RESOLVED. No, they will be removed.
743
744 DISCUSSION: For OpenGL ES the type parameter was necessary to
745 determine the precision of the texture, but this can be solved by
746 having these functions accept sized internal formats (which are
747 already accepted by renderbuffers).
748
749 12. Should it be legal to make the default texture (id 0)
750 immutable-format?
751
752 RESOLVED: No.
753
754 DISCUSSION: This would make it impossible to restore the context to
755 it's default state, which is deemed undesirable. There is no good
756 reason not to use named texture objects.
757
758 13. Should we try to guarantee that textures made through this path
759 will always be complete?
760
761 RESOLVED: It should be guaranteed that the texture will be mipmap
762 complete.
763
764 DISCUSSION: Future separation between images and samplers will still
765 allow users to create combinations that are invalid, but
766 constraining the simple cases will make these APIs easier to use for
767 beginners.
768
769 14. Should these functions use a EXT_direct_state_access approach to
770 specifying the texture objects?
771
772 UNRESOLVED.
773
774 DISCUSSION: as a standalone extension, no DSA-like functions will be
775 added. However, interactions with EXT_direct_state_access and
776 ARB_direct_state_access need to be resolved.
777
778 15. Should these functions accept generic compressed formats?
779
780 RESOLVED: Yes. Note that the spec language will need to be modified
781 to allow this for ES, since the pseudocode is written in terms of
782 TexImage2D, which does not allow compressed texture formats in ES.
783 See also issues 23 and 27.
784
785 16. How should completeness be forced when TEXTURE_MAX_LEVEL is not
786 present?
787
788 RESOLVED. The maximum level q will be redefined to clamp to the
789 highest level available.
790
791 DISCUSSION: A single-level texture can be made complete either by
792 making it mipmap complete (by setting TEXTURE_MAX_LEVEL to 0) or by
793 turning off mipmapping (by choose an appropriate minification
794 filter).
795
796 Some options:
797
798 A: Specify that TexStorage* changes the default minification filter
799 for OpenGL ES. This makes it awkward to add TEXTURE_MAX_LEVEL
800 support to OpenGL ES later, since switching to match GL would break
801 compatibility. The two mechanisms also do not give identical
802 results, since the magnification threshold depends on the
803 minification filter.
804
805 B: Specify that the texture behaves as though TEXTURE_MAX_LEVEL were
806 zero. To specify this properly probably requires fairly intrusive
807 changes to the OpenGL ES full specification to add back all the
808 language relating to the max level. It also does not solve the
809 similar problem of what to do with NPOT textures; and it may have
810 hardware impacts due to the change in the min/mag crossover.
811
812 C: Specify that TexStorage* changes the default minification filter
813 for all implementations when a single-level texture is specified.
814 This may be slightly counter-intuitive to desktop GL users, but will
815 give consistent behaviour across variants of GL and avoids changing
816 the functional behaviour of this extension based on the presence or
817 absence of some other feature.
818
819 Currently B is specified. This has potential hardware implications
820 for OpenGL ES because of the effect of the minification filter on
821 the min/mag crossover. However, C has potential hardware implications
822 for OpenGL due to the separation of texture and sampler state.
823
824 17. How should completeness be forced when only ES2-style NPOT is
825 available?
826
827 RESOLVED. It is not worth trying to do this, in light of issue 13.
828
829 Previous revisions of this extension overrode the minification
830 filter and wrap modes, but that is no longer the case. Since
831 OES_texture_npot removes the caveats on NPOT textures anyway, it
832 might not be worth trying to "fix" this.
833
834 18. For OpenGL ES, how do the new sized internal formats interact
835 with OES_required_internal_format?
836
837 RESOLVED.
838
839 If OES_required_internal_format is not present, then the
840 <internalformat> parameter is intended merely to indicate what the
841 corresponding <format> and <type> would have been, had TexImage*
842 been used instead. If OES_required_internal_format is present, then
843 it is intended that the <internalformat> will be interpreted as if
844 it had been passed directly to TexImage*.
845
846 19. Should there be some hinting mechanism to indicate whether data
847 is coming immediately or later?
848
849 RESOLVED. No parameter is needed. An extension can be added to provide
850 a TexParameter value which is latched at TexStorage time.
851
852 DISCUSSION: Some members felt that this would be useful so that they
853 could defer allocation when suitable, particularly if higher-
854 resolution images will be streamed in later; or to choose a memory
855 type or layout appropriate to the usage. However, implementation
856 experience with BufferData is that developers frequently provide
857 wrong values and implementations have to guess anyway.
858
859 One option suggested was the <usage> parameter currently passed to
860 BufferData. Another option was to set it with TexParameter.
861
862 20. How should this extension interact with
863 EGLImageTargetTexture2DOES, eglBindTexImage, glXBindTexImage and
864 wglBindTexImage?
865
866 RESOLVED. These functions will not be permitted after glTexStorage*.
867
868 Several options are possible:
869
870 A) Disallow these functions.
871 B) Allow them, but have them reset the TEXTURE_IMMUTABLE_FORMAT_EXT
872 flag.
873 C) Allow them unconditionally.
874
875 C would violate the design principle that the dimensions and format
876 of the mipmap array are immutable. B does not so much modify the
877 dimension and formats as replace them with an entirely different
878 set.
879
880 21. Should there be a single function for specifying 1D, 2D and 3D
881 targets?
882
883 RESOLVED. No, we will stick with existing precedent.
884
885 22. Is it possible to use GenerateMipmap with an incomplete mipmap
886 pyramid?
887
888 RESOLVED. Yes, because the effective max level is limited to the
889 levels that were specified, and so GenerateMipmap does not generate
890 any new levels.
891
892 However, to make automatic mipmap generation work, it is necessary
893 to redefine p rather than q, since automatic mipmap generation
894 ignores the max level.
895
896 23. How should this extension interact with
897 OES_compressed_paletted_texture?
898
899 RESOLVED. Paletted textures will not be permitted, and will
900 generate INVALID_ENUM.
901
902 DISCUSSION: OES_compressed_paletted_texture supplies all the mipmaps
903 in a single function call, with the palette specified once. That's
904 incompatible with the upload model in this extension.
905
906 24. How can ETC1 textures be used with this extension?
907
908 RESOLVED. Add language in this extension to allow subregion uploads
909 for ETC1.
910
911 DISCUSSION: GL_OES_compressed_ETC1_RGB8_texture doesn't allow
912 CompressedTexSubImage*, so it would be impossible to use this
913 extension with ETC1. This is seen as an oversight in the ETC1
914 extension. While it cannot be fixed in that extension (since it is
915 already shipping), this extension can add that capability.
916
917 25. Should any other compressed formats be similarly modified?
918
919 RESOLVED. Yes, AMD_compressed_ATC_texture and
920 AMD_compressed_3DC_texture can be modified similarly to ETC1
921 (Maurice Ribble indicated that both formats use 4x4 blocks). Desktop
922 OpenGL requires that whole-image replacement is supported for any
923 compressed texture format, and the OpenGL ES extensions
924 EXT_texture_compression_dxt1 and IMG_texture_compression_pvrtc
925 already allow whole-image replacement, so it is not necessary to
926 modify them to be used with this extension.
927
928 26. Should these commands be permitted in display lists?
929
930 RESOLVED. No.
931
932 DISCUSSION: Display lists are most useful for repeating commands,
933 and TexStorage* commands cannot be repeated because the first call
934 makes the format immutable.
935
936 27. Should these commands accept unsized internal formats?
937
938 RESOLVED: No, for both OpenGL and OpenGL ES.
939
940 DISCUSSION: normally the <type> parameter to TexImage* can serve as
941 a hint to select a sized format (and in OpenGL ES, this is the only
942 mechanism available); since TexStorage* does not have a <type>
943 parameter, the implementation has no information on which to base a
944 decision.
945
946Revision History
947
948 Revision 24, 2011/11/11 (dgkoch)
949 - Mark complete. Clarify ES clarifications.
950
951 Revision 23, 2011/11/10 (dgkoch)
952 - Add GLES clarifcations and interactions with more GLES extensions
953
954 Revision 22, 2011/11/10 (bmerry)
955 - Update my contact details
956
957 Revision 21, 2011/07/25 (bmerry)
958 - Remove dangling references to MultiTexStorage in Errors section
959
960 Revision 20, 2011/07/21 (bmerry)
961 - Remove dangling reference to <samples> in Errors section
962
963 Revision 19, 2011/05/02 (Jon Leech)
964 - Assign enum value
965
966 Revision 18, 2011/01/24 (bmerry)
967 - Disallow unsized internal formats (oversight in revision 17).
968
969 Revision 17, 2011/01/24 (bmerry)
970 - Added and resolved issue 26.
971 - Split issue 27 out from issue 15.
972 - Disallow TexStorage* in display lists.
973 - Use the term "immutable-format" consistently (bug 7281).
974
975 Revision 16, 2010/11/23 (bmerry)
976 - Disallowed TexStorage on an immutable-format texture
977 (resolves issue 5).
978 - Deleted MultiTexStorage* commands (other DSA functions still
979 unresolved).
980 - Some minor wording changes suggested by Pat Brown (bug 7002).
981
982 Revision 15, 2010/11/09 (bmerry)
983 - Reopened issue 5.
984 - Reopened issue 14, pending stabilisation of
985 ARB_direct_state_access.
986 - Marked issue 9 resolved, pending any objections.
987 - Fix references to no object being bound (was meant to refer to
988 the default object).
989 - Adding missing pseudocode for TEXTURE_1D_ARRAY.
990 - Corrected TEXTURE_2D_ARRAY -> TEXTURE_1D_ARRAY in error checks.
991 - Changed "levels... are removed" to "levels... are reset to their
992 init state", since desktop GL has per-level state apart from the
993 texels.
994 - Miscellaneous wording fixes.
995
996 Revision 14, 2010/09/25 (bmerry)
997 - Add issues 24-25 and alterations to
998 OES_compressed_ETC1_RGB8_texture, AMD_compressed_ATC_texture and
999 AMD_compressed_3DC_texture.
1000
1001 Revision 13, 2010/09/19 (bmerry)
1002 - Two typo fixes from Daniel Koch
1003
1004 Revision 12, 2010/09/18 (bmerry)
1005 - Changed resolution to issue 20
1006 - Added and resolved issue 23
1007 - Added explanation of how to upload data (in overview)
1008 - Added spec language to implement resolution to issue 15
1009
1010 Revision 11, 2010/07/21 (bmerry)
1011 - Resolved issue 16
1012 - Reopen issue 20
1013 - Fix some typos
1014
1015 Revision 10, 2010/07/15 (bmerry)
1016 - Update some issues to match core text
1017 - Resolved issue 17
1018
1019 Revision 9, 2010/05/24 (bmerry)
1020 - Marked issue 2 as resolved
1021 - Resolved issue 19 (as no change)
1022 - Resolved issue 20
1023 - Add issues 21-22
1024 - Add in spec language to forbid use on default textures
1025 - Redefine level_base, level_max to be clamped forms of
1026 TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL when using immutable
1027 textures
1028 - Redefine p to also be clamped to the provided levels for
1029 immutable textures, to support automatic mipmap generation
1030 - Removed multisample functions
1031 - Removed language stating that texture parameters were reset to
1032 defaults
1033
1034 Revision 8, 2010/05/18 (bmerry)
1035 - Added issue about EGLimage
1036 - Marked issue 14 as resolved
1037
1038 Revision 7, 2010/05/04 (bmerry)
1039 - Removed some lingering <format>, <type> parameters to the new
1040 functions that should have been removed in revision 4
1041 - Trivial typo fixes
1042
1043 Revision 6, 2010/02/18 (bmerry)
1044 - Resolved issues 5, 6 and 18
1045 - Added MultiTexStorage* functions for DSA interaction
1046 - Added error for texture-target mismatch in DSA
1047 - Allowed TexStorage* to be called again
1048
1049 Revision 5, 2010/01/25 (bmerry)
1050 - Added to contributors list
1051 - Require OpenGL 1.2, to simplify interactions with
1052 TEXTURE_BASE_LEVEL/TEXTURE_MAX_LEVEL and CLAMP_TO_EDGE
1053 - Change default wrap modes to always be CLAMP_TO_EDGE
1054 - Change default filters to always be NEAREST
1055 - Moved language about generating new levels into an interaction,
1056 since it can only happen on OpenGL ES
1057 - Added interaction with EXT_direct_state_access
1058 - Added extra <internalformats> for GL ES when OES_depth_texture,
1059 OES_packed_depth_stencil and EXT_texture_type_2_10_10_10_REV are
1060 present.
1061 - Minor non-functional wording fixes and typos
1062 - Resolved issue 16
1063 - Added issues 17-19
1064
1065 Revision 4, 2010/01/13 (bmerry)
1066 - Changed suffix from ARM to EXT
1067 - Added list of contributors
1068 - Added language to force the texture to always be complete
1069 - Removed <format> and <type> arguments
1070 - Added issues 14-16
1071 - Reopened issue 2
1072 - Reformatted issues to separate resolution and discussion
1073 - Resolved issues 1, 9 and 11-13
1074 - Fixed the max number of levels in a cube map array
1075
1076 Revision 3, 2009/12/17 (bmerry)
1077 - Added missing vendor suffix to TEXTURE_IMMUTABLE_FORMAT_ARM
1078 - Rewritten to against desktop OpenGL
1079 - Added prototypes for 1D and multisample storage functions
1080 - Added issues 8-13
1081
1082 Revision 2, 2009/08/20 (bmerry)
1083 - Resolved issue 2 (no border parameter)
1084 - Resolved issue 4 (metadata becomes immutable)
1085 - Added interaction with OES_texture_cube_map
1086 - Added error if width != height in a cube map
1087 - Added issues 5-7
1088
1089 Revision 1, 2009/05/06 (bmerry)
1090 - First draft