hello
i am migrating my dx11 indie game engine to dx12.
My dx11 engine was highly optimized e.g. rendering sponza scene would have
only 2 VertexBuffers ( containing material idx to reference material struc buffer )
- one for simple textured Material
- one for use with normal maps
so the render loop state changed where minimized like this
foreach subset ( e.g. 100 or more )
{
if ( subset visible)
{
set ShaderResourceView (texutes of material)
set pixelshader (of material )
draw call indexed..
}
}
Now in DX12
- (better ) i can get rid of setting the ShaderResourceView because i can index in a texture array
- (worse ) i have a PipelineState change for every different pixelshader ( material )
I know that PSO where made to be switched fastly but the PSO structure contains so many attributes.
Does the compiler of the commanlist optimize all theese attributes changes well ?
In my engine i have e.g. 15 typical dafault shaders
- with/without roughnessmap
- with/without mettalicmap
- with/without normalmap
…
Solution 1:
Now i could make one universal pixelshader with many branches to sample or not to sample a specific texture
=> advantage this would reduce to 2 draw calls for the whole sponza scene
Solution 2:
keeping my system of many Pipeline State changes
How to optimize this in DX12