Hi all,
During my journey to go away from effects11 to own shader management, there's something I don't understand.
Effect files/FX:
- contains vertex and pixel shader (functions)
- contains constant buffers which can be used by the VS, PS (and GS etc)
- contains techniques which pick variants of combinations between the shaders
Now from what I understood, I will create separate files for my vertex and pixel shaders. So far so good.
But what do I do with constant buffers that are used by both the PS and VS (for example a CB per frame)?
- do I include the exact same CB definition in both the VS file and PS file?
- is 1 enough? And will the HLSL compiler accept that the CB is not defined in the shader file?
- do I need to create separate CB's for the PS and VS? I hope not, because the counter that goes to 14 will raise quickest that way.
- .... Other/ better option?
Any input is appreciated.
Note; I'm using VS 2013 community as IDE, which can compile all shaders for me using FXC under the hood.
During my journey to go away from effects11 to own shader management, there's something I don't understand.
Effect files/FX:
- contains vertex and pixel shader (functions)
- contains constant buffers which can be used by the VS, PS (and GS etc)
- contains techniques which pick variants of combinations between the shaders
Now from what I understood, I will create separate files for my vertex and pixel shaders. So far so good.
But what do I do with constant buffers that are used by both the PS and VS (for example a CB per frame)?
- do I include the exact same CB definition in both the VS file and PS file?
- is 1 enough? And will the HLSL compiler accept that the CB is not defined in the shader file?
- do I need to create separate CB's for the PS and VS? I hope not, because the counter that goes to 14 will raise quickest that way.
- .... Other/ better option?
Any input is appreciated.
Note; I'm using VS 2013 community as IDE, which can compile all shaders for me using FXC under the hood.