![]() |
VPP
0.8
A high-level modern C++ API for Vulkan
|
Shader (GPU-side) data type for mutable variables of 4-element boolean vector type. More...
#include <vppLangVectorTypes.hpp>
Shader (GPU-side) data type for mutable variables of 4-element boolean vector type.
Use this type inside shader code as a counterpart of CPU-side bool[4] type, when it is required to change value of the vector.
This is a l-value type. It can be initialized and changed any time.
Beware that mutable variables can degrade performance on GPU, therefore BVec4 is preferable, unless you really want a mutable variable.
The lifetime of all local mutable variables (including VBVec4) spans from the declaration to the end of current C++ block. This is the same as for ordinary C++ variable. However, each mutable variable allocates a variable slot (GPU register) which exists for entire time of shader execution (or shader-level function execution). VPP tries to optimize variable slot usage by reusing slots that were freed because their variables went out of scope. For that reuse to take place, the type of new variable must be identical to the type of some free slot.
Therefore you can safely create a lot of mutable variables as long as they are in separate C++ blocks and have the same type.
The VBVec4 type has also a workgroup-scoped counterpart called WBVec4. Caution: the reusing semantics does not apply to workgroup-scoped variables (they are permanent).