Hi guys,
I'm still not sure about what variable types to use for buffers and shaders. It's easier to explain with code:
// vertex layout
D3D11_INPUT_ELEMENT_DESC layout[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
I use a float3 for the position, should it instead be float4 ? Also, I like to use a float4 for the uv so I can use the .zw components for custom data but what if I only use the .xy components, should it then be float2 ?
The same question applies to the shader itself:
struct VS_INPUT
{
float3 position : POSITION;
float4 uv : TEXCOORD0;
};
Should these exactly match the layout (like they do here) ?
This has always confused me. Thanks.