| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <ratified href="WEBGL_compressed_texture_s3tc/"> |
| 4 | <name>WEBGL_compressed_texture_s3tc</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>Members of the WebGL working group</contributor> |
| 10 | </contributors> |
| 11 | <number>8</number> |
| 12 | <depends> |
| 13 | <api version="1.0"/> |
| 14 | </depends> |
| 15 | <overview> |
| 16 | <p> |
| 17 | This extension exposes the compressed texture formats defined in the |
| 18 | <a href="http://www.opengl.org/registry/specs/EXT/texture_compression_s3tc.txt"> |
| 19 | EXT_texture_compression_s3tc</a> OpenGL extension to WebGL. |
| 20 | </p> |
| 21 | <features> |
| 22 | <feature> |
| 23 | Compression formats <code>COMPRESSED_RGB_S3TC_DXT1_EXT</code>, |
| 24 | <code>COMPRESSED_RGBA_S3TC_DXT1_EXT</code>, <code>COMPRESSED_RGBA_S3TC_DXT3_EXT</code>, and |
| 25 | <code>COMPRESSED_RGBA_S3TC_DXT5_EXT</code> may be passed to |
| 26 | the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points. |
| 27 | </feature> |
| 28 | <feature> |
| 29 | Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code> |
| 30 | will include the 4 formats from this specification. |
| 31 | </feature> |
| 32 | <feature> |
| 33 | <p>The following format specific restrictions must be enforced:</p> |
| 34 | <dl> |
| 35 | <dt>COMPRESSED_RGB_S3TC_DXT1_EXT</dt> |
| 36 | <dt>COMPRESSED_RGBA_S3TC_DXT1_EXT</dt> |
| 37 | <dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to |
| 38 | either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> |
| 39 | must match the following equation:</p> |
| 40 | <blockquote><code> |
| 41 | floor((width + 3) / 4) * floor((height + 3) / 4) * 8 |
| 42 | </code></blockquote> |
| 43 | <p> |
| 44 | If it is not an <code>INVALID_VALUE</code> error is generated. |
| 45 | </p> |
| 46 | <p>When <code>level</code> equals zero <code>width</code> and <code>height</code> |
| 47 | must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code> |
| 48 | and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p> |
| 49 | <p> |
| 50 | If they are not an <code>INVALID_OPERATION</code> error is generated. |
| 51 | </p> |
| 52 | <p> |
| 53 | For <code>compressedTexSubImage2D</code> <code>xoffset</code> and |
| 54 | <code>yoffset</code> must be a multiple of 4 and |
| 55 | <code>width</code> must be a multiple of 4 or equal to the original |
| 56 | width of the <code>level</code>. <code>height</code> must be a multiple of 4 or |
| 57 | equal to the original height of the <code>level</code>. |
| 58 | If they are not an <code>INVALID_OPERATION</code> error is generated. |
| 59 | </p> |
| 60 | </dd> |
| 61 | |
| 62 | <dt>COMPRESSED_RGBA_S3TC_DXT3_EXT</dt> |
| 63 | <dt>COMPRESSED_RGBA_S3TC_DXT5_EXT</dt> |
| 64 | <dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to |
| 65 | either <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must |
| 66 | match the following equation:</p> |
| 67 | <blockquote><code> |
| 68 | floor((width + 3) / 4) * floor((height + 3) / 4) * 16 |
| 69 | </code></blockquote> |
| 70 | <p> |
| 71 | If it is not an <code>INVALID_VALUE</code> error is generated. |
| 72 | </p> |
| 73 | <p>When <code>level</code> equals zero <code>width</code> and <code>height</code> |
| 74 | must be a multiple of 4. When <code>level</code> is greater than 0 <code>width</code> |
| 75 | and <code>height</code> must be 0, 1, 2 or a multiple of 4.</p> |
| 76 | <p> |
| 77 | If they are not an <code>INVALID_OPERATION</code> error is generated. |
| 78 | </p> |
| 79 | <p> |
| 80 | For <code>compressedTexSubImage2D</code> <code>xoffset</code> and |
| 81 | <code>yoffset</code> must be a multiple of 4 and |
| 82 | <code>width</code> must be a multiple of 4 or equal to the original |
| 83 | width of the <code>level</code>. <code>height</code> must be a multiple of 4 or |
| 84 | equal to the original height of the <code>level</code>. |
| 85 | If they are not an <code>INVALID_OPERATION</code> error is generated. |
| 86 | </p> |
| 87 | </dd> |
| 88 | </dl> |
| 89 | </feature> |
| 90 | </features> |
| 91 | </overview> |
| 92 | <idl xml:space="preserve"> |
| 93 | [NoInterfaceObject] |
| 94 | interface WEBGL_compressed_texture_s3tc { |
| 95 | /* Compressed Texture Formats */ |
| 96 | const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; |
| 97 | const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; |
| 98 | const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; |
| 99 | const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; |
| 100 | }; |
| 101 | </idl> |
| 102 | <history> |
| 103 | <revision date="2012/01/25"> |
| 104 | <change>Initial revision.</change> |
| 105 | </revision> |
| 106 | <revision date="2013/01/26"> |
| 107 | <change>Moved from draft to community approved status</change> |
| 108 | </revision> |
| 109 | <revision date="2013/05/15"> |
| 110 | <change>Ratified by Khronos Board of Promoters.</change> |
| 111 | </revision> |
| 112 | <revision date="2013/07/03"> |
| 113 | <change>Clarified that length of ArrayBufferView is actually byteLength.</change> |
| 114 | </revision> |
| 115 | <revision date="2014/07/15"> |
| 116 | <change>Added NoInterfaceObject extended attribute.</change> |
| 117 | </revision> |
| 118 | </history> |
| 119 | </ratified> |