CUGL 4.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
cugl::graphics::ResourceDef Class Reference

#include <CUGraphicsBase.h>

Public Member Functions

 ResourceDef ()
 
 ResourceDef (const ResourceDef &def)
 
ResourceDefoperator= (const ResourceDef &def)
 

Public Attributes

ShaderStage stage
 
ResourceType type
 
Sint32 set
 
Sint32 location
 
Uint32 arraysize
 
bool unbounded
 
size_t blocksize
 

Detailed Description

This class represents a shader resource variable.

Resources are any value attached to a shader that cannot be represented as GLSL primitive type. These primarily include textures and uniform buffers. However, in the case of Vulkan, there is a wider array of types supported. See ResourceType for the supported types.

Constructor & Destructor Documentation

◆ ResourceDef() [1/2]

cugl::graphics::ResourceDef::ResourceDef ( )

Creates a default resource definition.

◆ ResourceDef() [2/2]

cugl::graphics::ResourceDef::ResourceDef ( const ResourceDef def)

Creates a copy of the given resource definition

Parameters
defThe resource definition to copy

Member Function Documentation

◆ operator=()

ResourceDef & cugl::graphics::ResourceDef::operator= ( const ResourceDef def)

Assigns this object to be a copy of the given resource definition.

Parameters
defThe resource definition to copy
Returns
a reference to this object for chaining

Member Data Documentation

◆ arraysize

Uint32 cugl::graphics::ResourceDef::arraysize

The number of elements to attach to this resource.

This value defines the size of a texture or buffer array in a GLSL shader. It is only supported by Vulkan. OpenGL will ignore this value.

◆ blocksize

size_t cugl::graphics::ResourceDef::blocksize

The blocksize of this resource.

This value is only relevant for dynamic uniform and storage buffers. It is ignored for all other resources.

◆ location

Sint32 cugl::graphics::ResourceDef::location

The resource location

In OpenGL, setting this value to -1 causes the shader to determine this location automatically. In Vulkan, this value is the binding location in the relevant descriptor set.

◆ set

Sint32 cugl::graphics::ResourceDef::set

The descriptor set for this resource

Descriptor sets are Vulkan only. This should be set to -1 for OpenGL.

◆ stage

ShaderStage cugl::graphics::ResourceDef::stage

The shader stage where this resource is located

◆ type

ResourceType cugl::graphics::ResourceDef::type

The resource type

◆ unbounded

bool cugl::graphics::ResourceDef::unbounded

Whether to make this resource an unbounded array.

If this value is true, then the value arraysize will be replaced with the device maximum. This can only be applied to the last resource in a set. For all other resources, arraysize will be preserved.

This feature is only supported by Vulkan, and not all versions of Vulkan support it. The Vulkan version must be 1.2 or greater, or support the descriptor indexing extension.


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