| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <draft href="EXT_texture_compression_bptc/"> |
| 4 | <name>EXT_texture_compression_bptc</name> |
| 5 | <contact> |
| 6 | <a href="https://www.khronos.org/webgl/public-mailing-list/">WebGL working group</a> (public_webgl 'at' khronos.org) |
| 7 | </contact> |
| 8 | <contributors> |
| 9 | <contributor>Olli Etuaho, NVIDIA</contributor> |
| 10 | <contributor>Members of the WebGL working group</contributor> |
| 11 | </contributors> |
| 12 | <number>38</number> |
| 13 | <depends> |
| 14 | <api version="1.0"/> |
| 15 | </depends> |
| 16 | <overview> |
| 17 | <p> |
| 18 | This extension exposes the compressed texture format defined in the |
| 19 | <a href="https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_compression_bptc.txt"> |
| 20 | EXT_texture_compression_bptc</a> OpenGL ES extension to WebGL. Consult that extension |
| 21 | specification for behavioral definitions, including error behaviors. |
| 22 | </p> |
| 23 | <p> |
| 24 | Sampling from textures in the COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT format performs a color space |
| 25 | conversion as specified for SRGB textures in the |
| 26 | <a href="https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_sRGB.txt">EXT_sRGB</a> OpenGL ES |
| 27 | extension. |
| 28 | </p> |
| 29 | <features> |
| 30 | <feature> |
| 31 | Compression format <code>COMPRESSED_RGBA_BPTC_UNORM_EXT</code>, |
| 32 | <code>COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT</code>, |
| 33 | <code>COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT</code>, |
| 34 | and <code>COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT</code> may be passed to |
| 35 | the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points. |
| 36 | </feature> |
| 37 | <feature> |
| 38 | Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code> |
| 39 | will include the formats from this specification. |
| 40 | </feature> |
| 41 | <feature> |
| 42 | <p> |
| 43 | If the <code>internalformat</code> is one of the BPTC internal formats from this specification, |
| 44 | the <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to |
| 45 | <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be |
| 46 | equal to the following number of bytes: |
| 47 | </p> |
| 48 | <blockquote><code> |
| 49 | ceil(width / 4) * ceil(height / 4) * 16 |
| 50 | </code></blockquote> |
| 51 | <p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p> |
| 52 | </feature> |
| 53 | </features> |
| 54 | </overview> |
| 55 | <idl xml:space="preserve"> |
| 56 | [NoInterfaceObject] |
| 57 | interface EXT_texture_compression_bptc { |
| 58 | const GLenum COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C; |
| 59 | const GLenum COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D; |
| 60 | const GLenum COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E; |
| 61 | const GLenum COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F; |
| 62 | }; |
| 63 | </idl> |
| 64 | |
| 65 | <newtok> |
| 66 | <function name="compressedTexImage2D"> |
| 67 | <param name="internalformat" type="GLenum"/> |
| 68 | Accepted by the <code>internalformat</code> parameter: |
| 69 | <code>COMPRESSED_RGBA_BPTC_UNORM_EXT</code>, |
| 70 | <code>COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT</code>, |
| 71 | <code>COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT</code>, |
| 72 | <code>COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT</code> |
| 73 | <br/> |
| 74 | </function> |
| 75 | |
| 76 | <function name="compressedTexSubImage2D"> |
| 77 | <param name="internalformat" type="GLenum"/> |
| 78 | Accepted by the <code>internalformat</code> parameter: |
| 79 | <code>COMPRESSED_RGBA_BPTC_UNORM_EXT</code>, |
| 80 | <code>COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT</code>, |
| 81 | <code>COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT</code>, |
| 82 | <code>COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT</code> |
| 83 | <br/> |
| 84 | </function> |
| 85 | </newtok> |
| 86 | |
| 87 | <errors> |
| 88 | <error enum="INVALID_VALUE"> |
| 89 | The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and |
| 90 | <code>compressedTexSubImage2D</code> if the <code>internalformat</code> parameter is one of the BPTC |
| 91 | internal formats from this extension and the byteLength of the ArrayBufferView is not: |
| 92 | <blockquote><code> |
| 93 | ceil(width / 4) * ceil(height / 4) * 16 |
| 94 | </code></blockquote> |
| 95 | </error> |
| 96 | </errors> |
| 97 | |
| 98 | <history> |
| 99 | <revision date="2018/09/14"> |
| 100 | <change>Initial revision.</change> |
| 101 | </revision> |
| 102 | <revision date="2018/09/18"> |
| 103 | <change>Moved to draft status.</change> |
| 104 | </revision> |
| 105 | <revision date="2018/09/26"> |
| 106 | <change>Retarget against EXT_texture_compression_bptc instead of ARB_texture_compression_bptc</change> |
| 107 | <change>Rename to EXT_texture_compression_bptc from WEBGL_compressed_texture_bptc</change> |
| 108 | </revision> |
| 109 | </history> |
| 110 | </draft> |