Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTX2Loader: Fix transcode target choices for UASTC on iOS. Add BC7. #19846

Merged
merged 1 commit into from Jul 17, 2020

Conversation

donmccurdy
Copy link
Collaborator

@donmccurdy donmccurdy commented Jul 16, 2020

Fixes Basis UASTC decoding on iOS. We were trying to transcode to PVRTC, which failed. On devices that only support PVRTC, it seems like we can transcode ETC1S to PVRTC but UASTC must be decoded to RGBA32. @MarkCallow does that sound right? Or is that a temporary limitation in the transcoder? Transcoding to PVRTC requires that the texture have power of two dimensions.

Excuse the extra logging, I'll clean that up shortly. Done.

@donmccurdy donmccurdy added this to the r119 milestone Jul 16, 2020
@donmccurdy donmccurdy marked this pull request as draft July 16, 2020 03:25
@MarkCallow
Copy link

What devices only support PVRTC? I thought all iOS devices support ETC2 as well.

The real question is does the browser you are using support the WEBGL_compressed_texture_PVRTC extension. If it does not, try for the ETC2 or ASTC extensions instead. In fact ASTC, if available, should be the first choice when transcoding UASTC.

@donmccurdy
Copy link
Collaborator Author

donmccurdy commented Jul 16, 2020

iOS / Safari supports only PVRTC at this point. Not even ETC1. If you enable the experimental WebGL 2 flag you get more options (ASTC, ETC1, + ETC2 I think), but I'm not sure it works as advertised yet and haven't dug into that. Checked on an iPhone 11 with https://toji.github.io/texture-tester/.

I am definitely sure the device supports PVRTC. Transcoding ETC1S to PVRTC works and renders fine. Transcoding UASTC to PVRTC fails completely — no data is returned, there is nothing to upload to the GPU.

@lexaknyazev
Copy link
Contributor

Recent iOS devices support ASTC and ETC, it's just Webkit doesn't expose the WebGL extensions.

We have to wait until this issue is resolved: https://bugs.webkit.org/show_bug.cgi?id=198948.

@donmccurdy donmccurdy marked this pull request as ready for review July 17, 2020 04:02
@donmccurdy
Copy link
Collaborator Author

@MarkCallow thanks for the tip about power-of-two dimensions. This is working on iOS now.

@donmccurdy
Copy link
Collaborator Author

I should note that KTX2Loader does still fail when the experimental WebGL 2 option is enabled... as far as I can tell Safari then claims to support ASTC, but actually doesn't? ASTC is working on other devices, so I would like to think this will start working when Safari's WebGL 2 implementation is complete, and we can ignore the issue until then.

If it turns out to be common for users to enable that experimental option, I guess we could resort to UserAgent sniffing. 😕

@mrdoob mrdoob merged commit 27ee5da into mrdoob:dev Jul 17, 2020
@mrdoob
Copy link
Owner

mrdoob commented Jul 17, 2020

Thanks!

@donmccurdy donmccurdy deleted the bug-ktx2loader-uastc-ios branch July 17, 2020 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants