There are actually two questions:
- What happens if you use
packoffset, as a result of which the variable goes beyond the limits of one register? - How do you use
packoffsetwith boolvalues?
The answer to the first question: the HLSL compiler will do some checking on the values packoffset. Therefore, the following will not compile, because it Var2cannot fit in c0, and the compiler will not automatically “wrap” it in c1:
cbuffer SomeBuffer : register( b1 )
{
float3 Var1 : packoffset(c0);
float2 Var2 : packoffset(c0.w);
}
: bool , float, :
cbuffer SomeBuffer : register( b1 )
{
bool SomeBool1 : packoffset(c0);
bool SomeBool2 : packoffset(c0.y);
float SomeFloat1 : packoffset(c0.z);
bool SomeBool3 : packoffset(c0.w);
}