Bug 229180

Summary: [WebGL2] ETC1 texture is unable to upload using texStorage2D & compressTexSubImage2D
Product: WebKit Reporter: Andrew <andrew.shaitorov>
Component: ANGLEAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: dino, kbr, kkinnunen
Priority: P2    
Version: Safari 14   
Hardware: iPhone / iPad   
OS: iOS 14   
See Also: https://bugs.webkit.org/show_bug.cgi?id=229182

Description Andrew 2021-08-16 23:59:16 PDT

We were trying to optimize texture upload for our HTML5 game and have discovered a bug on WebGL2:

This works for ETC1 textures:
gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_RGB_ETC1_WEBGL, width, height, 0, data);

This doesn't (but works fine for DXT or PVRTC textures where these formats are available):
gl.texStorage2D(gl.TEXTURE_2D, 1, ext.COMPRESSED_RGB_ETC1_WEBGL, width, height);
gl.compressedTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, width, height, ext.COMPRESSED_RGB_ETC1_WEBGL, data);

Reproduces on Android devices in Chrome and iOS 14 (enabled WebGL2 in Safari Settings menu).

Original WebGL1 texture tester with compressedTexImage2D (you can find ETC1 textures at the bottom of the page):

Our WebGL2 modified version of the tester with texStorage2D & compressedTexSubImage2D:
Comment 1 Kimmo Kinnunen 2021-08-17 02:34:34 PDT
Thanks for the report!

As per the spec, it appears that compressedTexSubImage2D does not support COMPRESSED_RGB_ETC1_WEBGL


> Compression format COMPRESSED_RGB_ETC1_WEBGL may be passed to the compressedTexImage2D entry point. 

> Revision 5, 2014/03/07
> Remove ability to use the format with compressedTexSubImage2D, as per the GLES extension spec.

Closing this as invalid. If I've made a mistake, please reopen.
Comment 2 Kimmo Kinnunen 2021-08-17 02:38:08 PDT
Note, unexpectedly we don't return an error for the case. Bug 229182 tracks this omission.