|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Portal-level texture creation and management. More...
#include <TextureLoom.hpp>
Collaboration diagram for MayaFlux::Portal::Graphics::TextureLoom:Public Member Functions | |
| TextureLoom (const TextureLoom &)=delete | |
| TextureLoom & | operator= (const TextureLoom &)=delete |
| TextureLoom (TextureLoom &&) noexcept=default | |
| TextureLoom & | operator= (TextureLoom &&) noexcept=default |
| bool | initialize (const std::shared_ptr< Core::VulkanBackend > &backend) |
| Initialize texture manager. | |
| void | shutdown () |
| Shutdown and cleanup all textures. | |
| bool | is_initialized () const |
| Check if manager is initialized. | |
| std::shared_ptr< Core::VKImage > | create_2d (uint32_t width, uint32_t height, ImageFormat format=ImageFormat::RGBA8, const void *data=nullptr, uint32_t mip_levels=1) |
| Create a 2D texture. | |
| std::shared_ptr< Core::VKImage > | create_3d (uint32_t width, uint32_t height, uint32_t depth, ImageFormat format=ImageFormat::RGBA8, const void *data=nullptr) |
| Create a 3D texture (volumetric) | |
| std::shared_ptr< Core::VKImage > | create_cubemap (uint32_t size, ImageFormat format=ImageFormat::RGBA8, const void *data=nullptr) |
| Create a cubemap texture. | |
| std::shared_ptr< Core::VKImage > | create_render_target (uint32_t width, uint32_t height, ImageFormat format=ImageFormat::RGBA8) |
| Create a render target (color attachment) | |
| std::shared_ptr< Core::VKImage > | create_depth_buffer (uint32_t width, uint32_t height, bool with_stencil=false) |
| Create a depth buffer. | |
| std::shared_ptr< Core::VKImage > | create_storage_image (uint32_t width, uint32_t height, ImageFormat format=ImageFormat::RGBA8) |
| Create a storage image (compute shader read/write) | |
| void | upload_data (const std::shared_ptr< Core::VKImage > &image, const void *data, size_t size) |
| Upload pixel data to an existing texture. | |
| void | download_data (const std::shared_ptr< Core::VKImage > &image, void *data, size_t size) |
| Download pixel data from a texture. | |
| vk::Sampler | get_or_create_sampler (const SamplerConfig &config) |
| Get or create a sampler with the given configuration. | |
| vk::Sampler | get_default_sampler () |
| Get a default linear sampler (for convenience) | |
| vk::Sampler | get_nearest_sampler () |
| Get a default nearest sampler (for pixel-perfect sampling) | |
Static Public Member Functions | |
| static TextureLoom & | instance () |
| static vk::Format | to_vulkan_format (ImageFormat format) |
| Convert Portal ImageFormat to Vulkan format. | |
| static size_t | get_bytes_per_pixel (ImageFormat format) |
| Get bytes per pixel for a format. | |
| static size_t | calculate_image_size (uint32_t width, uint32_t height, uint32_t depth, ImageFormat format) |
| Calculate image data size. | |
Private Member Functions | |
| TextureLoom ()=default | |
| ~TextureLoom () | |
| vk::Sampler | create_sampler (const SamplerConfig &config) |
Static Private Member Functions | |
| static size_t | hash_sampler_config (const SamplerConfig &config) |
Private Attributes | |
| std::shared_ptr< Core::VulkanBackend > | m_backend |
| Core::BackendResourceManager * | m_resource_manager = nullptr |
| std::vector< std::shared_ptr< Core::VKImage > > | m_textures |
| std::unordered_map< size_t, vk::Sampler > | m_sampler_cache |
Static Private Attributes | |
| static bool | s_initialized = false |
Portal-level texture creation and management.
TextureLoom is the primary Portal::Graphics class for creating and managing GPU textures. It bridges between user-friendly Portal API and backend VKImage resources via BufferService registry.
Key Responsibilities:
Design Philosophy:
Usage: auto& mgr = Portal::Graphics::TextureLoom::instance();
// Create basic texture auto texture = mgr.create_2d(512, 512, ImageFormat::RGBA8);
// Create with data std::vector<uint8_t> pixels = {...}; auto texture = mgr.create_2d(512, 512, ImageFormat::RGBA8, pixels.data());
// Create render target auto target = mgr.create_render_target(1920, 1080);
// Get sampler SamplerConfig config; config.mag_filter = FilterMode::LINEAR; auto sampler = mgr.get_or_create_sampler(config);
Definition at line 68 of file TextureLoom.hpp.