Jump to content
  • Advertisement
Sign in to follow this  

Writing to R16G16_UINT

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



I have a little problem :)

I would like to write data into buffer with format :

				{"LODID",     0, DXGI_FORMAT_R16_UINT,     1, 4, D3D11_INPUT_PER_INSTANCE_DATA, 1 },

First stream has 4 bytes, second stream has 6 bytes.

So, i created buffers with that sized and i copied USHORT data into buffer.


When rendering, it says

D3D11 ERROR: ID3D11DeviceContext::DrawIndexedInstanced: Vertex Buffer Stride (6) at the input vertex slot 1 is not aligned properly. The current Input Layout imposes an alignment of (4) because of the Formats used with this slot. [ EXECUTION ERROR #367: DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED]

Shader layout:

struct VIn
    uint2   position : POSITION0;
    uint2   instance : TPOSITION;
    uint    lodid    : LODID;

when i use 32bits , it's working fine. I also tried to use uint only and unpack two ushorts ( uints in hlsl ).

It's a pity, there are no ushorts in hlsl ;-)


thank you

Share this post

Link to post
Share on other sites

I think it complains your vertex's size isn't multiple of 4. You can try changing LODID to DXGI_FORMAT_R32_UINT or just leave it unused.

Since it mentions other formats you could also try to use separate buffer for LODID with DXGI_FORMAT_R16_UINT.

Edited by Zaoshi Kaba

Share this post

Link to post
Share on other sites



you are right. Also, there is not R16G16B16_UINT format, it has a reason :) These memory aligments are pain.

Thank you, I am on the good way now.

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!