Improve image hazard tracking granularity #4722
Merged
+388
−98
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.
Optimizes a bunch of barriers away when the app is doing back-to-back image copies/updates to the same subresource of an image. Since this uses morton codes to linearize texture coordinates, there will be false positives when copying unaligned image blocks around, but it improves a few common use cases.
This is a relatively common occurence when games stream in textures, either if virtual texturing is used (e.g. The Evil Within, this is one of the few games that constantly hit this case even during gameplay), or if a texture atlas is being created (seen that in Trine 5).
Also catches a few cases of 3D image updates in various Cryengine games, and some image->image copies in AC:Origins.
This probably won't drastically change performance anywhere, but it's a fairly trivial optmization and may reduce some GPU-bound frametime spikes here and there.