VPP  0.8
A high-level modern C++ API for Vulkan
vpp::VBool Class Reference

Shader (GPU-side) data type for mutable variables of boolean type. More...

#include <vppLangScalarTypes.hpp>

Public Member Functions

 VBool (const Bool &rvalue)
 
const VBooloperator= (const Bool &rhs)
 
 operator Bool () const
 
Bool operator|| (const Bool &rhs) const
 
Bool operator && (const Bool &rhs) const
 
Bool operator! () const
 
Bool operator== (const Bool &rhs) const
 
Bool operator!= (const Bool &rhs) const
 

Detailed Description

Shader (GPU-side) data type for mutable variables of boolean type.

Use this type inside shader code as a counterpart of CPU-side bool 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 Bool, unless you really want a mutable variable.

The lifetime of all local mutable variables (including VBool) 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 VBool type has also a workgroup-scoped counterpart called WBool. Caution: the reusing semantics does not apply to workgroup-scoped variables (they are permanent).


The documentation for this class was generated from the following file: