I'm interested in working with DirectX, but during researching this wonderful library I've got so much questions. At now first of questions is working with input layout and switching between different layouts for rendering difference game objects.
I can explain my question with example (very-very abstract example):
- Let assume that I want to render player object at first pass. During player rendering I use shadows and lightning, and may be another graphics improvements;
- Then I want to render road with using of tessellation;
- After that I want to spawn game world NPCs.
[source lang="cpp"]// Compiling shaderscontext->IASetInputLayout(...); // Setting input layout with using custom vertex shader// Rendering an object[/source]
Then I go to render road. And stop... Road isn't like a player. Let assume that I want to render it fast, without shadows and with tessellation. For doing such thing, I need to switch input layout - load and compile hull/domain shaders, change vertex shader and reset my input layout to new state for using new shader group.
After doing that I need return to shader from first pass to render NPCs. So, I call context->IASetInputLayout again... And so on, and so on.
Is it normal to switch between different input layouts during object rendering? Or may be I need to improve rendering sequence? Or I doing something wrong and input layout does not need to be switched during such rendering actions?
Hope for any answer With regards.
// Sorry for my English.