Class BitonicSort
Bitonic Sort implementation using GPU compute shaders. It has a complexity of O(n*(log n)^2), which is inferior to most traditional sorting algorithms, but because GPUs have so many threads, and because each thread can be utilized, the algorithm can fully load the GPU, taking advantage of its high ALU and bandwidth capabilities.
Assembly: FlaxEngine.dll
File: Engine/Renderer/Utils/BitonicSort.h
Syntax
public class BitonicSort : public RendererPass
Methods
Dispose()
Cleanup service data.
Declaration
public virtual void Dispose() override
Overrides
Init()
Initialize service.
Declaration
public virtual bool Init() override
Returns
|
bool
|
Overrides
OnShaderReloading(Asset* obj)
setupResources()
Declaration
protected virtual bool setupResources() override
Returns
|
bool
|
Overrides
Sort(GPUContext* context, GPUBuffer* indicesBuffer, GPUBuffer* keysBuffer, GPUBuffer* countBuffer, uint32 counterOffset, bool sortAscending, int32 maxElements = 0)
Sorts the specified buffers of index-key pairs.
Declaration
public void Sort(GPUContext* context, GPUBuffer* indicesBuffer, GPUBuffer* keysBuffer, GPUBuffer* countBuffer, uint32 counterOffset, bool sortAscending, int32 maxElements = 0)
Parameters
|
GPUContext
context
The GPU context. |
|
GPUBuffer
indicesBuffer
The sorting indices buffer with an index for each item (sequence of: 0, 1, 2, 3...). After sorting represents actual items order based on their keys. Valid for uint value types - used as RWBuffer. |
|
GPUBuffer
keysBuffer
The sorting keys buffer with a sort value for each item (must match order of items in indicesBuffer). Valid for float value types - used as RWBuffer. |
|
GPUBuffer
countBuffer
The buffer that contains a items counter value. |
|
uint32
counterOffset
The offset into counter buffer to find count for this list. Must be a multiple of 4 bytes. |
|
bool
sortAscending
True to sort in ascending order (smallest to largest), otherwise false to sort in descending order. |
|
int32
maxElements
Optional upper limit of elements to sort. Cna be used to optimize indirect dispatches allocation. If non-zero, then it gets calculated based on the input item buffer size. |
ToString()
Gets the string representation of this object.
Declaration
public virtual String ToString() const override
Returns
|
String
|