23 auto grid = std::dynamic_pointer_cast<RelaxationGridBuffer>(buffer);
26 constexpr uint32_t k_workgroup_size = 256;
30 (grid->get_cell_count() + k_workgroup_size - 1) / k_workgroup_size,
38 const std::shared_ptr<VKBuffer>& buffer)
50 auto& resources = grid->get_buffer_resources();
52 foundry.update_descriptor_buffer(
54 resources.back_buffers[grid->front_index()].buffer, 0, grid->get_state_bytes());
56 foundry.update_descriptor_buffer(
58 buffer->get_buffer(), 0, buffer->get_size_bytes());
65 auto grid = std::dynamic_pointer_cast<RelaxationGridBuffer>(buffer);
68 auto& resources = grid->get_buffer_resources();
70 foundry.update_descriptor_buffer(
72 resources.back_buffers[grid->front_index()].buffer, 0, grid->get_state_bytes());
74 foundry.update_descriptor_buffer(
76 grid->get_buffer(), 0, grid->get_size_bytes());
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_workgroup_size(uint32_t x, uint32_t y=1, uint32_t z=1)
Set workgroup size (should match shader local_size)
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.
void set_extent(float extent)
Set the NDC half-span the grid occupies.
void processing_function(const std::shared_ptr< Buffer > &buffer) override
Write the cell_state and vertices descriptors for the grid's current front generation,...
void on_attach(const std::shared_ptr< Buffer > &buffer) override
When attached to a RelaxationGridBuffer, sets up the dispatch configuration to cover the entire grid ...
void set_point_size(float size)
Set the per-point size written to the vertex scalar field.
void write_emit_constants()
Size the push constant block to EmitParams and upload the current parameters.
bool on_before_execute(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override
Write the cell_state and vertices descriptor bindings for this cycle's dispatch.
std::shared_ptr< RelaxationGridBuffer > m_grid
RelaxationEmitProcessor(const std::string &shader_path, uint32_t workgroup_x=16)
Construct an emit processor for the given shader file.
GPU-resident, double-buffered SSBO state for synchronous local-rule systems evaluated over a fixed 2D...
const std::vector< uint8_t > & get_push_constant_data() const
Get current push constant data.
void set_push_constant_size()
Set push constant size from type.
bool are_descriptors_ready() const
Check if descriptors are initialized.
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
Push constant block for the packed-vertex emit shader.
Describes how a VKBuffer binds to a shader descriptor.
std::unordered_map< std::string, ShaderBinding > bindings
@ MANUAL
Use explicit group counts.
Complete declarative description of a generated compute shader.