I’ve been going through the code to better understand how various shaders are assembled and how they’re submitted to the Engine. I’ve wanted to know more about this out of curiosity, and also to be able to better create materials or effects.
Thus far, I understand that the Engine relies on combining several shaders in a modular fashion and relies heavily on
#ifdef blocks. I also see that new Effects are stored within a custom registry. I see how the code executes, but it’d be great to hear more about how it works (and how it’s intended to work!) from someone familiar with the entire codebase and its history.
Does the system always do a single draw pass when possible? Are there specific operations that always require multiple draws? Is there any interleaving? What’s the overall philosophy – to combine everything into a single master shader and handle everything via buffers, or to split effects and meshes into different draw calls, etc.
If anyone can provide a bit more understanding of its design and the reasoning for its design (for example, maybe readability/maintenance has been prized in some places over pure speed), that would be most helpful.