Jump to content
  • Advertisement
Sign in to follow this  
Ratslayer

Dynamicly changing input layouts

This topic is 2860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I'm in the middle of designing the rendering functionality for my engine, and I've been wondering one thing: is it viable performance-wise to change the input layout layout prior to rendering any object (worst-case 1-2 times per mesh)?

The idea behind this is being able to use variable buffer signatures for animation and instancing. For instance, if I had a mesh of an animal, I could use a 4-bones-per-vertex format, as its animation isn't that complex. However, if I had a humanoid that could potentially have like 10 bones affecting a vertex on his face, I would switch to a 16-bones-per-vertex format, effectively saving some performance on the bone weight/index checks for the animal mesh.

Also, if I wanted to instance a mesh N times, like a column in a temple, then I could just append the input layout with N matrices representing every column's spatial orientation.

In DX documentation, I remember coming across code parts where they were trying to change the input-assembler layout as rarely as possible, which lead me to believe that it's computationally expensive for some reason, but now I wonder. Is changing input layout whenever one wants computationally viable? Should I design my rendering process in accordance with it? Or am I missing the big picture in some way?

Share this post


Link to post
Share on other sites
Advertisement
As with any performance related question the best option is to test both options, and see if you can measure which one is best.

My best guess is that it shouldn't be that expensive to change, but like any render state change it has some cost. However rendering with more compact vertex formats tends to be quicker than big ones, especially when the models are high poly.

Share this post


Link to post
Share on other sites
my self when i have different input layout i have a shader to go with it,
this way you get a shader that does stuff with that input layout only.
one way to go

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!