| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <draft href="EXT_texture_compression_rgtc/"> |
| 4 | <name>EXT_texture_compression_rgtc</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>39</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_rgtc.txt"> |
| 20 | EXT_texture_compression_rgtc</a> OpenGL extension to WebGL. Consult that extension |
| 21 | specification for behavioral definitions, including error behaviors. |
| 22 | </p> |
| 23 | <p> |
| 24 | Updates of partial tiles detailed in the "Implementation Note" section of the |
| 25 | EXT_texture_compression_rgtc specification must be supported in an implementation of this |
| 26 | WebGL extension. |
| 27 | </p> |
| 28 | <features> |
| 29 | <feature> |
| 30 | Compression formats <code>COMPRESSED_RED_RGTC1_EXT</code>, |
| 31 | <code>COMPRESSED_SIGNED_RED_RGTC1_EXT</code>, |
| 32 | <code>COMPRESSED_RED_GREEN_RGTC2_EXT</code>, |
| 33 | and <code>COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT</code> may be passed to |
| 34 | the <code>compressedTexImage2D</code> and <code>compressedTexSubImage2D</code> entry points. |
| 35 | </feature> |
| 36 | <feature> |
| 37 | Calling <code>getParameter</code> with the argument <code>COMPRESSED_TEXTURE_FORMATS</code> |
| 38 | will include the formats from this specification. |
| 39 | </feature> |
| 40 | <feature> |
| 41 | <p>The following format-specific restrictions must be enforced:</p> |
| 42 | <dl> |
| 43 | <dt>COMPRESSED_RED_RGTC1_EXT</dt> |
| 44 | <dt>COMPRESSED_SIGNED_RED_RGTC1_EXT</dt> |
| 45 | <dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to |
| 46 | <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be equal to the following number of bytes:</p> |
| 47 | <blockquote><code> |
| 48 | ceil(width / 4) * ceil(height / 4) * 8 |
| 49 | </code></blockquote> |
| 50 | <p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p> |
| 51 | </dd> |
| 52 | <dt>COMPRESSED_RED_GREEN_RGTC2_EXT</dt> |
| 53 | <dt>COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT</dt> |
| 54 | <dd><p>The <code>byteLength</code> of the ArrayBufferView, <code>pixels</code>, passed to |
| 55 | <code>compressedTexImage2D</code> or <code>compressedTexSubImage2D</code> must be equal to the following number of bytes:</p> |
| 56 | <blockquote><code> |
| 57 | ceil(width / 4) * ceil(height / 4) * 16 |
| 58 | </code></blockquote> |
| 59 | <p>If it is not, an <code>INVALID_VALUE</code> error is generated.</p> |
| 60 | </dd> |
| 61 | </dl> |
| 62 | </feature> |
| 63 | </features> |
| 64 | </overview> |
| 65 | <idl xml:space="preserve"> |
| 66 | [NoInterfaceObject] |
| 67 | interface EXT_texture_compression_rgtc { |
| 68 | const GLenum COMPRESSED_RED_RGTC1_EXT = 0x8DBB; |
| 69 | const GLenum COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC; |
| 70 | const GLenum COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD; |
| 71 | const GLenum COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE; |
| 72 | }; |
| 73 | </idl> |
| 74 | |
| 75 | <newtok> |
| 76 | <function name="compressedTexImage2D"> |
| 77 | <param name="internalformat" type="GLenum"/> |
| 78 | Accepted by the <code>internalformat</code> parameter: |
| 79 | <code>COMPRESSED_RED_RGTC1_EXT</code>, |
| 80 | <code>COMPRESSED_SIGNED_RED_RGTC1_EXT</code>, |
| 81 | <code>COMPRESSED_RED_GREEN_RGTC2_EXT</code>, |
| 82 | <code>COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT</code> |
| 83 | <br/> |
| 84 | </function> |
| 85 | |
| 86 | <function name="compressedTexSubImage2D"> |
| 87 | <param name="internalformat" type="GLenum"/> |
| 88 | Accepted by the <code>internalformat</code> parameter: |
| 89 | <code>COMPRESSED_RED_RGTC1_EXT</code>, |
| 90 | <code>COMPRESSED_SIGNED_RED_RGTC1_EXT</code>, |
| 91 | <code>COMPRESSED_RED_GREEN_RGTC2_EXT</code>, |
| 92 | <code>COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT</code> |
| 93 | <br/> |
| 94 | </function> |
| 95 | </newtok> |
| 96 | |
| 97 | <errors> |
| 98 | <error enum="INVALID_VALUE"> |
| 99 | The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and |
| 100 | <code>compressedTexSubImage2D</code> if the <code>internalformat</code> parameter is |
| 101 | <code>COMPRESSED_RED_RGTC1_EXT</code> or <code>COMPRESSED_SIGNED_RED_RGTC1_EXT</code> |
| 102 | and the byteLength of the ArrayBufferView is not: |
| 103 | <blockquote><code> |
| 104 | ceil(width / 4) * ceil(height / 4) * 8 |
| 105 | </code></blockquote> |
| 106 | </error> |
| 107 | <error enum="INVALID_VALUE"> |
| 108 | The error <code>INVALID_VALUE</code> is generated by <code>compressedTexImage2D</code> and |
| 109 | <code>compressedTexSubImage2D</code> if the <code>internalformat</code> parameter is |
| 110 | <code>COMPRESSED_RED_GREEN_RGTC2_EXT</code> or <code>COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT</code> |
| 111 | and the byteLength of the ArrayBufferView is not: |
| 112 | <blockquote><code> |
| 113 | ceil(width / 4) * ceil(height / 4) * 16 |
| 114 | </code></blockquote> |
| 115 | </error> |
| 116 | </errors> |
| 117 | |
| 118 | <history> |
| 119 | <revision date="2018/09/26"> |
| 120 | <change>Initial revision.</change> |
| 121 | </revision> |
| 122 | <revision date="2018/09/26"> |
| 123 | <change>Rename to EXT_texture_compression_rgtc from WEBGL_compressed_texture_rgtc</change> |
| 124 | </revision> |
| 125 | </history> |
| 126 | </draft> |