Overhead of using Jobs vs overhead of using compute shaders?

Greetings,
I have a few straight forward vector calculations in a for loop that is not needed to be done often, only once in a while in parallel in the background while the player is transitioning to another area, as well as some normalised NPC-statistics from 0 to 1 that are to be updated about once a minute or even less depending on circumstance and distance.

A few years ago when I begun this project I aimed at doing these in a compute shader since the infrequent use wouldn’t impact any setpass calls or CPU-GPU-CPU communication that hard. The game is not the most visually demanding, as it has low-poly early PS2/late N64-like graphics, so the GPU would have the bandwidth. Now that I have had some time and experience using the Job system, I also noticed that this comes with some overhead as well.

So the question remains. Has anyone done any performans profiling, with regards to overhead, to determine if some calculations should be done in a compute shader, or using the Job system, and what the benefits could potentially be?

Such profiling is very, very, very project and hardware specific. If the CPU has spare worker threads, I would probably start implementing it there first. There’s no CPU-GPU-CPU exchanges required, plus in my experience Intel integrated graphics have bandwidth issues (mostly fill-rate) and can’t run compute shaders asynchronously, so if you got anything happening on screen, a sudden compute shader dispatch can cause stutters. Granted, if you are trying to reduce initialization times on a black screen, split the work between the CPU and GPU.

1 Like

Thank you. :3 I am mostly concerned with Switch for this, but because I am also making WebGL-games it’s good to know.

From what I’ve heard (don’t know if it is all true), Switch is very similar to Intel integrated except that it is a bit stronger with multiple render targets so deferred shading works a lot better. But I’ve heard people convert their compute shaders to fragment shaders on Switch.

1 Like