|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
VKBuffer subclass that owns a MeshData and manages its GPU upload. More...
#include <MeshBuffer.hpp>
Inheritance diagram for MayaFlux::Buffers::MeshBuffer:
Collaboration diagram for MayaFlux::Buffers::MeshBuffer:Public Member Functions | |
| std::optional< Kakshya::MeshAccess > | access () const |
| Produce a non-owning MeshAccess view over the internal MeshData. | |
| void | bind_diffuse_texture (std::shared_ptr< Core::VKImage > image, std::string_view binding_name="diffuseTex") |
| Bind a diffuse texture to the render processor, if present. | |
| void | clear_indices_dirty () noexcept |
| void | clear_vertices_dirty () noexcept |
| std::shared_ptr< Core::VKImage > | get_diffuse_texture () const noexcept |
| uint32_t | get_face_count () const noexcept |
| uint32_t | get_index_count () const noexcept |
| std::shared_ptr< MeshProcessor > | get_mesh_processor () const |
| std::shared_ptr< RenderProcessor > | get_render_processor () const override |
| Get a RenderProcessor suitable for rendering this buffer. | |
| const std::optional< Kakshya::RegionGroup > & | get_submeshes () const noexcept |
| uint32_t | get_vertex_count () const noexcept |
| const Kakshya::VertexLayout & | get_vertex_layout_ref () const noexcept |
| bool | has_diffuse_texture () const noexcept |
| bool | indices_dirty () const noexcept |
| MeshBuffer (Kakshya::MeshData data) | |
| Construct from an owning MeshData. | |
| void | set_index_data (std::span< const uint32_t > indices) |
| Replace index data entirely and mark indices dirty. | |
| void | set_mesh_data (Kakshya::MeshData data) |
| Replace both vertex and index data atomically and mark both dirty. | |
| void | set_vertex_data (std::span< const uint8_t > bytes) |
| Replace vertex bytes entirely and mark vertices dirty. | |
| void | setup_processors (ProcessingToken token) override |
| Create and attach MeshProcessor as the default processor. | |
| void | setup_rendering (const RenderConfig &config) |
| Attach a RenderProcessor targeting the given window. | |
| bool | vertices_dirty () const noexcept |
| ~MeshBuffer () override=default | |
Public Member Functions inherited from MayaFlux::Buffers::VKBuffer | |
| void | clear () override |
| Clear buffer contents. | |
| void | clear_pipeline_commands () |
| Clear all recorded commands (called after presentation) | |
| void | clear_vertex_layout () |
| Clear vertex layout. | |
| std::shared_ptr< Buffer > | clone_to (uint8_t dest_desc) override |
| Creates a clone of this buffer for a specific channel or usage enum. | |
| std::shared_ptr< VKBuffer > | clone_to (Usage usage) |
| Create a clone of this buffer with the same data and properties. | |
| void | enforce_default_processing (bool should_process) override |
| Controls whether the buffer should use default processing. | |
| void | force_internal_usage (bool internal) override |
| Set whether this buffer is for internal engine usage. | |
| std::vector< std::pair< size_t, size_t > > | get_and_clear_dirty_ranges () |
| Retrieve and clear all dirty ranges. | |
| std::vector< std::pair< size_t, size_t > > | get_and_clear_invalid_ranges () |
| Retrieve and clear all invalid ranges. | |
| vk::Buffer & | get_buffer () |
| Get VkBuffer handle (VK_NULL_HANDLE if not registered) | |
| const VKBufferResources & | get_buffer_resources () |
| Get all buffer resources at once. | |
| std::vector< Kakshya::DataVariant > | get_data () |
| Read buffer contents as Kakshya DataVariant. | |
| std::shared_ptr< Buffers::BufferProcessor > | get_default_processor () const override |
| Get the currently attached default processor. | |
| uint64_t | get_device_address () const |
| Get the Vulkan device address for this buffer (if applicable) | |
| const std::vector< Kakshya::DataDimension > & | get_dimensions () const |
| Get the inferred data dimensions for the buffer contents. | |
| EngineContext & | get_engine_context () |
| const EngineContext & | get_engine_context () const |
| vk::Format | get_format () const |
| Convert modality to a recommended VkFormat. | |
| vk::Buffer | get_index_buffer () const |
| Return the raw index buffer handle. | |
| size_t | get_index_buffer_size () const |
| Number of bytes in the index buffer. | |
| void * | get_mapped_ptr () const |
| Get mapped host pointer (nullptr if not host-visible or unmapped) | |
| vk::MemoryPropertyFlags | get_memory_properties () const |
| Get appropriate VkMemoryPropertyFlags for allocation based on Usage. | |
| Kakshya::DataModality | get_modality () const |
| Get the buffer's semantic modality. | |
| CommandBufferID | get_pipeline_command (RenderPipelineID pipeline_id) const |
| Get recorded command buffer for a pipeline. | |
| PipelineContext & | get_pipeline_context () |
| Access the pipeline context for custom metadata (non-const) | |
| const PipelineContext & | get_pipeline_context () const |
| Access the pipeline context for custom metadata (const) | |
| std::shared_ptr< Core::Window > | get_pipeline_window (RenderPipelineID id) const |
| Get the window associated with this buffer. | |
| std::shared_ptr< Buffers::BufferProcessingChain > | get_processing_chain () override |
| Access the buffer's processing chain. | |
| RenderConfig | get_render_config () const |
| Get the current render configuration. | |
| std::unordered_map< RenderPipelineID, std::shared_ptr< Core::Window > > | get_render_pipelines () const |
| Get all render pipelines associated with this buffer. | |
| size_t | get_size () const |
| Get current logical size in bytes. | |
| vk::DeviceSize | get_size_bytes () const |
| Usage | get_usage () const |
| Retrieve the declared usage intent. | |
| vk::BufferUsageFlags | get_usage_flags () const |
| Get appropriate VkBufferUsageFlags for creation based on Usage. | |
| std::optional< Kakshya::VertexLayout > | get_vertex_layout () const |
| Get vertex layout if set. | |
| bool | has_data_for_cycle () const override |
| Checks if the buffer has data for the current processing cycle. | |
| bool | has_index_buffer () const |
| True when an index buffer has been associated with this buffer. | |
| bool | has_render_pipeline () const |
| Check if this buffer has a rendering pipeline configured. | |
| bool | has_vertex_layout () const |
| Check if this buffer has vertex layout configured. | |
| bool | is_host_visible () const |
| Whether this VKBuffer should be host-visible. | |
| bool | is_initialized () const |
| Check whether Vulkan handles are present (buffer registered) | |
| bool | is_internal_only () const override |
| Check whether this buffer is for internal engine usage. | |
| bool | is_processing () const override |
| Query whether the buffer is currently being processed. | |
| bool | is_render_config_dirty () const |
| Check if config has changed since last frame. | |
| void | mark_dirty_range (size_t offset, size_t size) |
| Get device memory handle. | |
| void | mark_for_processing (bool has_data) override |
| Marks the buffer's data availability for the current processing cycle. | |
| void | mark_for_removal () override |
| Marks the buffer for removal from processing chains. | |
| void | mark_invalid_range (size_t offset, size_t size) |
| Mark a range as invalid (needs download) | |
| virtual void | mark_render_config_dirty (bool is_dirty=true) |
| Mark config as changed (processors will detect and react) | |
| bool | needs_default_processing () override |
| Checks if the buffer should undergo default processing. | |
| bool | needs_depth_attachment () const |
| Check if this buffer requires depth attachment for rendering. | |
| bool | needs_removal () const override |
| Checks if the buffer should be removed from processing chains. | |
| void | process_default () override |
| Run the buffer's default processor (if set and enabled) | |
| void | release_processing () override |
| Release previously acquired processing lock. | |
| void | resize (size_t new_size, bool preserve_data=false) |
| Resize buffer and recreate GPU resources if needed. | |
| void | set_buffer (vk::Buffer buffer) |
| Set VkBuffer handle after backend allocation. | |
| void | set_buffer_resources (const VKBufferResources &resources) |
| Set all buffer resources at once. | |
| void | set_data (const std::vector< Kakshya::DataVariant > &data) |
| Write data into the buffer. | |
| void | set_default_processor (const std::shared_ptr< BufferProcessor > &processor) override |
| Set the buffer's default processor. | |
| void | set_index_resources (vk::Buffer buf, vk::DeviceMemory mem, size_t size) |
| Store raw index buffer handles produced by the geometry upload path. | |
| void | set_mapped_ptr (void *ptr) |
| Set mapped host pointer (for host-visible allocations) | |
| void | set_memory (vk::DeviceMemory memory) |
| Set device memory handle after backend allocation. | |
| void | set_modality (Kakshya::DataModality modality) |
| Update the semantic modality and re-infer dimensions. | |
| void | set_needs_depth_attachment (bool needs) |
| Mark this buffer as requiring depth testing when rendered. | |
| void | set_pipeline_command (RenderPipelineID pipeline_id, CommandBufferID cmd_id) |
| Store recorded command buffer for a pipeline. | |
| void | set_pipeline_window (RenderPipelineID id, const std::shared_ptr< Core::Window > &window) |
| Associate this buffer with a window for rendering. | |
| void | set_processing_chain (const std::shared_ptr< BufferProcessingChain > &chain, bool force=false) override |
| Replace the buffer's processing chain. | |
| virtual void | set_render_config (const RenderConfig &config) |
| Update the render configuration and mark as dirty. | |
| void | set_vertex_layout (const Kakshya::VertexLayout &layout) |
| Set vertex layout for this buffer. | |
| bool | try_acquire_processing () override |
| Try to acquire processing lock for this buffer. | |
| VKBuffer ()=default | |
| VKBuffer (size_t size_bytes, Usage usage, Kakshya::DataModality modality) | |
| Construct an unregistered VKBuffer. | |
| ~VKBuffer () override | |
| Virtual destructor. | |
Public Member Functions inherited from MayaFlux::Buffers::Buffer | |
| virtual | ~Buffer ()=default |
| Virtual destructor for proper resource management. | |
Private Attributes | |
| std::string | m_diffuse_binding { "diffuseTex" } |
| std::shared_ptr< Core::VKImage > | m_diffuse_texture |
| std::atomic< bool > | m_indices_dirty { true } |
| Kakshya::MeshData | m_mesh_data |
| std::shared_ptr< MeshProcessor > | m_mesh_processor |
| std::shared_ptr< RenderProcessor > | m_render_processor |
| std::atomic< bool > | m_vertices_dirty { true } |
Friends | |
| class | MeshProcessor |
Additional Inherited Members | |
Public Types inherited from MayaFlux::Buffers::VKBuffer | |
| using | RenderConfig = Portal::Graphics::RenderConfig |
| enum class | Usage : uint8_t { STAGING , DEVICE , COMPUTE , VERTEX , INDEX , UNIFORM , UNIFORM_BDA , STORAGE_BDA } |
Protected Member Functions inherited from MayaFlux::Buffers::VKBuffer | |
| void | set_default_render_config (const RenderConfig &config) |
| Called by derived classes to set their context-specific defaults. | |
Protected Attributes inherited from MayaFlux::Buffers::VKBuffer | |
| RenderConfig | m_render_config |
| bool | m_render_config_dirty {} |
VKBuffer subclass that owns a MeshData and manages its GPU upload.
MeshBuffer is to indexed triangle geometry what TextureBuffer is to pixel data: it owns the CPU-side storage, creates a dedicated processor for GPU upload, and exposes setup_rendering() to attach a RenderProcessor.
The VKBuffer base manages the vertex Vulkan buffer (Usage::VERTEX). MeshProcessor allocates and owns a separate Usage::INDEX VKBuffer and links both into VKBufferResources via set_index_resources(), making the indexed draw path available to RenderProcessor transparently.
Two independent dirty flags govern re-upload:
Typical usage:
Deformation:
Definition at line 46 of file MeshBuffer.hpp.