7 const std::string& divergence_field,
const std::string& pressure_field)
10 { .name =
"divergence_in", .binding = 0, .field = divergence_field, .access =
FieldAccess::READ },
11 { .name =
"pressure_a", .binding = 1, .field = pressure_field, .access =
FieldAccess::READ },
12 { .name =
"pressure_b", .binding = 2, .field = pressure_field, .access =
FieldAccess::WRITE },
17 std::string divergence_field,
18 std::string pressure_field,
19 const std::string& shader_path,
22 , m_divergence_field(
std::move(divergence_field))
23 , m_pressure_field(
std::move(pressure_field))
30 std::string divergence_field,
31 std::string pressure_field,
35 , m_divergence_field(
std::move(divergence_field))
36 , m_pressure_field(
std::move(pressure_field))
49 const std::shared_ptr<VKBuffer>& ,
58 const std::shared_ptr<VKBuffer>& ,
68 const auto src = vk::AccessFlagBits::eShaderWrite;
69 const auto dst = vk::AccessFlagBits::eShaderRead | vk::AccessFlagBits::eShaderWrite;
70 const auto stage = vk::PipelineStageFlagBits::eComputeShader;
72 foundry.buffer_barrier(cmd_id, volume->read_handle(
m_pressure_field), src, dst, stage, stage);
73 foundry.buffer_barrier(cmd_id, volume->write_handle(
m_pressure_field), src, dst, stage, stage);
void set_iteration_count(uint32_t count)
Set how many dispatches are recorded per execute cycle.
uint32_t get_iteration_count() const
Dispatches recorded per execute cycle.
bool on_iteration(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer, uint32_t index) override
Write this pass's read/write parity into the parameter block.
bool wants_swap() const override
Swap only when the pass count leaves the result in the write slot.
std::string m_pressure_field
PressureProcessor(std::string divergence_field, std::string pressure_field, const std::string &shader_path, uint32_t iterations=40)
Construct a pressure solve stage.
void on_iteration_barrier(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer, uint32_t index) override
Barrier both pressure slots between consecutive passes.
static std::vector< FieldBinding > make_bindings(const std::string &divergence_field, const std::string &pressure_field)
Build the binding table for the two field names.
void write_lattice_word3(uint32_t value)
Write word three of the shared prefix.
@ READ
Resolves to VolumeGridBuffer::read_handle.
@ WRITE
Resolves to VolumeGridBuffer::write_handle.
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.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
Complete declarative description of a generated compute shader.