core::gfx::bundle class final

\detail Bundles acts as a collection of core::gfx::materials, which are associated with a specific renderID (ordered from lowest to highest). These renderID's are what core::gfx::drawpass will use to decide which materials to bind for the current pass when rendering the associated geometry.

Aside from that, bundles also contain the abstraction of instance data associated with a material-geometry combination. This allows geometry to share instance related data (such as positions, or colors) across different 'core::gfx::material_t's and different 'core::gfx::pass'es. As example sharing instance position data between the depth-only prepass, and normal render pass.

member-functions

set_material
assigns a material to the bundle, with optional render_layer
public
instances
returns the instance count currently used for the given piece of geometry.
const public noexcept
size
returns how many instances are currently active for the given geometry.
const public noexcept
has
returns if there are any active instances for the given geometry.
const public noexcept
release
release the instance associated with the given ID and geometry
public noexcept
release_all
release all instance data.
public noexcept
set<…>
set instance data for the given instance (and range)
public

Function documentation

void core::gfx::bundle::set_material(core::resource::handle<core::gfx::material_t> material, std::optional<uint32_t> render_layer_override = std::nullopt)

Brief

assigns a material to the bundle, with optional render_layer

Details

Assigns a material to this bundle. If no render_layer_override is provided, the materials default value will be used instead.

uint32_t core::gfx::bundle::instances(core::resource::tag<core::gfx::geometry_t> geometry) const noexcept

Brief

returns the instance count currently used for the given piece of geometry.

Parameters
geometry in UID to check

uint32_t core::gfx::bundle::size(core::resource::tag<core::gfx::geometry_t> geometry) const noexcept

Brief

returns how many instances are currently active for the given geometry.

Parameters
geometry in UID to check

bool core::gfx::bundle::has(core::resource::tag<core::gfx::geometry_t> geometry) const noexcept

Brief

returns if there are any active instances for the given geometry.

Parameters
geometry in UID to check

bool core::gfx::bundle::release(core::resource::tag<core::gfx::geometry_t> geometry, uint32_t id) noexcept

Brief

release the instance associated with the given ID and geometry

Parameters
geometry in target UID
id in instance ID
Returns true in case the instance was successfully transitioned from active to deactivated.

bool core::gfx::bundle::release_all(std::optional<geometry_type> type = {}) noexcept

Brief

release all instance data.

Parameters
type in optionally target only static or dynamic data

template<typename T>
bool core::gfx::bundle::set(core::resource::tag<core::gfx::geometry_t> geometry, uint32_t id, psl::string_view name, const psl::array<T>& values)

Brief

set instance data for the given instance (and range)

Parameters
geometry in target UID
id in first instance ID
name in name of the buffer (present in the shader)
values in the values to set, where the size + id indicates the end of the range
Returns true if the geometry was found, all instances were present, and the upload dispatched. The upload is async.