VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | List of all members
vpp::Pointer< ScalarT > Class Template Reference

Shader (GPU-side) data type for pointers to mutable variables. More...

#include <vppLangScalarTypes.hpp>

Public Member Functions

ScalarT Load () const
 Reads the target variable.
 
void Store (const ScalarT &value) const
 Stores specified value to the target variable.
 
ScalarT Exchange (const ScalarT &value) const
 Atomically exchanges specified value with the target variable. Returns previous value.
 
ScalarT CompareExchange (const ScalarT &newValue, const ScalarT &oldValue) const
 Atomically exchanges specified value with the target variable, but only if current value is equal to the oldValue parameter. Returns previous value.
 
ScalarT CompareExchangeWeak (const ScalarT &newValue, const ScalarT &oldValue) const
 Atomically exchanges specified value with the target variable, but only if current value is equal to the oldValue parameter. Returns previous value.
 
ScalarT Increment () const
 Atomically increments the target variable.
 
ScalarT Decrement () const
 Atomically decrements the target variable.
 
ScalarT Add (const ScalarT &value) const
 Atomically adds specified value to the target variable. Returns previous value.
 
ScalarT Sub (const ScalarT &value) const
 Atomically subtracts specified value from the target variable. Returns previous value.
 
ScalarT Min (const ScalarT &value) const
 Atomically computes minimum of specified value and the target variable and stores it to the target variable. Returns previous value.
 
ScalarT Max (const ScalarT &value) const
 Atomically computes maximum of specified value and the target variable and stores it to the target variable. Returns previous value.
 
ScalarT And (const ScalarT &value) const
 Atomically computes bitwise AND of specified value and the target variable and stores it to the target variable. Returns previous value.
 
ScalarT Or (const ScalarT &value) const
 Atomically computes bitwise OR of specified value and the target variable and stores it to the target variable. Returns previous value.
 
ScalarT Xor (const ScalarT &value) const
 Atomically computes bitwise XOR of specified value and the target variable and stores it to the target variable. Returns previous value.
 

Detailed Description

template<class ScalarT>
class vpp::Pointer< ScalarT >

Shader (GPU-side) data type for pointers to mutable variables.

Use this type inside shader code as a counterpart of CPU-side pointer type.

This is a r-value type. You do not construct the object directly, but rather use the & operator to take a pointer to specified variable of simple type, or array element.

Pointers are used mainly for atomic operations. This allows implementation of many lock-free parallel algorithms.

Pointers in the Vulkan compute model are abstract and cannot be subject to any arithmetic. A pointer variable always points to the same object and can be only dereferenced.

Example of using:

Shared(); VArray< UInt, 256 > workArea;
// ...
const UInt prevValue = ( & ( workArea [ index ] ) ).Increment();

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