-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Add support for decompressing ETC2 #100365
Conversation
716335d
to
e517445
Compare
e517445
to
a9e38a6
Compare
I don't have a setup for etc2 verification right now. I recall these types of PRs require device access. |
It's possible to test this by enabling 'import as etc2/astc' in the project settings and copying the *.etc2.ctex file from the project's imported directory into the main one |
a9e38a6
to
27f59dd
Compare
I've added boundary checks (in a similar way to bcdec), it should function correctly now |
Here are some etc2 textures for testing purposes: On hardware that supports etc2, they will be passed directly to the gpu, while on ones that don't they will be decompressed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally using the textures from tex.zip
, it works as expected.
Testing project: test_etc2_load.zip
What's interesting is that the texture type appears to be ETC2, with the memory usage displayed as if the texture was uncompressed RGBA8 (even if the source ETC2 texture is RGB8 without alpha). This is on a NVIDIA GPU where ETC2 textures aren't natively supported:
Does this mean the texture is uncompressed to RGBA8 instead of RGB8 even if it has no alpha channel?
Uncompressed RGB8 | Uncompressed RGBA8 |
---|---|
![]() |
![]() |
Yes, etcpak (and many more block decompression tools) work this way to simplify the alignment to 4 bytes, though when using Vulkan most devices don't support directly sampling from RGB8 textures anyway, so they still need to be converted to RGBA8 |
27f59dd
to
32253f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, assuming the size impact is reasonable.
@@ -1,5 +1,5 @@ | |||
def can_build(env, platform): | |||
return env.editor_build | |||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should measure the size impact on a template_release
build to make sure that the increase in binary size is worth the added feature.
32253f7
to
c4fd9f9
Compare
I made some
The size impact seems really minimal:
That seems somewhat surprising, but I suppose we only use very little code in the template so the rest gets optimized out by the linker. |
Thanks! |
Fixes #25595
TODO: