I'm learning DirectX12 right now and I'm missing a few pieces of the puzzle in my own head on the overall structure of how you would setup a game. Specifically, I'm trying to get an idea of how shaders are processed through the pipeline. So in DirectX12, there seems to be a lot of work to setup a pipeline state object (PSO) and then you can assign one each of the following vertex, pixel, domain, hull, and geometry shaders. Well, it seems like there are probably many different shaders being rendered at one given time, so you would have your water shaders, glass shaders, ground, etc.. and you would need a separate pixel shader for each of these correct? So if you had about 50 pixel shaders running on a particular frame, you would need to create and configure another 50 pipeline objects? This seemed like overkill to me, so I'm just trying to figure out how this would work in a real world game engine. Thanks!

  • 1
    \$\begingroup\$ This is difficult to answer in general, but you can find pass-by-pass breakdowns of how several games/engines render their scenes, which can give you a few data points for the number of stages modern games might go through. Here's one on GTA V and another on Doom 2016 for example. \$\endgroup\$
    – DMGregory
    Dec 12 '17 at 2:52
  • \$\begingroup\$ Thank you! Great articles, not sure I’ll fully understand for some time, but helpful none the less. \$\endgroup\$
    – FAtBalloon
    Dec 12 '17 at 7:05
  • \$\begingroup\$ I note this question is on the last day of its bounty and still has no answers. It might be that even experts find it difficult to quantify what a "typical" scene is in terms of pipeline counts. You might be able to attract more answers if you narrow the scope to the software you yourself are building. Describe how you're using pipelines currently, and outline a specific problem you've encountered with them (try to show evidence that it's a problem, like profiling results or errors, rather than "50 seems high?") - then users here may be able to help you solve that problem. \$\endgroup\$
    – DMGregory
    Dec 20 '17 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.