| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <extension href="WEBGL_compressed_texture_etc/"> |
| 4 | <name>WEBGL_compressed_texture_etc</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>Jeff Gilbert, Mozilla</contributor> |
| 10 | <contributor>Members of the WebGL working group</contributor> |
| 11 | </contributors> |
| 12 | <number>29</number> |
| 13 | <depends> |
| 14 | <api version="1.0"/> |
| 15 | </depends> |
| 16 | <overview> |
| 17 | <p> |
| 18 | This extension exposes the compressed texture formats defined as core in the |
| 19 | <a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.4.pdf"> |
| 20 | OpenGL ES 3.0</a> spec to WebGL. These include the ETC2 and EAC formats, where |
| 21 | ETC2 is a superset of ETC1. ETC1 textures can be loaded using the ETC2 token |
| 22 | value. All of these formats are in the ETC family. |
| 23 | </p> |
| 24 | <p> |
| 25 | Browsers should not advertise this extension when the WebGL implementation, or |
| 26 | graphics driver, supports these formats by decompressing them. |
| 27 | </p> |
| 28 | <features> |
| 29 | <feature> |
| 30 | Compression formats <code>COMPRESSED_R11_EAC</code>, |
| 31 | <code>COMPRESSED_SIGNED_R11_EAC</code>, |
| 32 | <code>COMPRESSED_RG11_EAC</code>, |
| 33 | <code>COMPRESSED_SIGNED_RG11_EAC</code>, |
| 34 | <code>COMPRESSED_RGB8_ETC2</code>, |
| 35 | <code>COMPRESSED_SRGB8_ETC2</code>, |
| 36 | <code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 37 | <code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 38 | <code>COMPRESSED_RGBA8_ETC2_EAC</code>, |
| 39 | and <code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code> may be passed to the |
| 40 | <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points. In |
| 41 | WebGL 2.0, they may also be passed to the <code>compressedTexImage3D</code> and |
| 42 | <code>compressedTexSubImage3D</code> entry points with the <code>TEXTURE_2D_ARRAY</code> |
| 43 | target. |
| 44 | </feature> |
| 45 | <feature> |
| 46 | Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code> |
| 47 | will include the formats from this specification. |
| 48 | </feature> |
| 49 | <feature> |
| 50 | For all of the formats, <code>validatedSize</code> (defined for each specific format |
| 51 | below) is validated in the following ways: |
| 52 | <ul> |
| 53 | <li> |
| 54 | <b>WebGL 1.0 and 2.0</b>: if the variant of <code>compressedTexImage*D</code> or |
| 55 | <code>compressedTexSubImage*D</code> taking <code>ArrayBufferView pixels</code> is |
| 56 | called, then the <code>byteLength</code> of the view must be equal to |
| 57 | <code>validatedSize</code>, or an INVALID_VALUE error is generated. |
| 58 | </li> |
| 59 | <li> |
| 60 | <b>WebGL 2.0</b>: if the variant of <code>compressedTexImage*D</code> or |
| 61 | <code>compressedTexSubImage*D</code> taking <code>GLintptr offset</code> is called, |
| 62 | and <code>offset + validatedSize</code> is greater than the size of the bound |
| 63 | <code>PIXEL_UNPACK_BUFFER</code>, an <code>INVALID_OPERATION</code> error is |
| 64 | generated. |
| 65 | </li> |
| 66 | </ul> |
| 67 | <dl> |
| 68 | <dt>COMPRESSED_R11_EAC</dt> |
| 69 | <dt>COMPRESSED_SIGNED_R11_EAC</dt> |
| 70 | <dt>COMPRESSED_RGB8_ETC2</dt> |
| 71 | <dt>COMPRESSED_SRGB8_ETC2</dt> |
| 72 | <dt>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</dt> |
| 73 | <dt>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</dt> |
| 74 | <dd><p><code>validatedSize</code> is computed in the following way:</p> |
| 75 | <blockquote><code> |
| 76 | floor((width + 3) / 4) * floor((height + 3) / 4) * 8 |
| 77 | </code></blockquote> |
| 78 | </dd> |
| 79 | </dl> |
| 80 | <dl> |
| 81 | <dt>COMPRESSED_RG11_EAC</dt> |
| 82 | <dt>COMPRESSED_SIGNED_RG11_EAC</dt> |
| 83 | <dt>COMPRESSED_RGBA8_ETC2_EAC</dt> |
| 84 | <dt>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</dt> |
| 85 | <dd><p><code>validatedSize</code> is computed in the following way:</p> |
| 86 | <blockquote><code> |
| 87 | floor((width + 3) / 4) * floor((height + 3) / 4) * 16 |
| 88 | </code></blockquote> |
| 89 | </dd> |
| 90 | </dl> |
| 91 | </feature> |
| 92 | </features> |
| 93 | </overview> |
| 94 | <idl xml:space="preserve"> |
| 95 | [NoInterfaceObject] |
| 96 | interface WEBGL_compressed_texture_etc { |
| 97 | /* Compressed Texture Formats */ |
| 98 | const GLenum COMPRESSED_R11_EAC = 0x9270; |
| 99 | const GLenum COMPRESSED_SIGNED_R11_EAC = 0x9271; |
| 100 | const GLenum COMPRESSED_RG11_EAC = 0x9272; |
| 101 | const GLenum COMPRESSED_SIGNED_RG11_EAC = 0x9273; |
| 102 | const GLenum COMPRESSED_RGB8_ETC2 = 0x9274; |
| 103 | const GLenum COMPRESSED_SRGB8_ETC2 = 0x9275; |
| 104 | const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; |
| 105 | const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; |
| 106 | const GLenum COMPRESSED_RGBA8_ETC2_EAC = 0x9278; |
| 107 | const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; |
| 108 | }; |
| 109 | </idl> |
| 110 | |
| 111 | <newtok> |
| 112 | <function name="compressedTexImage2D"> |
| 113 | <param name="internalformat" type="GLenum"/> |
| 114 | Accepted by the <code>internalformat</code> parameter: |
| 115 | <code>COMPRESSED_R11_EAC</code>, |
| 116 | <code>COMPRESSED_SIGNED_R11_EAC</code>, |
| 117 | <code>COMPRESSED_RG11_EAC</code>, |
| 118 | <code>COMPRESSED_SIGNED_RG11_EAC</code>, |
| 119 | <code>COMPRESSED_RGB8_ETC2</code>, |
| 120 | <code>COMPRESSED_SRGB8_ETC2</code>, |
| 121 | <code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 122 | <code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 123 | <code>COMPRESSED_RGBA8_ETC2_EAC</code> or |
| 124 | <code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code> |
| 125 | <br/> |
| 126 | </function> |
| 127 | |
| 128 | <function name="compressedTexSubImage2D"> |
| 129 | <param name="internalformat" type="GLenum"/> |
| 130 | Accepted by the <code>internalformat</code> parameter: |
| 131 | <code>COMPRESSED_R11_EAC</code>, |
| 132 | <code>COMPRESSED_SIGNED_R11_EAC</code>, |
| 133 | <code>COMPRESSED_RG11_EAC</code>, |
| 134 | <code>COMPRESSED_SIGNED_RG11_EAC</code>, |
| 135 | <code>COMPRESSED_RGB8_ETC2</code>, |
| 136 | <code>COMPRESSED_SRGB8_ETC2</code>, |
| 137 | <code>COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 138 | <code>COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2</code>, |
| 139 | <code>COMPRESSED_RGBA8_ETC2_EAC</code> or |
| 140 | <code>COMPRESSED_SRGB8_ALPHA8_ETC2_EAC</code> |
| 141 | <br/> |
| 142 | </function> |
| 143 | </newtok> |
| 144 | |
| 145 | <errors> |
| 146 | <error enum="INVALID_VALUE"> |
| 147 | The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code>, |
| 148 | <code>compressedTexSubImage2D</code>, <code>compressedTexImage3D</code>, and |
| 149 | <code>compressedTexSubImage3D</code> if the variant taking <code>ArrayBufferView pixels</code> |
| 150 | is called and the size restrictions above are not met. |
| 151 | </error> |
| 152 | <error enum="INVALID_OPERATION"> |
| 153 | The error <code>INVALID_OPERATION</code> is generated by <code>compressedTexImage2D</code>, |
| 154 | <code>compressedTexSubImage2D</code>, <code>compressedTexImage3D</code>, and |
| 155 | <code>compressedTexSubImage3D</code> if the variant taking <code>GLintptr offset</code> is |
| 156 | called and the size restrictions above are not met. |
| 157 | </error> |
| 158 | </errors> |
| 159 | <history> |
| 160 | <revision date="2013/12/9"> |
| 161 | <change>Initial revision.</change> |
| 162 | </revision> |
| 163 | <revision date="2014/07/15"> |
| 164 | <change>Added NoInterfaceObject extended attribute.</change> |
| 165 | </revision> |
| 166 | <revision date="2014/12/12"> |
| 167 | <change>COMPRESSED_RGB_ETC2 should be COMPRESSED_RGB8_ETC2.</change> |
| 168 | <change>Remove unnecessary language.</change> |
| 169 | </revision> |
| 170 | <revision date="2015/01/31"> |
| 171 | <change>Moved to draft.</change> |
| 172 | <change>Added issue questions.</change> |
| 173 | <change>Formalized the newtok and error codes.</change> |
| 174 | </revision> |
| 175 | <revision date="2016/09/16"> |
| 176 | <change>Renamed to WEBGL_compressed_texture_es3_0.</change> |
| 177 | </revision> |
| 178 | <revision date="2016/09/21"> |
| 179 | <change>Clarifications to the supported formats on suggestion from Mark Callow.</change> |
| 180 | </revision> |
| 181 | <revision date="2016/09/30"> |
| 182 | <change>Addressed issues regarding 3D entry points, description of interation with WebGL 2.0, |
| 183 | and generation of INVALID_OPERATION and INVALID_VALUE errors. Added note that browsers should |
| 184 | not advertise this extension if these compressed texture formats are decompressed. Renamed to |
| 185 | WEBGL_compressed_texture_etc after further discussion. Promoted to community |
| 186 | approved.</change> |
| 187 | </revision> |
| 188 | </history> |
| 189 | </extension> |