- Home /
Unity Jobs/DOTS Vs Compute Shader
I am a bit confused on what the specific use cases are for these optimization features. I often hear "Parallel Processing" on the GPU, and "Multithreading".
What are these best used for? Is one "better" than the other?
Sorry for the noob question
multi-threading enables parallel (data) processing. Multi-threading means: multiple processors working together simultaneously.
"Unity Jobs" is a system that makes CPU multi-threading easy.
"Compute shader" allows you to use a GPU for general computation; as an co-processor, essentially.
For example: processor #1 runs gameplay code, processor #2 calculates physics, processor #3 works on graphics, processor #4 handles music & sound effects etc.
Or: Let's say you have VERY big array to do something with. You process that data on a single CPU and it's turn out to be very slow, resulting in low framerate. So, to increase performance, you divide that array into 4 equal chunks, one for every processor to process simultaneously. This will speed up the process about 4x. You just multi-threaded it.
If that's not enough you can sometimes use a compute shader and gain >100x speedup $$anonymous$$us time to move that data between the CPU-GPU back & forth (not always worth it).
Your answer
Follow this Question
Related Questions
How can you ascyncronously modify mesh vertex data? 0 Answers
[Problem] Use Playerpref.GetInt in other thread 0 Answers
Return value from coroutine to non monobehaviour 1 Answer
GPU Sorting 0 Answers
Is there a way to determine the number of GPU cores available for a compute shader at runtime? 0 Answers