Mark more textures as discardable #113781
Open
+13
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.