- Home /
GPU Sorting
I'm trying to implement sorting using DirectCompute for my particle system. I found this post, which is great, but the sorting is incredibly slow. The C++ version can sort a million integers in a few milliseconds. The Unity/C# version is running at about 2000 integers per second. I'm getting better performance than that with CPU sorting right now.
Is this a limitation of Unity? Has anyone come across a fast sorting algorithm that can handle more than a few thousand elements?
Where exactly does the algorithm run slowly? Can you post your code/project? In my experience, computeBuffer.getData() runs EXTRE$$anonymous$$ELY slow (this is the part of the process when you get data back from your GPU into your CPU) and you need to watch out for that. It'll show up in the profiler as RenderTexture.SetActive or something like that.
Your answer
Follow this Question
Related Questions
Is it possible to profile compute shaders? 2 Answers
How to share constant variables between Compute Shaders? 0 Answers
Is there a way to determine the number of GPU cores available for a compute shader at runtime? 0 Answers
Compute shader dispatch large spike in CPU and GPU profiler 0 Answers
getting texture from shader into c# script. Also: best way to get values from GPU to CPU? 0 Answers