VPP  0.8
A high-level modern C++ API for Vulkan
vpp::VArray< ItemT > Class Template Reference

Declares mutable shader local variable of array type. More...

#include <vppLangAggregates.hpp>

Public Member Functions

 VArray (int s)
 Constucts local array of specified size. More...
 
template<typename IndexT >
auto operator[] (IndexT index) const
 Allows read/write access to elements of the array.
 
Int Size () const
 Returns GPU-level value equal to the size of the array.
 
int size () const
 Returns CPU-level value equal to the size of the array.
 

Detailed Description

template<class ItemT>
class vpp::VArray< ItemT >

Declares mutable shader local variable of array type.

This allows to create local arrays of specified type (scalar, vector or matrix) and the size determined at shader compilation time.

Beware that mutable local variables may degrade performance on GPU because they consume general purpose registers for each local thread. Arrays obviously take even more registers.

Constructor & Destructor Documentation

◆ VArray()

template<class ItemT >
vpp::VArray< ItemT >::VArray ( int  s)

Constucts local array of specified size.

The size may come from CPU-level variable. It can not be changed after constructing the array.

The lifetime of constructed array is until the end of the shader. Consider reusing the array if possible in order to avoid excessive register usage.


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