[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] WEBGL_compressed_texture_s3tc spec clarification



The WEBGL_compressed_texture_s3tc spec specifies:

<<<

The length of the ArrayBufferView, pixels, passed to either compressedTexImage2D or compressedTexSubImage2D must match the following equation:

floor((width + 3) / 4) * floor((height + 3) / 4) * 8

>>>

However ArrayBufferView does not have a .length property. TypedArrays, which implement ArrayBufferView, have a length. DataView, which also implements ArrayBufferView, does not have a length. ArrayBufferView does have byteLength.

Is it intended that this restriction applies to the byteLength of the array buffer view? If not, what is the expected behavior if you pass in a typed array that is not a Uint8Array?

Based on how it currently works in browsers and what actually makes sense, I'm guessing this text is meant to refer to the byteLength property as that is the only length that an array buffer view really has. As such, I would propose changing this text to:

<<<

The length as given by pixels.byteLength of the ArrayBufferView, pixels, passed to either compressedTexImage2D or compressedTexSubImage2D must match the following equation:

floor((width + 3) / 4) * floor((height + 3) / 4) * 8

>>>

Alternatively, matching the restrictions on texImage2D and texSubImage2D, a restriction could be imposed on this extension that the ArrayBufferView must be a Uint8Array, and the following text added:

<<<

The supplied ArrayBufferView, pixels, must be a Uint8Array. If it is not, an INVALID_OPERATION error is generated.

>>>

Either way is fine by me, but at the moment it is a little ambiguous.

Thanks,
Brian