Quick question, based on performance which would be better, Compute shader or Vertex Shader?
Use case:
I am making one of those trap nation audio visualizers for unity and only need to modify vertex positions (of a prespecified mesh) to match audio input.
1 Answer
1
It’s hard to tell you which is better, performance-wise, because this aspect depends on specific implementation a lot. Both are pretty fast by default - because of massive parallelism GPUs offer - but ofc there are ways to make both do their jobs slower that needed.
I suggest against thinking too much about this just yet. Start creating Vertex Shader implementation and move to Compute Shaders only when VS proves to be not enough for your use case. Reason being:
-
Compute Shaders are more universal, yes, but Vertex Shaders are simpler and easier to use.
-
Compatibility. Vertex Shader is universally supported by pretty much every device with a GPU where Compute Shaders require >= DirectX 11.
Compute Shaders - compatibility details
Citing after Unity - Manual: Compute shaders :
Thanks! I think I'm gonna use a vertex shader. Quick question though, could you elaborate on "this aspect depends on specific implementation a lot."?
– ZY_brosBy implementation I meant the exact way & frequency you push this program data to the GPU.
– andrew-lukasikThanks for the answer!
– ZY_bros