core::meta::shader::instance::element class

Describes an element of a data container.

Descriptors and instance data can consist of several smaller building blocks as those types can be viewed as "structs of data". But even something as simple as a matrix4x4 is actually a "struct of 4 times float[4]". This is what element describes, a collection of addressable elements (from the perspective of the GPU) of a struct of data.

static variables

char
serialization_name
the serialization name for the psl::format::node
constconstconstexprconstexprprivateprivatestaticstatic

member-functions

name
const public noexcept
format
const public noexcept
offset
const public noexcept
default_value
const public noexcept
name
sets the name of the element (mostly meant for user information)
public
format
format to bind this element to.
public
offset
the offset from the parent in bytes.
public
default_value
public
serialize<…>
method that will be invoked by the serialization system.
private

Function documentation

psl::string8::view core::meta::shader::instance::element::name() const noexcept

Details

This is mostly for debugging purposes, it holds no other significance.

Returns the name of the element in the SPIR-V module (or the assigned one)

core::gfx::format core::meta::shader::instance::element::format() const noexcept

Returns the format that maps 1:1 to this element.

uint32_t core::meta::shader::instance::element::offset() const noexcept

Returns the offset in bytes where this element lives in respect to the parent.

const std::vector<uint8_t>& core::meta::shader::instance::element::default_value() const noexcept

Returns the default value (if any, otherwise defaulted) to fill in this element's data with if no override is given.

void core::meta::shader::instance::element::name(psl::string8::view value)

Brief

sets the name of the element (mostly meant for user information)

Parameters
value in the new name to set.

void core::meta::shader::instance::element::format(core::gfx::format value)

Brief

format to bind this element to.

Parameters
value in the format that bests describes this element.

void core::meta::shader::instance::element::offset(uint32_t value)

Brief

the offset from the parent in bytes.

Parameters
value in the offset from the parent structure start this element starts at.

void core::meta::shader::instance::element::default_value(const std::vector<uint8_t>& value)

Details

default values are a handy way of emplacing data "by default" into a descriptor/instance. When binding fails, or when there is no "real" backing resource to bind to (could be in the case of setting the override color of a particle system), then the shader will be filled in with this value instead. Depending if it is a instance, or descriptor element, you can even set this value per-material.

Parameters
value in the default value if no override is given.

template<typename S>
void core::meta::shader::instance::element::serialize(S& s) private

Brief

method that will be invoked by the serialization system.

Template parameters
S the type of the serializer/deserializer
Parameters
in instance of a serializer that you can read from, or write to.