So I have a root signature with a descriptor table with an SRV, and two float 3 constants afterwards.
Code looks like:
D3D12_ROOT_PARAMETER param[3];
param[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
param[0].DescriptorTable.NumDescriptorRanges = 1;
param[0].DescriptorTable.pDescriptorRanges = range;
param[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
param[1].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
param[1].Constants.Num32BitValues = 3;
param[1].Constants.RegisterSpace = 0;
param[1].Constants.ShaderRegister = 0;
param[1].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
param[2].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
param[2].Constants.Num32BitValues = 3;
param[2].Constants.RegisterSpace = 0;
param[2].Constants.ShaderRegister = 1;
param[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_VERTEX;
Later on before I draw the objects I set the constants:
gfx->SetGraphicsRoot32BitConstants(1, 3, constant1, 0);
gfx->SetGraphicsRoot32BitConstants(2, 3, constant2, 0);
and in the shader I have something like this but it doesn't seem to work at all.
float3 constant1 : register(b0);
float3 constant2 : register(b1);
Whatever is in constant1 seems to work fine but constant2 doesn't have the correct values. What am I missing here? I assumed from the MSDN docs that the first constant in the root signature would be b0 and the second one would be b1. Is that not how it works or is there some kind of minimum alignment of 4 DWORDs?