Use GPU radix sort when we can (based on AMD FidelityFX) #1
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.
Port the ParallelSort v1.1.1 from AMD FidelityFX to Unity. The original code is Copyright © 2023 Advanced Micro Devices, Inc., and under MIT license. Curiously enough, I don't have AMD hardware here to test, but works fine on NVIDIA (DX12 and Vulkan) and Apple (Metal).
The sorting itself gets down from 11.9ms down to 3.3ms on Windows. On a Mac seemingly a smaller speedup, but it's also hard to measure individual frame parts at least within Unity itself.
Note: FidelityFX sort requires "wave operations" which means it does not work on DX11. So when on DX11, the sorting falls back to the previous slower bitonic sort. I did a quick attempt at emulating/redoing the parts that require wave operations to at least "do something correct" on DX11, but did not get it working just yet.