This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma use_dxc //enable SM 6.0 features, in Unity this is only supported on version 2020.2.0a8 or later with D3D12 enabled | |
#pragma kernel CountTotalsInBlock | |
#pragma kernel BlockCountPostfixSum | |
#pragma kernel CalculateOffsetsForEachKey | |
#pragma kernel FinalSort | |
uint _FirstBitToSort; | |
int _NumElements; | |
int _NumBlocks; | |
bool _ShouldSortPayload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Buffer<uint> Input; | |
RWBuffer<uint> Output; | |
//returns the index that this value should be moved to to sort the array | |
uint CuteSort(uint value, uint laneIndex) | |
{ | |
uint smallerValuesMask = 0; | |
uint equalValuesMask = ~0; | |
//don't need to test every bit if your value is constrained to a smaller range |