Jump to content
  • Advertisement
Sign in to follow this  
360GAMZ

DX11 [DX11] Does order matter in D3D11_INPUT_ELEMENT_DESC?

This topic is 2588 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

Do the order of the elements in the D3D11_INPUT_ELEMENT_DESC array matter?

In other words, are these two functionally identical?

D3D11_INPUT_ELEMENT_DESC VtxLayoutA[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
};


D3D11_INPUT_ELEMENT_DESC VtxLayoutB[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0 },
};

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the quick reply. No, not experiencing any problem. The DX docs don't make it clear and I just wanted to get some clarity.

Share this post


Link to post
Share on other sites
If you want to use D3D11_APPEND_ALIGNED_ELEMENT for the AlignedByteOffset then it will need to be in order I believe.

Share this post


Link to post
Share on other sites

If you want to use D3D11_APPEND_ALIGNED_ELEMENT for the AlignedByteOffset then it will need to be in order I believe.

Note that in the previous case:
- On slot 0, POSITION offset(0) and TEXCOORD offset(16)
- On slot 1, NORMAL offset(0)

so D3D11_APPEND_ALIGNED_ELEMENT would also work as input elements are on different slot. Basically, as long as you keep order within a slot, that's fine, but you can make interleaved declaration of input elements on different slots.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!