Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualHodgman

Posted 24 November 2012 - 09:00 PM

Which versions of Direct3D and HLSL are you using?
For D3D11, the formats that can be used for vertex data are listed here.
For D3D9, they're listed here, but you also have to check the device caps to make sure at runtime. Also, the vertex-declaration types and the HLSL types don't have to match; they'll be cast.

I wasn't aware of any alignment requirements, but the fact that D3D11's element-offset variable is called "AlignedByteOffset" implies there are Posted Image
Also, it allows you to use D3D11_APPEND_ALIGNED_ELEMENT to specify that you want D3D to figure out the correct offset including padding, but there seems no way to query the automatically configured value of "AlignedByteOffset" after creating your input layout, which means you wouldn't know how to lay out your vertex buffer!?
That is interesting... As a guess, I would assume alignment requirements might be the per-component size of the element, e.g. for DXGI_FORMAT_R32G32_FLOAT alignment would be 4 bytes.

#1Hodgman

Posted 24 November 2012 - 09:00 PM

Which versions of Direct3D and HLSL are you using?

For D3D11, the formats that can be used for vertex data are listed here.

For D3D9, they're listed here, but you also have to check the device caps to make sure at runtime. Also, the vertex-declaration types and the HLSL types don't have to match; they'll be cast.

I wasn't aware of any alignment requirements, but the fact that D3D11's element-offset variable is called "AlignedByteOffset" implies there are Posted Image
Also, it allows you to use D3D11_APPEND_ALIGNED_ELEMENT to specify that you want D3D to figure out the correct offset including padding, but there seems no way to query the automatically configured value of "AlignedByteOffset" after creating your input layout, which means you wouldn't know how to lay out your vertex buffer!?
That is interesting... As a guess, I would assume alignment requirements might be the per-component size of the element, e.g. for DXGI_FORMAT_R32G32_FLOAT alignment would be 4 bytes.

PARTNERS