VPP  0.7
A high-level modern C++ API for Vulkan
Public Member Functions | List of all members
vpp::UniformFld< TAG, HostT, OFFSET > Struct Template Reference

Template for defining uniform data fields. More...

#include <vppLangIntUniform.hpp>

Public Member Functions

 UniformFld ()
 Constructs uninitialized or GPU-side data field.
 
 UniformFld (const HostT &value)
 Constructs initialized CPU-side data field.
 
 operator HostT & ()
 Allows CPU-side access to the field.
 
 operator const HostT & () const
 Allows CPU-side read-only access to the field.
 

Detailed Description

template<ETag TAG, class HostT, int OFFSET = -1>
struct vpp::UniformFld< TAG, HostT, OFFSET >

Template for defining uniform data fields.

Place UniformFld inside UniformStruct to define a data field. This field can have scalar, vector or matrix type. You must specify one type in the template argument list: the host type (CPU-side). The shader (GPU-side) type is automatically inferred.

Example:

template< ETag TAG >
struct TFramePar : public UniformStruct< TAG, TFramePar >
{
// This defines a field which will be represented by glm::mat4
// matrix type on CPU side and vpp::Mat4 on GPU side. The second one
// is automatically determined from vpp::StructMemberTraits specialization.
UniformFld< TAG, glm::mat4 > m_world2projected;
UniformFld< TAG, glm::mat4 > m_world2view;
// ...
};

The first argument should be the tag passed from UniformStruct.

The second argument describes the CPU type. That allows to create CPU version of the structure that is compatible with GPU version. This argument can be one of the following:

[ caution! document also alignment issues with uniform buffers! ]


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