I'm doing some mesh skinning in my vertex shader, and I have a depth pre-pass in place. I'm not crazy about doing all the vertex transformation twice for the skinning; is there a way to have one vertex shader be the input to multiple pixel shaders? Or do I have to do a vertex shader stream-output, and then set that as the input for the pixel shader somehow?
Vertex Shader to Multiple Pixel Shaders
You could pretransform the vertices with a compute shader, followed by more or less pass throgh vertex shaders.
Unless you are skinning thousands of characters several times or run on a very weak hardware, it won't matters much. You can compare skinned and non skin shader with profiling to confirm.
Output of skinned meshes with compute or stream output will add complexity, memory management, possible gpu flushes for nothing.
There is other factors for your depth prepass, like a separate vertex stream without UVs and un split position for the index buffer. Don't forget to optimise the index list, vertex order and element size ( half vs float, etc, ... ). And a depth prepass is a good candidate for a front to back sorting.
Cool. So just to be clear, on a technical level, the options are either stream-output or compute shader transformation to a buffer that I then bind to a pass-through vertex shader?