Long time ago, @Kalle)) asked for bool4 arrays into the shader: ((forum:hlsl-bool-array#comment-25187
In my DX9 shader i used
bool4x4 flags <String uiname="8x2 FX flags";>;
to reserve 16 flags that apply to every mesh. This works fine.
The same format doesn’t create a pin in a DX11 shader. Do i need some semantic or descriptive costume for it to work? Or do i really have to waste 32bit for each flag?
well if u have constant amount of flags u can do:
use uint bitwise operations. for example checking if the 4th bit is true:
(input & 0x00000010) != 0
or more user friendly
(input & [uint)1 << 4](https://vvvv.org/documentation/uint)1-<<-4) != 0
this way you have 32 “bools” per uint.
Thanks guys. Both solutions work.
The uint solution seems a bit cheaper on transfer costs, but bitwise operations won’t run below shader model 4.0.
The bool array solution is so easy! Two years ago, i must have expected that the contents of the array would be distributed across the spread of meshes, but obviously they’re not.