6 constexpr size_t k_dissipation_offset = 32;
7 constexpr size_t k_param_size = 48;
11 const std::string& velocity_field,
const std::string& carried_field)
14 { .name =
"velocity_in", .binding = 0, .field = velocity_field, .access =
FieldAccess::READ },
15 { .name =
"carried_in", .binding = 1, .field = carried_field, .access =
FieldAccess::READ },
16 { .name =
"carried_out", .binding = 2, .field = carried_field, .access =
FieldAccess::WRITE },
21 std::string velocity_field,
22 std::string carried_field,
23 const std::string& shader_path)
25 , m_velocity_field(
std::move(velocity_field))
26 , m_carried_field(
std::move(carried_field))
32 std::string velocity_field,
33 std::string carried_field,
36 , m_velocity_field(
std::move(velocity_field))
37 , m_carried_field(
std::move(carried_field))
AdvectProcessor(std::string velocity_field, std::string carried_field, const std::string &shader_path)
Construct an advection stage.
void on_volume_ready() override
Reserve the full parameter block and write the step and dissipation words.
void write_tail()
Write time step and dissipation past the shared prefix.
static std::vector< FieldBinding > make_bindings(const std::string &velocity_field, const std::string &carried_field)
Build the binding table for the two field names.
void set_time_step(float dt)
Set the integration step passed to the shader each cycle.
std::string m_carried_field
void set_dissipation(float dissipation)
Set the multiplicative decay applied to the carried value.
void write_param_tail(size_t offset, const void *data, size_t size)
Write subclass parameters past the shared prefix.
void reserve_param_size(size_t size)
Raise the push constant block to at least this size.
void write_lattice_word7(float value)
Write word seven of the parameter prefix, at byte offset 28.
@ READ
Resolves to VolumeGridBuffer::read_handle.
@ WRITE
Resolves to VolumeGridBuffer::write_handle.
void write_lattice_params()
Write the lattice dimensions and cell size into the staged push constant block, preserving word three...
const std::shared_ptr< VolumeGridBuffer > & get_volume() const
The attached volume, or null if attachment failed validation.
void add_swap_field(std::string field)
Register a field to swap after each dispatch.
ComputeProcessor operating on named fields of a VolumeGridBuffer.
Complete declarative description of a generated compute shader.