Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::gpu::vulkan::TextureSyncStateTable Class Reference

Tracked state for a set of textures, under the discipline the backend records against. More...

#include "donner/gpu/vulkan/VulkanResourceState.h"

Public Types

using SharedStateHandle = std::shared_ptr<SharedState>
 Shared ownership of synchronization state used by aliased texture resources.

Public Member Functions

 TextureSyncStateTable ()=default
 Slot tables stay independent; sharing an image requires an explicit alias.
 TextureSyncStateTable (const TextureSyncStateTable &)=delete
TextureSyncStateTable & operator= (const TextureSyncStateTable &)=delete
 TextureSyncStateTable (TextureSyncStateTable &&other)=default
 Construct by moving another instance's state.
TextureSyncStateTable & operator= (TextureSyncStateTable &&other)=default
 Replace this object's state by moving another instance.
TextureSyncState stateOf (uint32_t textureSlot) const
 The state textureSlot will be in at this point of an encode: the staged state when one was recorded, otherwise the committed one. A slot never seen reads as untouched.
TextureSyncState committedStateOf (uint32_t textureSlot) const
 The state textureSlot is committed to, ignoring anything staged.
SharedStateHandle share (uint32_t textureSlot)
 Returns the committed state owner for an image, creating an untouched entry if needed.
bool alias (uint32_t textureSlot, SharedStateHandle state)
 Makes this slot name an image another runtime device already tracks. Its staged state stays private to this table until an accepted submission commits it.
void stage (uint32_t textureSlot, const TextureSyncState &state)
 Records that a transition to state was encoded, pending submission.
void commitStaged ()
 Promotes every staged transition to committed. Call only once the submission succeeded.
void discardStaged ()
 Drops every staged transition, leaving committed state untouched.
void forget (uint32_t textureSlot)
 Forgets a slot entirely, for a texture that no longer exists.
void reset (uint32_t textureSlot, const TextureSyncState &state)
 Replaces everything known about textureSlot with state, committed.
bool hasStagedChanges () const
 Whether any transition is staged and not yet committed.

Detailed Description

Tracked state for a set of textures, under the discipline the backend records against.

A transition recorded into a command buffer updates the staged view; only a submission that actually reached the queue commits it. An encode that fails partway, or a submit the driver rejects, discards the staging instead - so the table never claims a transition the GPU never ran, which would make every later barrier compute the wrong source scope from a state that does not exist.

Constructor & Destructor Documentation

◆ TextureSyncStateTable()

donner::gpu::vulkan::TextureSyncStateTable::TextureSyncStateTable ( TextureSyncStateTable && other)
default

Construct by moving another instance's state.

Parameters
otherSource object.

Member Function Documentation

◆ alias()

bool donner::gpu::vulkan::TextureSyncStateTable::alias ( uint32_t textureSlot,
SharedStateHandle state )
nodiscard

Makes this slot name an image another runtime device already tracks. Its staged state stays private to this table until an accepted submission commits it.

Parameters
textureSlotNew registration slot.
stateShared committed state owner.
Returns
False for a null owner, leaving the slot unchanged.

◆ committedStateOf()

TextureSyncState donner::gpu::vulkan::TextureSyncStateTable::committedStateOf ( uint32_t textureSlot) const
nodiscard

The state textureSlot is committed to, ignoring anything staged.

For work recorded outside an encode, which is ordered against what the GPU has already been told to do rather than against a transition some submission may yet discard.

Parameters
textureSlotTexture slot to query.

◆ forget()

void donner::gpu::vulkan::TextureSyncStateTable::forget ( uint32_t textureSlot)

Forgets a slot entirely, for a texture that no longer exists.

Parameters
textureSlotTexture slot to drop.

◆ operator=()

TextureSyncStateTable & donner::gpu::vulkan::TextureSyncStateTable::operator= ( TextureSyncStateTable && other)
default

Replace this object's state by moving another instance.

Parameters
otherSource object.
Returns
This object after the move.

◆ reset()

void donner::gpu::vulkan::TextureSyncStateTable::reset ( uint32_t textureSlot,
const TextureSyncState & state )

Replaces everything known about textureSlot with state, committed.

For an image that arrived from outside the recorded command streams, which is to say a frame handed over by a presentation engine: nothing this table recorded about the slot applies to it, and what does apply is not something any recorded transition produced.

Parameters
textureSlotTexture slot to reset.
stateState the image is known to be in.

◆ share()

SharedStateHandle donner::gpu::vulkan::TextureSyncStateTable::share ( uint32_t textureSlot)
nodiscard

Returns the committed state owner for an image, creating an untouched entry if needed.

Parameters
textureSlotSlot of the image being exported.

◆ stage()

void donner::gpu::vulkan::TextureSyncStateTable::stage ( uint32_t textureSlot,
const TextureSyncState & state )

Records that a transition to state was encoded, pending submission.

Parameters
textureSlotTexture slot the transition applies to.
stateResulting state.

◆ stateOf()

TextureSyncState donner::gpu::vulkan::TextureSyncStateTable::stateOf ( uint32_t textureSlot) const
nodiscard

The state textureSlot will be in at this point of an encode: the staged state when one was recorded, otherwise the committed one. A slot never seen reads as untouched.

Parameters
textureSlotTexture slot to query.

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