Kanzi 4.1.0
kanzi::BindlessTextureRegistry Class Reference

#include <kanzi/core.ui/graphics3d/bindless_texture_registry.hpp>

Public Member Functions

const VectorMap< string, gfx::ResourceSetCreateInfo::ImageView > & getImageViews2D () const
 Returns the image views for all registered 2D textures, keyed by texture name.
 
const VectorMap< string, gfx::ResourceSetCreateInfo::Sampler > & getSamplers2D () const
 Returns the samplers for all registered 2D textures, keyed by texture name.
 
uint32_t getTextureIndex (const TextureSharedPtr &texture) const
 Returns the current index of a registered texture in the bindless array.
 
uint32_t registerTexture (Domain *domain, const TextureSharedPtr &texture)
 Registers a texture in the bindless array.
 
void unregisterTexture (const TextureSharedPtr &texture)
 Decrements the reference count for a texture and removes it from the bindless array when the count reaches zero.
 

Static Public Member Functions

static bool createTextureView (Domain *domain, TextureWeakPtr texturePtr, TextureType textureType, gfx::ResourceSetCreateInfo::ImageView &outImageView, gfx::ResourceSetCreateInfo::Sampler &outSampler)
 Creates image and sampler view.
 

Static Public Attributes

static constexpr uint32_t invalidIndex
 Sentinel value returned when a resource index is not valid.
 

Detailed Description

Since
Kanzi 4.1.0
Attention
This feature is experimental and is likely to change in future releases.

Member Function Documentation

◆ registerTexture()

uint32_t kanzi::BindlessTextureRegistry::registerTexture ( Domain * domain,
const TextureSharedPtr & texture )

Registers a texture in the bindless array.

Creates the image view and sampler if not yet present. Reference-counted: multiple registrations of the same texture are safe.

Parameters
domainDomain used to create GPU resources.
textureTexture to register.
Returns
Index into the bindless array for the texture type, or invalidIndex if texture is null.

◆ unregisterTexture()

void kanzi::BindlessTextureRegistry::unregisterTexture ( const TextureSharedPtr & texture)

Decrements the reference count for a texture and removes it from the bindless array when the count reaches zero.

No-op if the texture was never registered.

Parameters
textureTexture to unregister.

◆ getTextureIndex()

uint32_t kanzi::BindlessTextureRegistry::getTextureIndex ( const TextureSharedPtr & texture) const

Returns the current index of a registered texture in the bindless array.

Parameters
textureTexture to look up.
Returns
Index into the bindless array for the texture type, or invalidIndex if not registered or null.

◆ getImageViews2D()

const VectorMap< string, gfx::ResourceSetCreateInfo::ImageView > & kanzi::BindlessTextureRegistry::getImageViews2D ( ) const
inline

Returns the image views for all registered 2D textures, keyed by texture name.

◆ getSamplers2D()

const VectorMap< string, gfx::ResourceSetCreateInfo::Sampler > & kanzi::BindlessTextureRegistry::getSamplers2D ( ) const
inline

Returns the samplers for all registered 2D textures, keyed by texture name.

◆ createTextureView()

static bool kanzi::BindlessTextureRegistry::createTextureView ( Domain * domain,
TextureWeakPtr texturePtr,
TextureType textureType,
gfx::ResourceSetCreateInfo::ImageView & outImageView,
gfx::ResourceSetCreateInfo::Sampler & outSampler )
static

Creates image and sampler view.

Parameters
domainThe domain, used to access the renderer sampler cache and default textures.
texturePtrWeak pointer to the texture to resolve.
textureTypeTexture type used to select the appropriate default texture on fallback.
outImageViewOutput image view populated with the resolved image handle and mip level range.
outSamplerOutput sampler populated with the resolved sampler handle.
Returns
True if the texture was resolved successfully, false if the default texture fallback was used.

Member Data Documentation

◆ invalidIndex

constexpr uint32_t kanzi::BindlessTextureRegistry::invalidIndex
staticconstexpr

Sentinel value returned when a resource index is not valid.


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