MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
RelaxationSpecs.hpp
Go to the documentation of this file.
1#pragma once
2
4
6
11
12/**
13 * @brief Jacobi-style diffusion rule: each cell blends toward the average
14 * of its 8 Moore neighbors.
15 *
16 * Built on KernelTemplate::Stencil with KernelOp::WeightedBlend. PC layout
17 * is width, height, rate, neighbor_scale. Supply rate and neighbor_scale
18 * through GridConfig::Stage::constants in that order. A neighbor_scale of
19 * 1/8 produces a true average over the eight Moore neighbors.
20 */
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)
30 .pc("neighbor_scale", Kakshya::GpuDataFormat::FLOAT32)
31 .op(KernelOp::WeightedBlend)
32 .workgroup(16, 16)
33 .build();
34 return spec;
35}
36
37} // namespace MayaFlux::Buffers::RelaxationSpecs
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.
Portal::Graphics::ShaderSpec jacobi_diffusion()
Jacobi-style diffusion rule: each cell blends toward the average of its 8 Moore neighbors.
@ FLOAT32
32-bit float (standard GPU)
KernelTemplate
Structural shape of the generated compute kernel.
BindingDirection
Data flow direction for a shader binding slot.
KernelOp
Named operation the SPIR-V emitter knows how to lower to opcodes.
Complete declarative description of a generated compute shader.