Does anyone know how to use “packetoffset” with a bool type in DirectX10/11? I am not sure how this should be aligned
cbuffer SomeBuffer : register( b1 )
{
float3 SomeFloat3: packoffset(c0);
float SomeFloat: packoffset(c0.w);
float3 SomeFloat32: packoffset(c1);
float2 SomeFloat2; ??
bool SomeBool1; ??
bool SomeBool2; ??
bool SomeBool3; ??
}
That’s actually two questions:
packoffsetthat results in a variable extending beyond the bounds of a single register?packoffsetwithboolvalues?The answer to the first question is: The HLSL compiler will do some validation on the
packoffsetvalues. So the following will not compile, becauseVar2can’t fit in toc0, and the compiler will not automatically “wrap” it intoc1:The answer to the second question is:
boolvalues take the same space as afloat, so you can pack them like this: