Hello,
I have a little problem :)
I would like to write data into buffer with format :
{"POSITION", 0, DXGI_FORMAT_R16G16_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"TPOSITION", 0, DXGI_FORMAT_R16G16_UINT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1 },
{"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