Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Core::Texture2DStore Class Reference

Registry store for authored sampled 2D texture handles. More...

#include <AssetRegistry.h>

Collaboration diagram for Engine::Core::Texture2DStore:

Classes

struct  Record
 Stored metadata for one 2D texture handle slot. More...

Public Member Functions

 Texture2DStore (AssetManager *assetManager=nullptr)
 Creates a 2D texture store backed by an optional asset manager.
void setAssetManager (AssetManager *assetManager)
 Sets the asset manager used when new texture handles reserve legacy runtime handles.
Assets::Texture2DHandle load (const std::filesystem::path &source, Assets::TextureType usage=Assets::TextureType::BaseColor)
 Gets or creates a stable handle for an authored 2D texture source path.
bool isValid (Assets::Texture2DHandle handle) const
 Checks whether a texture handle refers to a live slot in this store.
const std::filesystem::path * sourcePath (Assets::Texture2DHandle handle) const
 Returns the authored source path for a texture handle.
Assets::TextureHandle legacyHandle (Assets::Texture2DHandle handle) const
 Returns the legacy runtime texture handle associated with a texture asset handle.
Assets::TextureType usage (Assets::Texture2DHandle handle) const
 Returns the semantic usage recorded for a texture handle.

Static Private Member Functions

static std::string keyFor (const std::filesystem::path &source, Assets::TextureType usage)
 Builds the deduplication key for a texture source path and usage.

Private Attributes

AssetManager * assetManager_ = nullptr
 Optional bridge used to reserve legacy texture handles.
std::vector< Record > records_
 Slot storage indexed by Texture2DHandle::index.
std::unordered_map< std::string, uint32_t > sourceToIndex_
 Deduplication map from keyFor() to slot index.

Detailed Description

Registry store for authored sampled 2D texture handles.

Texture2DStore maps source paths to stable Texture2DHandle values and records the requested texture usage plus the legacy runtime texture handle used by renderer descriptor lookup.

Definition at line 233 of file AssetRegistry.h.

Constructor & Destructor Documentation

◆ Texture2DStore()

Engine::Core::Texture2DStore::Texture2DStore ( AssetManager * assetManager = nullptr)
explicit

Creates a 2D texture store backed by an optional asset manager.

Parameters
assetManagerAsset manager used to reserve legacy texture handles, or nullptr for handle-only use.

Member Function Documentation

◆ isValid()

bool Engine::Core::Texture2DStore::isValid ( Assets::Texture2DHandle handle) const
nodiscard

Checks whether a texture handle refers to a live slot in this store.

Parameters
handleHandle to validate.
Returns
True when the handle index and generation match a stored record.

◆ keyFor()

std::string Engine::Core::Texture2DStore::keyFor ( const std::filesystem::path & source,
Assets::TextureType usage )
staticnodiscardprivate

Builds the deduplication key for a texture source path and usage.

Parameters
sourceEngine-relative texture source path.
usageSemantic texture usage.
Returns
Stable string key used by sourceToIndex_.

References usage().

Here is the call graph for this function:

◆ legacyHandle()

Assets::TextureHandle Engine::Core::Texture2DStore::legacyHandle ( Assets::Texture2DHandle handle) const
nodiscard

Returns the legacy runtime texture handle associated with a texture asset handle.

Parameters
handleTexture asset handle to look up.
Returns
Runtime texture handle, or an invalid runtime handle when the asset handle is invalid.

◆ load()

Assets::Texture2DHandle Engine::Core::Texture2DStore::load ( const std::filesystem::path & source,
Assets::TextureType usage = Assets::TextureType::BaseColor )
nodiscard

Gets or creates a stable handle for an authored 2D texture source path.

Parameters
sourceEngine-relative texture source path.
usageSemantic texture usage requested for descriptor registration.
Returns
Existing or newly created texture handle, or a null handle for an empty source path.

References Engine::Assets::BaseColor, and usage().

Here is the call graph for this function:

◆ setAssetManager()

void Engine::Core::Texture2DStore::setAssetManager ( AssetManager * assetManager)

Sets the asset manager used when new texture handles reserve legacy runtime handles.

Parameters
assetManagerAsset manager to use, or nullptr to disable legacy handle reservation.

◆ sourcePath()

const std::filesystem::path * Engine::Core::Texture2DStore::sourcePath ( Assets::Texture2DHandle handle) const
nodiscard

Returns the authored source path for a texture handle.

Parameters
handleHandle to look up.
Returns
Pointer to the stored source path, or nullptr when the handle is invalid.

◆ usage()

Assets::TextureType Engine::Core::Texture2DStore::usage ( Assets::Texture2DHandle handle) const
nodiscard

Returns the semantic usage recorded for a texture handle.

Parameters
handleTexture handle to look up.
Returns
Recorded usage, or TextureType::Unknown when the handle is invalid.

Referenced by keyFor(), and load().

Here is the caller graph for this function:

Member Data Documentation

◆ assetManager_

AssetManager* Engine::Core::Texture2DStore::assetManager_ = nullptr
private

Optional bridge used to reserve legacy texture handles.

Definition at line 306 of file AssetRegistry.h.

◆ records_

std::vector<Record> Engine::Core::Texture2DStore::records_
private

Slot storage indexed by Texture2DHandle::index.

Definition at line 307 of file AssetRegistry.h.

◆ sourceToIndex_

std::unordered_map<std::string, uint32_t> Engine::Core::Texture2DStore::sourceToIndex_
private

Deduplication map from keyFor() to slot index.

Definition at line 308 of file AssetRegistry.h.


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Asset/AssetRegistry.h