Mark more textures as discardable - #113781
Conversation
This allows the ARG to better optimize their usage for mobile devices. In particular, this allows the ARG to avoid loading the contents of the texture into tile memory when rendering into the texture if the contents won't be used anyway.
BastiaanOlij
left a comment
There was a problem hiding this comment.
All makes sense to me
Indeed, either we use an external VRS texture in which case this is skipped/not used, or we copy from a uniform texture format to this internal buffer formatting the data as the used extension requires. So there is no reason to keep the texture, nor load its current data from VRAM. |
|
Thanks! |
i get flickering each time i switch tabs aswell... |
Are you saying you see a flicker when you hover over a tooltip? Or when you click on one of the upper-right drop-down menus? What do you mean by switch tabs? Do you mean when you switch between scene tabs, or do you have tabs in a pop-up menu or something? |
|
@lord-muad-dib Can you post your system specs here? I can't reproduce the issue on any of my devices |
Godot v4.7.dev (77579f9) - Windows 11 (build 26200) - Multi-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (NVIDIA; 32.0.15.8180) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 threads) - 15.88 GiB memory https://github.com/user-attachments/assets/cdc4142a-1afa-4cee-8ed2-8f97a2cd033b |
|
Thank you! A few others stumbled on the same issue as well. Turns out it is indeed an NVidia only issue (I am on AMD which is why I couldn't reproduce the issue). I have a fix lined up already #115530 that others have confirmed works for them. So with any luck we will have this problem resolved within a day |
Mark more textures as discardable
Mark more textures as discardable

This is a follow up to #98670
In #98670 we were very conservative with which textures we marked as discardable as we were already making a huge change, we didn't want to create more regressions than necessary. Therefore, we left it as a follow up to find more opportunities for improvement.
Well, now it is time for the follow up!
This PR adds the
is_discardablehint to many of our render targets that are refreshed every frame. Particularly important are the:This ensures that we don't save the depth texture back to VRAM unless it is needed. It also ensures that we don't needlessly copy the 2D render target into tile memory right before overwriting the whole thing in the 3D tonemap pass.
The
is_discardablehint allows the ARG to avoid loading the contents of the texture into tile memory when rendering into the texture if the contents won't be used anyway. Similarly, it allows the ARG to avoid saving the memory off tile memory if the texture isn't going to be used again in the frame. This is especially important on ARM Mali devices because memory bandwidth from tile memory is a common bottleneck.The only change I am not 100% sure about is the VRS texture. But I discussed with @BastiaanOlij and he confirms that we fully overwrite the VRS texture each frame and we don't rely on it being available for multiple frames at a time, so this is a safe change there too.
This is an optimization specifically for TBDR GPUs, so it isn't expected to have any impact on desktop GPUs. Further, it will only benefit performance for bandwidth limited scenes. However, for non-bandwidth limited scenes, it is still hugely beneficial as bandwidth usage has a very strong impact on battery consumption. So this PR will help battery consumption a lot.
Testing a very simple scene with just a couple of objects I get the following numbers
Mali G715
Before: 1.8 mspf - 2.0 mspf
After: 1.2 mspf - 1.3 mspf
Adreno 640
Before: 4.7 mspf
After: 2.9 mspf
To be very clear, I don't expect to see any performance gains in most games, but very simple 3D games may see some benefit. And all games should have some battery savings as a result of this.