DirectX11 and Batch Kit

Does anyone know how to use a "batch set" of type bool in DirectX10 / 11? I'm 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; ??
}
+3
source share
1 answer

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); // will not compile
}

: 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);
}
+2

Source: https://habr.com/ru/post/1785853/


All Articles