10 constexpr uint32_t k_workgroup_x = 64;
14 std::shared_ptr<VolumeGridBuffer> volume,
15 std::string field_name,
18 const std::string& shader_path)
20 , m_volume(
std::move(volume))
21 , m_field_name(
std::move(field_name))
22 , m_lattice(
std::move(lattice))
43 VKBuffer::Usage::HOST_STORAGE,
115 const std::shared_ptr<VKBuffer>& )
virtual void on_attach(const std::shared_ptr< Buffer > &)
Called when this processor is attached to a buffer.
virtual void processing_function(const std::shared_ptr< Buffer > &buffer)=0
The core processing function that must be implemented by derived classes.
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.
Specialized ShaderProcessor for Compute Pipelines.
const std::vector< uint8_t > & get_push_constant_data() const
Get current push constant data.
bool are_descriptors_ready() const
Check if descriptors are initialized.
void bind_buffer(const std::string &descriptor_name, const std::shared_ptr< VKBuffer > &buffer)
Bind a VKBuffer to a named shader descriptor.
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
void write_field_descriptor()
Issue the direct ShaderFoundry descriptor write for the field read slot.
void set_threshold(float threshold)
Set the field value the surface is placed at.
Kinesis::Lattice3D m_lattice
void rebuild_grid_buffer()
Allocate the corner grid buffer for the current resolution.
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Validate the named field, bind the grid, and size the dispatch.
std::shared_ptr< VolumeGridBuffer > m_volume
The attached volume, cached for the descriptor write.
void on_descriptors_created() override
Write the field descriptor for the current slot assignment.
std::shared_ptr< VKBuffer > m_grid_buf
VolumeSurfaceProcessor(std::shared_ptr< VolumeGridBuffer > volume, std::string field_name, Kinesis::Lattice3D lattice, float threshold, const std::string &shader_path="volume_to_sdf_grid.comp.spv")
Construct a surface extraction bridge.
void processing_function(const std::shared_ptr< Buffer > &buffer) override
Write the field descriptor for this cycle's slot assignment, then run the normal shader processing pa...
void write_params()
Size the push constant block to at least SurfaceParams and write the lattice dimensions,...
uint32_t corner_count() const noexcept
Corner count of the grid, one greater per axis than the extraction resolution.
bool on_before_execute(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override
Reject buffers that are not VolumeGridBuffer.
void update_descriptor_buffer(DescriptorSetID descriptor_set_id, uint32_t binding, vk::DescriptorType type, vk::Buffer buffer, size_t offset, size_t size)
Update descriptor set with buffer binding.
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ UNKNOWN
Unknown or undefined modality.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
Describes how a VKBuffer binds to a shader descriptor.
std::unordered_map< std::string, ShaderBinding > bindings
size_t push_constant_size
@ MANUAL
Use explicit group counts.
Push constant block the resample shader receives.
glm::uvec3 resolution
Cell count per axis. Zero on any axis is invalid.
A regular subdivision of an AABB3D into a cell count per axis.
Backend buffer management service interface.