Would someone answer my question, please? Does the title's method create the same components always or verify possible duplicates?

For exaple: I have one D3D12_INPUT_LAYOUT_DESC struct and two shaders need the same IL. How many ILs will it create? (In the D3D11 one was enough). Is it possible to avoid duplicates?

I highly appreciate the answer.


In DX12, you will be creating one input layout per pipeline state. This is preferable, because the driver will have all the knowledge of the shaders and input layout and it can do several optimizations with them, like inlining the vertex fetch inside the vertex shader. It can result in reduced latency when fetching a vertex buffer. Also, it can reduce traffic between VS-PS stage by omitting unused registers. And there are possibly many more opportunities to optimize. However, in your application you can share the input layout description with multiple PSOs.

Also note, that in DX11, indeed you could share input layouts between shaders and reuse one on the API side. But here the driver is deferring shader compilation until you actually use a shader and internally it can be creating multiple shader-input layout permutations behind the scenes. This can result in stuttering when the CPU can't keep up, so it is preferable to precompile these a'la DX12.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .