


But then there's bank conflicts, warps, caching, sampling, swizzling. And you may want to go to a CUDA implementation rather than glsl. The GPU Gems article suggests a bitonic merge sort, and even heapsort and quicksort are possible with much cleverness.īut there's a lot to know to successfully craft an efficient implementation for a GPU algorithm-more than can be quickly discussed generally here.
#Pixel sorter making full version
The project is closed so no queries regarding buying the full version will be answered, although you can still make me an offer I can’t refuse. PxD was released in April 2014 as a first commercially available pixelsorting solution. (You can count swaps and "break" early by using an occlusion query)īy combining techniques you can sample k pixels at a time, allowing a pixel to move up to k steps per pass, thus requiring N/k passes and make more efficient use of resources.īut the real high-performance solutions come from implementing smarter algorithms than just bubble sort. PixelDrifter is a state-of-art pixelsorting application created by Dmitriy Krotevich. This may require up to N passes to displace a pixel N steps away. If you access only 2 input pixels per output pixel then you can effectively "swap" a pair of adjacent pixels on each pass. Note: A one pixel border is cropped from the output file (this is due to this pixel sorter making some of those outer pixels slightly transparent) Troubleshooting.
#Pixel sorter making code
But it will work, and this code may actually make the most sense. This will pixel sort an image called example.jpg in your current directory and save the output in the same directory as example.jpg. GPU Gems 2 Chapter 46 describes sorting on the GPU.Ĭonsider how you might use the Bubble-sort algorithm:īy accessing all N pixels of the column to be sorted per each output pixel, it will be very slow, since each output pixel reads N (with N^2 accesses - heavily affected by caching) and that's a lot of memory access.
