Alundra, on 11 Apr 2014 - 03:04 AM, said:
On a renderer it's nice to have RenderState class with static variables + Init() to avoid Renderer.cpp of 4000 lines.
That doesn't follow. Nothing about static variables makes the rest of your code smaller. You've got a false equivalency going on here.
I was not clean on this view, but L. Spiro said the reason after.
It's to have a class who store all render state object needed for the render static to avoid to have monster function call with 10 parameters.
And one Init() in RenderState class to avoid Renderer Init() function to be large code.
But I have to say that I don't allow external render state, for example I have that in Material :
enum TBlendMode
{
BM_OPAQUE = 0, //!< Opaque blend mode.
BM_ADDITIVE = 1, //!< Additive blend mode.
BM_ALPHA = 2 //!< Alpha blend mode.
};
ID3D11BlendState* m_OpaqueBlendState; //!< Opaque blend state.
ID3D11BlendState* m_AlphaBlendState; //!< Alpha blend state.
ID3D11BlendState* m_AdditiveBlendState; //!< Additive blend state.
ID3D11BlendState* m_AdditiveSrcAlphaBlendState; //!< AdditiveSrcAlpha blend state.
But it's not just that, it has too :
ID3D11DepthStencilState* m_DisabledDepthStencilState; //!< Disabled depth stencil state.
ID3D11DepthStencilState* m_LessEqualDepthStencilState; //!< Less-Equal depth stencil state.
ID3D11RasterizerState* m_NoneCullRasterizerState; //!< NoneCull rasterizer state.
ID3D11RasterizerState* m_ClockWiseCullRasterizerState; //!< ClockWiseCull rasterizer state.
ID3D11RasterizerState* m_CounterClockWiseCullRasterizerState; //!< CounterClockWiseCull rasterizer state.
ID3D11SamplerState* m_ClampLinearSamplerState; //!< ClampLinear sampler state.
ID3D11SamplerState* m_RepeatLinearSamplerState; //!< RepeatLinear sampler state.
ID3D11SamplerState* m_ClampPointSamplerState; //!< ClampPoint sampler state.
ID3D11SamplerState* m_RepeatPointSamplerState; //!< RepeatPoint sampler state.
I have a list of Vertex/Pixel/Hull/Geometry/Compute shader as well but inside renderer actually, but I would change to avoid monster params function call.
All that combined to give that : http://uppix.com/f-GameD3D11_135347f06e001605d7.png
The probleme is to have renderer cleaned about clustered renderer/shadow mapping.