![]() |
VPP
0.8
A high-level modern C++ API for Vulkan
|
Shader (GPU-side) data type for mutable variables of 64-bit floating point type. More...
#include <vppLangScalarTypes.hpp>
Shader (GPU-side) data type for mutable variables of 64-bit floating point type.
Use this type inside shader code as a counterpart of CPU-side double type.
This is a l-value type. You can assign to it at will.
Beware that mutable variables can degrade performance on GPU. Consider using Double, unless you really want a mutable variable.
The lifetime of all local mutable variables (including VDouble) 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 VDouble type has also a workgroup-scoped counterpart called WDouble. Caution: the reusing semantics does not apply to workgroup-scoped variables (they are permanent).