-
-
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
Compatibility: Improve gl texture format detection #101217
Conversation
24e2920
to
6a2cc39
Compare
This would be best reviewed by @clayjohn. |
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, it works as expected. However, I didn't encounter any issues when loading ASTC-compressed textures in Compatibility prior to this PR.
Code looks good to me.
Testing project: test_pr_101217.zip
I did some testing with various compressed formats and noticed an issue with ETC2 in particular. Also, notice how the ASTC memory usage is much higher in Forward+ than in Compatibility. (It actually takes a long time to load, which makes me think it's being decompressed on the CPU, but only in Forward+, not in Compatibility.)
Forward+
S3TC | ETC2 | BPTC | ASTC |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
This error is printed every frame while previewing the ETC2 texture in the inspector:
ERROR: Attempting to use an uninitialized RID
ERROR: ./servers/rendering/renderer_rd/storage_rd/texture_storage.cpp:1411 - Parameter "tex" is null.
Compatibility
S3TC | ETC2 | BPTC | ASTC |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Unlike Forward+, I can use the ASTC-compressed HDRI as a sky texture, whereas it's just black in Forward+. I'm on a NVIDIA graphics card which lacks native ASTC support though.
Thank you for testing!
Both are actually decompressed on CPU. The memory usage should be the same, it looks like Compatibility creates a copy of the source image before uploading it to GPU, whereas Forward+ operates on the source data
That is to be expected, it will be resolved by #100365
That's surprising. it should work the same in Forward+ |
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.
Thanks! |
Follow-up to #100856
This PR simplifies the flow of the
_get_gl_image_and_format
method as well as ensures that any decompressed format is passed directly into the output (previously, most decompressed formats were converted into RGBA8, including HDR ones).This will ensure that the decompressed ASTC HDR textures will look the same as in Mobile and Forward+
Additionally, support for
Image::FORMAT_RGB565
is now implemented, as before it was missing likely due to an oversight.