• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_texture_compression_s3tc_srgb
4
5Name Strings
6
7    GL_EXT_texture_compression_s3tc_srgb
8
9Contributors
10
11    Christophe Riccio, Unity
12    Kai Ninomiya, Google
13    Kenneth Russell, Google
14    Contributors to EXT_texture_compression_s3tc
15
16Contact
17
18    Christophe Riccio, (christophe 'dot' riccio 'at' unity3d 'dot' com)
19
20Status
21
22    FINAL, implemented by ANGLE
23
24Version
25
26    1 October 2016
27
28Number
29
30    OpenGL ES Extension #289
31
32Dependencies
33
34    OpenGL ES 2.0 is required.
35
36    OpenGL ES 3.0 or EXT_sRGB are required.
37
38    EXT_texture_compression_s3tc is required.
39
40    This extension is written against the OpenGL ES 3.0.4
41    specification with EXT_texture_compression_s3tc extension.
42
43    This extension is written against the OpenGL ES 2.0.25
44    specification with EXT_texture_compression_s3tc extension.
45
46    EXT_texture_storage affects the definition of this
47    extension.
48
49Overview
50
51    This extension adds new compressed color texture formats using S3TC with
52    nonlinear sRGB color components.
53
54IP Status
55
56    Contact S3 Incorporated (http://www.s3.com) regarding any intellectual
57    property issues associated with implementing this extension.
58
59    WARNING:  Vendors able to support S3TC texture compression in Direct3D
60    drivers do not necessarily have the right to use the same functionality in
61    OpenGL.
62
63New Procedures and Functions
64
65    None
66
67New Tokens
68
69    This extension introduces new tokens:
70
71        COMPRESSED_SRGB_S3TC_DXT1_EXT                  0x8C4C
72        COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT            0x8C4D
73        COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT            0x8C4E
74        COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT            0x8C4F
75
76    In extended OpenGL ES 2.0.25 these new tokens are accepted by the
77    <internalformat> parameter of TexImage2D, CompressedTexImage2D, TexStorage2DEXT,
78    TextureStorage2DEXT and the <format> parameter of CompressedTexSubImage2D.
79
80    In extended OpenGL ES 3.0.4 these new tokens are also accepted by the
81    <internalformat> parameter of TexImage2D, TexImage3D, CompressedTexImage3D,
82    TexStorage2D, TexStorage3D, TexStorage3DEXT, TextureStorage3DEXT and the <format>
83    parameter of CompressedTexSubImage3D.
84
85Additions to Chapter 3 of the OpenGL ES 2.0.25 Specification
86
87    Modify Section 3.7.1, Texture Image Specification:
88
89    Change last paragraph on Page 67 as follows
90    (modified by EXT_texture_compression_s3tc):
91
92    Components are then selected from the resulting R, G, B, or A values
93    to obtain a texture with the base internal format specified by
94    <internalformat>, which must match <format> except when <target> is
95    TEXTURE_2D and <internalformat> is one of the following compressed
96    formats: COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
97    COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5_EXT,
98    COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
99    COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT.
100    In this case, conversion from only RGB and RGBA formats are supported
101    during texture image processing. <format> values other than RGB or RGBA
102    will result in the INVALID_OPERATION error. In all other cases where
103    <internalformat> does not match <format>, the error INVALID_OPERATION is
104    generated. Table 3.8 summarizes the mapping of R, G, B, and A values to
105    texture components, as a function of the base internal format of the
106    texture image. <internalformat> may be one of the five internal format
107    symbolic constants listed in table 3.8 or the four compressed
108    formats: COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
109    COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5_EXT,
110    COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
111    COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT.
112    Specifying a value for <internalformat> that is not one of the above values
113    generates the error INVALID_VALUE. When a compressed <internalformat> is
114    specified, a compressed texture is created and all the associated
115    restrictions mentioned in Section 3.7.3 are imposed.
116
117    Note that when encoding an RGBA image into a format using 1-bit
118    alpha, any texels with an alpha component less than 0.5 end up
119    with an alpha of 0.0 and any texels with an alpha component
120    greater than or equal to 0.5 end up with an alpha of 1.0. When
121    encoding an RGBA image into the COMPRESSED_RGBA_S3TC_DXT1_EXT or
122    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT format, the resulting red,
123    green, and blue components of any texels with a final alpha of 0.0
124    will automatically be zero (black). If this behavior is not desired
125    by an application, it should not use COMPRESSED_RGBA_S3TC_DXT1_EXT or
126    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT.
127
128    Modify Section 3.7.2, Alternate Texture Image Specification Commands
129    (modified by EXT_texture_compression_s3tc):
130
131    Modify last paragraph with:
132
133    When the internal format of the texture object is
134    COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1_EXT,
135    COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5_EXT,
136    COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
137    COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
138    the update region specified in TexSubImage2D must be aligned to 4x4
139    pixel blocks. If <xoffset> or <yoffset> are not multiples of 4 an
140    INVALID_OPERATION error is generated. If <width> is not a multiple
141    of 4 and <xoffset> + <width> is not equal to the width of the LOD
142    then an INVALID_OPERATION error is generated.  If <height> is not
143    a multiple of 4 and <yoffset> + <height> is not equal to the
144    height of the LOD then an INVALID_OPERATION error is generated.
145
146    Modify Section 3.7.3, "Compressed Texture Images"
147
148    Add 4 new rows to "Specific compressed texture formats" Table 3.X:
149
150        Compressed Internal Format           Base Internal Format
151        -----------------------------------  --------------------
152        COMPRESSED_SRGB_S3TC_DXT1_EXT        RGB
153        COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT  RGBA
154        COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT  RGBA
155        COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT  RGBA
156
157    Replace last paragraph with:
158
159    If the internal format is one of COMPRESSED_RGB_S3TC_DXT1_EXT,
160    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
161    COMPRESSED_RGBA_S3TC_DXT5_EXT, COMPRESSED_SRGB_S3TC_DXT1_EXT,
162    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
163    or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT the compressed texture is stored
164    using one of several S3TC compressed texture image formats and is
165    easily edited along 4x4 texel boundaries. In this case,
166    CompressedTexSubImage2D will result in an INVALID_OPERATION error
167    if one of the following conditions occurs:
168
169        * <width> is not a multiple of four, and <width> plus
170          <xoffset> is not equal to texture width;
171
172        * <height> is not a multiple of four, and <height> plus
173          <yoffset> is not equal to texture height; or
174
175        * <xoffset> or <yoffset> is not a multiple of four.
176
177    For any other formats, calling CompressedTexSubImage2D will result
178    in an INVALID_OPERATION error if <xoffset> or <yoffset> is not
179    equal to zero, or if <width> and <height> do not match the width
180    and height of the texture, respectively. The contents of any texel
181    outside the region modified by the call are undefined. These
182    restrictions may be relaxed for other specific compressed internal
183    formats whose images are easily modified.
184
185Additions to Chapter 3 of the OpenGL ES 3.0.4 Specification
186(Rasterization)
187
188    Modify Section 3.8.3, "Texture Image Specification":
189
190    Modify paragraph starting with "For internalformat different than "
191    (modified by EXT_texture_compression_s3tc):
192
193    For internalformat different than COMPRESSED_RGB_S3TC_DXT1_EXT,
194    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
195    COMPRESSED_RGBA_S3TC_DXT5_EXT, COMPRESSED_SRGB_S3TC_DXT1_EXT,
196    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
197    or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT specifying a combination of values
198    for format, type, and internalformat that is not listed as a valid
199    combination in tables 3.2 or 3.3 generates the error INVALID_OPERATION.
200
201    For internalformat equal to COMPRESSED_RGB_S3TC_DXT1_EXT,
202    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
203    COMPRESSED_RGBA_S3TC_DXT5_EXT, COMPRESSED_SRGB_S3TC_DXT1_EXT,
204    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or
205    COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT only RGB and RGBA formats are supported
206    during texture image processing and for these internalformat values
207    <format> values other than RBA or RGBA will result in the INVALID_OPERATION
208    error.
209
210    Modify Section 3.8.6. "Compressed Texture Images":
211
212    Add 4 new rows to "Compressed internal formats" Table 3.19:
213
214        Compressed Internal Format           Base Internal Format
215        -----------------------------------  --------------------
216        COMPRESSED_SRGB_S3TC_DXT1_EXT        RGB
217        COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT  RGBA
218        COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT  RGBA
219        COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT  RGBA
220
221    Modify paragraph starting with "If the internal format is one of "
222    (added by EXT_texture_compression_s3tc):
223
224    If the internal format is one of COMPRESSED_RGB_S3TC_DXT1_EXT,
225    COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3_EXT,
226    COMPRESSED_RGBA_S3TC_DXT5_EXT, COMPRESSED_SRGB_S3TC_DXT1_EXT,
227    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
228    or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT the compressed texture is stored
229    using one of several S3TC compressed texture image formats and is easily
230    edited along 4x4 texel boundaries. In this case,
231    CompressedTexSubImage2D/CompressedTexSubImage3D will result in an
232    INVALID_OPERATION error if one of the following conditions occurs:
233
234        * <width> is not a multiple of four, and <width> plus
235          <xoffset> is not equal to texture width;
236
237        * <height> is not a multiple of four, and <height> plus
238          <yoffset> is not equal to texture height; or
239
240        * <xoffset> or <yoffset> is not a multiple of four.
241
242    For any other formats, calling CompressedTexSubImage2D/CompressedTexSubImage3D
243    will result in an INVALID_OPERATION error if <xoffset> or <yoffset> is not
244    equal to zero, or if <width> and <height> do not match the width and height
245    of the texture, respectively. The contents of any texel outside the region
246    modified by the call are undefined. These restrictions may be relaxed for
247    other specific compressed internal formats whose images are easily
248    modified.
249
250    Modify Section 3.8.16, "sRGB Texture Color Conversion":
251
252    Change the first sentence to:
253
254    If the currently bound texture's internal format is one of SRGB8,
255    SRGB8_ALPHA8, COMPRESSED_SRGB8_ETC2, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
256    COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, COMPRESSED_SRGB_S3TC_DXT1_EXT,
257    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
258    or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, the red, green, and blue components
259    are converted from an sRGB color space to a linear color space as part of
260    filtering described in sections 3.8.10 and 3.8.11.
261
262Dependencies on EXT_texture_storage
263
264    If EXT_texture_storage is not supported, ignore all references to
265    TexStorage2DEXT and TexStorage3DEXT functions.
266
267Errors for OpenGL ES 2.0.25 Specification
268
269    INVALID_OPERATION is generated by CopyTexSubImage2D if the texture
270    image <level> bound to <target> has internal format
271    COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
272    COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT.
273
274    INVALID_OPERATION is generated by CompressedTexSubImage2D if
275    <format> is COMPRESSED_SRGB_S3TC_DXT1_EXT,
276    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or
277    COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply:
278
279        * <width> is not a multiple of four, and <width> plus
280          <xoffset> is not equal to the texture width;
281
282        * <height> is not a multiple of four, and <height> plus
283          <yoffset> is not equal to the texture height; or
284
285        * <xoffset> or <yoffset> is not a multiple of four.
286
287    INVALID_OPERATION is generated by TexImage2D and TexSubImage2D if
288    texture has internal format COMPRESSED_SRGB_S3TC_DXT1_EXT,
289    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or
290    COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply:
291
292        * <xoffset> or <yoffset> are not multiples of 4
293
294        * <width> is not a multiple of 4 and <xoffset> + <width> is not equal
295          to the width of the LOD
296
297        * if <height> is not a multiple of 4 and <yoffset> + <height> is not
298          equal to the height of the LOD
299
300Errors for OpenGL ES 3.0.4 Specification
301
302    INVALID_OPERATION is generated by CopyTexSubImage2D / CopyTexSubImage3D if
303    the texture image <level> bound to <target> has internal format
304    COMPRESSED_SRGB_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
305    COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT.
306
307    INVALID_OPERATION is generated by CompressedTexSubImage2D /
308    CompressedTexSubImage3D if <format> is COMPRESSED_SRGB_S3TC_DXT1_EXT,
309    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, or
310    COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and any of the following apply:
311
312        * <width> is not a multiple of four, and <width> plus
313          <xoffset> is not equal to the texture width;
314
315        * <height> is not a multiple of four, and <height> plus
316          <yoffset> is not equal to the texture height; or
317
318        * <xoffset> or <yoffset> is not a multiple of four.
319
320    INVALID_OPERATION is generated by TexSubImage2D/TexSubImage3D if texture
321    has internal format COMPRESSED_SRGB_S3TC_DXT1_EXT,
322    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
323    or COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT and <format> is not RGB or RGBA, or
324    any of the following apply:
325
326        * <xoffset> or <yoffset> are not multiples of 4
327
328        * <width> is not a multiple of 4 and <xoffset> + <width> is not equal
329          to the width of the LOD
330
331        * if <height> is not a multiple of 4 and <yoffset> + <height> is not
332          equal to the height of the LOD
333
334New State for OpenGL ES 2.0.25 and 3.0.2 Specifications
335
336    The queries for NUM_COMPRESSED_TEXTURE_FORMATS and
337    COMPRESSED_TEXTURE_FORMATS include COMPRESSED_SRGB_S3TC_DXT1_EXT,
338    COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
339    and COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT.
340
341New Implementation Dependent State
342
343    None
344
345Issues
346
347    (1) Should this be an extension for OpenGL too?
348
349        sRGB DXT formats are already exposed through OpenGL EXT_texture_sRGB
350        extension.
351
352        RESOLVED: No
353
354    (2) Can we use the new compression formats with TexImage2D/TexImage3D?
355
356        EXT_texture_compression_s3tc supports DXT formats as internalformat of
357        TexImage2D and TexImage3D hence this extension should follow this
358        precedent.
359
360        RESOLVED: Yes
361
362Revision History
363
364    2016-10-01 - criccio
365       + Fixed missing formats in Section 3.8.3
366
367    2016-09-30 - criccio
368       + Added issue 2
369
370    2016-09-10 - criccio
371       + Initial draft
372