Shader Subsystem Design Help

Started by
1 comment, last by RealMarkP 15 years, 8 months ago
I've been thinking about this a lot lately. I cannot decide on how to design my shader subsystem of my engine. Assume that my engine has the capability to support Shaders. What I am stuck on is how to design my objects (Shader, state, program, Compiler, Etc). Could anyone here give me an example of how they might ahve implemented a shader system or point me to some resources? Thanks in advance.
------------Anything prior to 9am should be illegal.
Advertisement
Take a look at the infamous Material/Shader implmentation thread if you have not already. There are also quite a few threads that bring up some questions regarding some of the points that's discussed in the aforementioned thread which you can find using the search feature. Anyway, that thread is somehow outdated and I'd argue that there are more flexible ways to implement such a system in 2008.

For one thing, I strongly advise you to leverage the power of effects* instead of the lower-level shaders since the former allows all pipeline configurations to be set inside one file so there's no need to have distinct State objects. Not only is it simpler to use, but it also makes a one-man team more productive. I can hardly imagine how separate shaders can be superior in any way.

Having said that, if you're really planning to overlook all the benefits of an effect framework and go down the shader route, take a look at XEngine's documentations as a guiding example of how this can be done.

* Microsoft HLSL effect framework if you're planning to target Direct3D only or NVIDIA CgFX if you're looking for an API-agnostic solution
Thanks for the link. I stumbled upon that page just after posting. The only issue I find with it is that OpenGL does not support FX files natively, therefore making a shader based subsystem a nice solution. With that said, the thread does talk about using 3rd party libraries (ie. CgFX). I am still debating on using them.

The XEngine has a nice shader structure, I actually might go ahead and use theirs or design my system similar to what they have. Thanks, great find!
------------Anything prior to 9am should be illegal.

This topic is closed to new replies.

Advertisement