| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <extension href="WEBGL_compressed_texture_s3tc_srgb/"> |
| 4 | <name>WEBGL_compressed_texture_s3tc_srgb</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>32</number> |
| 12 | <depends> |
| 13 | <api version="1.0"/> |
| 14 | </depends> |
| 15 | <overview> |
| 16 | <p> |
| 17 | This extension exposes the sRGB compressed texture formats defined in the |
| 18 | <a href="https://www.opengl.org/registry/specs/EXT/texture_sRGB.txt"> |
| 19 | EXT_texture_sRGB</a> OpenGL extension to WebGL. |
| 20 | </p> |
| 21 | <features> |
| 22 | <feature> |
| 23 | Compression formats <code>COMPRESSED_SRGB_S3TC_DXT1_EXT</code>, |
| 24 | <code>COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT</code>, <code>COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT</code>, and |
| 25 | <code>COMPRESSED_SRGB_ALPHA_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_SRGB_S3TC_DXT1_EXT</dt> |
| 36 | <dt>COMPRESSED_SRGB_ALPHA_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_SRGB_ALPHA_S3TC_DXT3_EXT</dt> |
| 63 | <dt>COMPRESSED_SRGB_ALPHA_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_srgb { |
| 95 | /* Compressed Texture Formats */ |
| 96 | const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C; |
| 97 | const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D; |
| 98 | const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E; |
| 99 | const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F; |
| 100 | }; |
| 101 | </idl> |
| 102 | <history> |
| 103 | <revision date="2016/06/10"> |
| 104 | <change>Initial revision.</change> |
| 105 | </revision> |
| 106 | <revision date="2016/07/21"> |
| 107 | <change>Moved to draft after discussion in working group, and study of possible dependencies.</change> |
| 108 | </revision> |
| 109 | <revision date="2017/05/31"> |
| 110 | <change>Moved to community approved after Mozilla voiced support.</change> |
| 111 | </revision> |
| 112 | </history> |
| 113 | </extension> |