|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
ComputeProcessor that dispatches mc_emit.comp directly into the owning VKBuffer (Usage::VERTEX), bypassing all CPU readback. More...
#include <SDFMeshProcessor.hpp>
Inheritance diagram for MayaFlux::Buffers::SDFMeshProcessor:
Collaboration diagram for MayaFlux::Buffers::SDFMeshProcessor:Classes | |
| struct | McPC |
Public Member Functions | |
| bool | is_dirty () const |
| SDFMeshProcessor (Kinesis::SpatialField field, const glm::vec3 &bounds_min, const glm::vec3 &bounds_max, uint32_t res_x, uint32_t res_y, uint32_t res_z, float iso_level) | |
| SDFMeshProcessor (std::shared_ptr< VKBuffer > grid_buf, std::shared_ptr< VKBuffer > counter_buf, const glm::vec3 &bounds_min, const glm::vec3 &bounds_max, uint32_t res_x, uint32_t res_y, uint32_t res_z, float iso_level) | |
| Construct in GPU-field mode with externally owned buffers. | |
| void | set_bounds (const glm::vec3 &bounds_min, const glm::vec3 &bounds_max) |
| Replace the evaluation volume and mark dirty. | |
| void | set_dirty () |
| Force a re-dispatch on the next frame. | |
| void | set_field (Kinesis::SpatialField field) |
| Replace the scalar field and mark dirty. | |
| void | set_iso_level (float iso_level) |
| Replace the iso_level threshold and mark dirty. | |
| void | set_resolution (uint32_t res_x, uint32_t res_y, uint32_t res_z) |
| Replace the grid resolution and mark dirty. | |
| ~SDFMeshProcessor () override=default | |
Public Member Functions inherited from MayaFlux::Buffers::ComputeProcessor | |
| ComputeProcessor (const std::string &shader_path, uint32_t workgroup_x=256) | |
| Construct processor with shader path. | |
| const ShaderDispatchConfig & | get_dispatch_config () const |
| Get current dispatch configuration. | |
| bool | is_pipeline_ready () const |
| Check if pipeline is created. | |
| void | set_custom_dispatch (std::function< std::array< uint32_t, 3 >(const std::shared_ptr< VKBuffer > &)> calculator) |
| Set custom dispatch calculator. | |
| void | set_dispatch_mode (ShaderDispatchConfig::DispatchMode mode) |
| Set dispatch mode. | |
| void | set_manual_dispatch (uint32_t x, uint32_t y=1, uint32_t z=1) |
| Set manual dispatch group counts. | |
| void | set_workgroup_size (uint32_t x, uint32_t y=1, uint32_t z=1) |
| Set workgroup size (should match shader local_size) | |
Public Member Functions inherited from MayaFlux::Buffers::ShaderProcessor | |
| void | add_binding (const std::string &descriptor_name, const ShaderBinding &binding) |
| Add descriptor binding configuration. | |
| bool | are_bindings_complete () const |
| Check if all required bindings are satisfied. | |
| bool | are_descriptors_ready () const |
| Check if descriptors are initialized. | |
| void | auto_bind_buffer (const std::shared_ptr< VKBuffer > &buffer) |
| Auto-bind buffer based on attachment order. | |
| void | bind_buffer (const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer) |
| Bind a VKBuffer to a named shader descriptor. | |
| void | clear_specialization_constants () |
| Clear all specialization constants. | |
| std::vector< std::string > | get_binding_names () const |
| Get all configured descriptor names. | |
| std::shared_ptr< VKBuffer > | get_bound_buffer (const std::string &descriptor_name) const |
| Get bound buffer for a descriptor name. | |
| size_t | get_bound_buffer_count () const |
| Get number of bound buffers. | |
| virtual BufferUsageHint | get_buffer_usage_hint (const std::string &descriptor_name) const |
| Get buffer usage hint for a descriptor. | |
| const ShaderConfig & | get_config () const |
| Get current configuration. | |
| virtual std::shared_ptr< VKBuffer > | get_output_buffer () const |
| Get the output buffer after compute dispatch. | |
| std::vector< uint8_t > & | get_push_constant_data () |
| const std::vector< uint8_t > & | get_push_constant_data () const |
| Get current push constant data. | |
| const std::string & | get_shader_path () const |
| Get current shader path. | |
| bool | has_binding (const std::string &descriptor_name) const |
| Check if a descriptor binding exists. | |
| virtual bool | has_executed () const |
| Check if compute has been executed at least once. | |
| bool | hot_reload_shader () |
| Hot-reload shader from ShaderFoundry. | |
| bool | is_compatible_with (const std::shared_ptr< Buffer > &buffer) const override |
| Checks if this processor can handle the specified buffer type. | |
| virtual bool | is_in_place_operation (const std::string &descriptor_name) const |
| Check if shader modifies a specific buffer in-place. | |
| bool | is_shader_loaded () const |
| Check if shader is loaded. | |
| void | on_attach (const std::shared_ptr< Buffer > &buffer) override |
| Called when this processor is attached to a buffer. | |
| void | on_detach (const std::shared_ptr< Buffer > &buffer) override |
| Called when this processor is detached from a buffer. | |
| void | processing_function (const std::shared_ptr< Buffer > &buffer) override |
| The core processing function that must be implemented by derived classes. | |
| void | set_config (const ShaderConfig &config) |
| Update entire configuration. | |
| template<typename T > | |
| void | set_push_constant_data (const T &data) |
| Update push constant data (type-safe) | |
| virtual void | set_push_constant_data_raw (const void *data, size_t size) |
| Update push constant data (raw bytes) | |
| template<typename T > | |
| void | set_push_constant_size () |
| Set push constant size from type. | |
| void | set_push_constant_size (size_t size) |
| Set push constant size. | |
| void | set_shader (const std::string &shader_path) |
| Update shader path and reload. | |
| void | set_specialization_constant (uint32_t constant_id, uint32_t value) |
| Set specialization constant. | |
| ShaderProcessor (const std::string &shader_path) | |
| Construct processor with shader path. | |
| ShaderProcessor (ShaderConfig config) | |
| Construct processor with full configuration. | |
| void | unbind_buffer (const std::string &descriptor_name) |
| Unbind a buffer from a descriptor. | |
| ~ShaderProcessor () override | |
Public Member Functions inherited from MayaFlux::Buffers::BufferProcessor | |
| virtual ProcessingToken | get_processing_token () const |
| Gets the current processing token for this buffer. | |
| void | process (const std::shared_ptr< Buffer > &buffer) |
| Applies a computational transformation to the data in the provided buffer. | |
| virtual void | set_processing_token (ProcessingToken token) |
| Gets the preferred processing backend for this processor. | |
| virtual | ~BufferProcessor ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
Protected Member Functions | |
| void | on_after_execute (Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override |
| Called after each process callback. | |
| void | on_attach (const std::shared_ptr< Buffer > &buffer) override |
| Called when this processor is attached to a buffer. | |
| bool | on_before_execute (Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override |
| Called before each process callback. | |
| void | on_descriptors_created () override |
| Called after descriptor sets are created. | |
Protected Member Functions inherited from MayaFlux::Buffers::ComputeProcessor | |
| virtual std::array< uint32_t, 3 > | calculate_dispatch_size (const std::shared_ptr< VKBuffer > &buffer) |
| Calculate dispatch size from buffer. | |
| void | cleanup () override |
| void | initialize_descriptors (const std::shared_ptr< VKBuffer > &buffer) override |
| void | initialize_pipeline (const std::shared_ptr< VKBuffer > &buffer) override |
Protected Member Functions inherited from MayaFlux::Buffers::ShaderProcessor | |
| virtual void | on_before_compile (const std::string &shader_path) |
| Called before shader compilation. | |
| virtual void | on_before_descriptors_create () |
| Called before descriptor sets are created. | |
| virtual void | on_before_pipeline_create (Portal::Graphics::ComputePipelineID pipeline_id) |
| Called before pipeline creation. | |
| virtual void | on_pipeline_created (Portal::Graphics::ComputePipelineID pipeline_id) |
| Called after pipeline is created. | |
| virtual void | on_shader_loaded (Portal::Graphics::ShaderID shader_id) |
| Called after shader is loaded. | |
| std::optional< uint32_t > | resolve_ds_index (uint32_t set) const |
| Resolve logical descriptor set index to actual index. | |
| virtual void | update_descriptors (const std::shared_ptr< VKBuffer > &buffer) |
Protected Member Functions inherited from MayaFlux::Buffers::VKBufferProcessor | |
| void | ensure_initialized (const std::shared_ptr< VKBuffer > &buffer) |
| void | initialize_buffer_service () |
| void | initialize_compute_service () |
Private Member Functions | |
| uint32_t | corner_count () const noexcept |
| void | evaluate_grid () |
| void | rebuild_lookup_buffers () |
| void | rebuild_owned_buffers () |
| uint32_t | voxel_count () const noexcept |
| uint32_t | worst_case_vertices () const noexcept |
Private Attributes | |
| glm::vec3 | m_bounds_max |
| glm::vec3 | m_bounds_min |
| std::shared_ptr< VKBuffer > | m_counter_buf |
| bool | m_dirty { true } |
| std::shared_ptr< VKBuffer > | m_edge_buf |
| Kinesis::SpatialField | m_field |
| std::shared_ptr< VKBuffer > | m_grid_buf |
| float | m_iso_level |
| bool | m_owns_buffers { true } |
| false in GPU-field mode; buffers owned by SdfPrepProcessor. | |
| uint32_t | m_res_x |
| uint32_t | m_res_y |
| uint32_t | m_res_z |
| std::shared_ptr< VKBuffer > | m_tri_buf |
ComputeProcessor that dispatches mc_emit.comp directly into the owning VKBuffer (Usage::VERTEX), bypassing all CPU readback.
Binding layout (matches mc_emit.comp): set=0, binding=0 SDF corner grid STORAGE (host-visible, written each dirty frame) set=0, binding=1 Edge table STORAGE (uploaded once at init) set=0, binding=2 Tri table STORAGE (uploaded once at init) set=0, binding=3 Vertex output STORAGE (the VKBuffer this processor is attached to) set=0, binding=4 Atomic vertex counter STORAGE (host-visible, read back after dispatch)
The SDF grid is evaluated on CPU via a parallel for_each into the grid buffer's mapped pointer each dirty frame. No staging or upload call is needed: the buffer is eHostVisible | eHostCoherent.
After dispatch, the counter buffer's mapped pointer is read to obtain the actual vertex count, which is forwarded to the owner via the callback supplied at construction.
Dirtiness is managed by the owner. on_before_execute returns false when not dirty, suppressing dispatch for that frame.
Definition at line 32 of file SDFMeshProcessor.hpp.