MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ jacobi_diffusion()

Portal::Graphics::ShaderSpec MayaFlux::Buffers::RelaxationSpecs::jacobi_diffusion ( )
inline

Jacobi-style diffusion rule: each cell blends toward the average of its 8 Moore neighbors.

Built on KernelTemplate::Stencil with KernelOp::WeightedBlend. PC layout is width, height, rate, neighbor_scale. Supply rate and neighbor_scale through GridConfig::Stage::constants in that order. A neighbor_scale of 1/8 produces a true average over the eight Moore neighbors.

Definition at line 21 of file RelaxationSpecs.hpp.

22{
23 auto spec = ShaderSpec::Assemble {}
24 .tmpl(KernelTemplate::Stencil)
25 .ssbo("state_in", BindingDirection::Input, Kakshya::GpuDataFormat::FLOAT32)
26 .ssbo("state_out", BindingDirection::Output, Kakshya::GpuDataFormat::FLOAT32)
27 .pc("width", Kakshya::GpuDataFormat::UINT32)
28 .pc("height", Kakshya::GpuDataFormat::UINT32)
29 .pc("rate", Kakshya::GpuDataFormat::FLOAT32)
30 .pc("neighbor_scale", Kakshya::GpuDataFormat::FLOAT32)
31 .op(KernelOp::WeightedBlend)
32 .workgroup(16, 16)
33 .build();
34 return spec;
35}
Assemble & op(KernelOp o)
Set the named operation the emitter will lower to SPIR-V.
ShaderSpec build()
Finalise and return the ShaderSpec.
Assemble & pc(std::string name, Kakshya::GpuDataFormat format)
Declare a push constant field with explicit format.
Assemble & ssbo(std::string name, BindingDirection direction, Kakshya::GpuDataFormat format, Kakshya::DataModality modality=Kakshya::DataModality::SCALAR_F32)
Declare an SSBO binding.
Assemble & workgroup(uint32_t x, uint32_t y=1, uint32_t z=1)
Override workgroup size.
Assemble & tmpl(KernelTemplate t)
Set the kernel template.
Fluent assembler producing a ShaderSpec.

References MayaFlux::Portal::Graphics::ShaderSpec::Assemble::build(), MayaFlux::Kakshya::FLOAT32, MayaFlux::Portal::Graphics::ShaderSpec::Assemble::op(), MayaFlux::Portal::Graphics::ShaderSpec::Assemble::pc(), MayaFlux::Portal::Graphics::ShaderSpec::Assemble::ssbo(), MayaFlux::Portal::Graphics::ShaderSpec::Assemble::tmpl(), MayaFlux::Kakshya::UINT32, and MayaFlux::Portal::Graphics::ShaderSpec::Assemble::workgroup().

+ Here is the call graph for this function: