Skip to main content
Version: 🚧 Nightly

Class vtkF3DBitonicSort

Definition: vtkF3DBitonicSort.h (line 25)

Compute shader used to sort key/value pairs.

This class is used to sort buffers based on the Bitonic Sort algorithm. Inspired by https://poniesandlight.co.uk/reflect/bitonic_merge_sort/. The original code can be found there: https://github.com/tgfrerer/island. It's mostly rewritten but some parts are copied (MIT license, Tim Gfrerer).

Inherits from:

  • vtkObject

Members

Private attributes

Variable BitonicSortLocalSortComputeShader

Definition: vtkF3DBitonicSort.h (line 55)

vtkNew<vtkShader> vtkF3DBitonicSort::BitonicSortLocalSortComputeShader

Type: vtkNew< vtkShader >

Variable BitonicSortLocalSortProgram

Definition: vtkF3DBitonicSort.h (line 56)

vtkNew<vtkShaderProgram> vtkF3DBitonicSort::BitonicSortLocalSortProgram

Type: vtkNew< vtkShaderProgram >

Variable BitonicSortLocalDisperseComputeShader

Definition: vtkF3DBitonicSort.h (line 57)

vtkNew<vtkShader> vtkF3DBitonicSort::BitonicSortLocalDisperseComputeShader

Type: vtkNew< vtkShader >

Variable BitonicSortLocalDisperseProgram

Definition: vtkF3DBitonicSort.h (line 58)

vtkNew<vtkShaderProgram> vtkF3DBitonicSort::BitonicSortLocalDisperseProgram

Type: vtkNew< vtkShaderProgram >

Variable BitonicSortGlobalFlipComputeShader

Definition: vtkF3DBitonicSort.h (line 59)

vtkNew<vtkShader> vtkF3DBitonicSort::BitonicSortGlobalFlipComputeShader

Type: vtkNew< vtkShader >

Variable BitonicSortGlobalFlipProgram

Definition: vtkF3DBitonicSort.h (line 60)

vtkNew<vtkShaderProgram> vtkF3DBitonicSort::BitonicSortGlobalFlipProgram

Type: vtkNew< vtkShaderProgram >

Variable BitonicSortGlobalDisperseComputeShader

Definition: vtkF3DBitonicSort.h (line 61)

vtkNew<vtkShader> vtkF3DBitonicSort::BitonicSortGlobalDisperseComputeShader

Type: vtkNew< vtkShader >

Variable BitonicSortGlobalDisperseProgram

Definition: vtkF3DBitonicSort.h (line 62)

vtkNew<vtkShaderProgram> vtkF3DBitonicSort::BitonicSortGlobalDisperseProgram

Type: vtkNew< vtkShaderProgram >

Variable WorkgroupSize

Definition: vtkF3DBitonicSort.h (line 64)

int vtkF3DBitonicSort::WorkgroupSize = -1

Type: int

Public static functions

Function New

static vtkF3DBitonicSort * vtkF3DBitonicSort::New()

Return type: vtkF3DBitonicSort *

Public functions

Function vtkTypeMacro

vtkF3DBitonicSort::vtkTypeMacro(vtkF3DBitonicSort, vtkObject)

Parameters:

Return type:

Function Initialize

bool vtkF3DBitonicSort::Initialize(int workgroupSize, int keyType, int valueType)

Initialize the compute shaders. Parameters:

  • workgroupSize: The number of threads running in a single GPU workgroup.
  • keyType: The VTK type of the key to sort.
  • valueType: The VTK type of the value to sort. Only VTK_DOUBLE, VTK_FLOAT, VTK_INT and VTK_UNSIGNED_INT are supported

Returns:

true if succeeded.

Parameters:

  • int workgroupSize
  • int keyType
  • int valueType

Return type: bool

Function Run

bool vtkF3DBitonicSort::Run(vtkOpenGLRenderWindow *context, int nbPairs, vtkOpenGLBufferObject *keys, vtkOpenGLBufferObject *values)

Run the compute shader and sort the buffers. An OpenGL context must exists and given as input in the first argument Parameters:

  • nbPairs: The number of element in the buffer keys and values.
  • keys: OpenGL buffers keys. Must be valid and match data type specified during initialization.
  • values: OpenGL buffers values. Must be valid and match data type specified during initialization.

Returns:

true if succeeded.

Parameters:

  • vtkOpenGLRenderWindow * context
  • int nbPairs
  • vtkOpenGLBufferObject * keys
  • vtkOpenGLBufferObject * values

Return type: bool