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,
43 auto& resources = grid->get_buffer_resources();
45 foundry.update_descriptor_buffer(
47 resources.back_buffers[grid->front_index()].buffer, 0, grid->get_state_bytes());
49 foundry.update_descriptor_buffer(
51 grid->get_buffer(), 0, grid->get_size_bytes());
63 const std::shared_ptr<VKBuffer>&
buffer)
65 return std::dynamic_pointer_cast<RelaxationGridBuffer>(
buffer) !=
nullptr;
std::shared_ptr< NetworkGeometryBuffer > buffer
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_descriptors_created() override
Write the cell_state and vertices descriptors when the descriptor set is created or rebuilt.
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Cover the grid with a 1D dispatch and write EmitParams.
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.
void write_state_descriptors(const std::shared_ptr< RelaxationGridBuffer > &grid)
Point cell_state at the grid's front generation and vertices at the grid's own vertex storage.
bool on_before_execute(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override
Accept only a RelaxationGridBuffer.
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.
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.