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

Shader (GPU-side) data type for mutable variables of 4x4 32-bit floating point matrix type. More...

#include <vppLangMatrixTypes.hpp>

Public Member Functions

 VMat4 ()
 Constructs uninitialized matrix variable.
 
 VMat4 (const Mat4 &rhs)
 Constructs matrix variable and initializes it with given value.
 
 VMat4 (const VMat4 &rhs)
 Constructs matrix variable and initializes it with given value.
 
const VMat4operator= (const Mat4 &rhs)
 Assigns new value to matrix variable.
 
 operator Mat4 () const
 Retrieves the r-value from matrix variable.
 
template<typename IndexT >
auto operator[] (IndexT index) const
 Retrieves a column vector from matrix variable.
 

Detailed Description

Shader (GPU-side) data type for mutable variables of 4x4 32-bit floating point matrix type.

This is a l-value type. It can be initialized and changed any time.

Beware that mutable variables can degrade performance on GPU, therefore Mat4 is preferable, unless you really want a mutable variable.

The lifetime of all local mutable variables (including VMat4) 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 VMat4 type has also a workgroup-scoped counterpart called WMat4. 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: