MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Portal::Graphics::KernelSource Struct Reference

Parsed representation of a user-supplied kernel lambda. More...

#include <ShaderSpec.hpp>

+ Collaboration diagram for MayaFlux::Portal::Graphics::KernelSource:

Static Public Member Functions

static KernelSource parse (std::string_view stringified)
 Parse parameter names and body from a stringified lambda.
 

Public Attributes

std::string body
 
std::vector< std::string > param_names
 
std::string raw
 

Detailed Description

Parsed representation of a user-supplied kernel lambda.

Produced by the MF_KERNEL macro, which stringifies the lambda text at the call site. The parameter names must match binding and push constant field names declared on the enclosing ShaderSpec in declaration order: SSBO bindings first, then PC fields, then optionally a uint32_t index parameter named i.

The body is extracted verbatim between the outermost braces and injected into the generated GLSL compute shader by the emitter.

auto spec = ShaderSpec::Assemble{}
.pc("gain")
.kernel(MF_KERNEL([](float* sig, float gain, uint32_t i) {
sig[i] = sig[i] * gain + sin(float(i) * 0.01f);
}))
.build();
#define MF_KERNEL(lambda)
Stringifies a kernel lambda for use with ShaderSpec::Assemble::kernel().
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 & kernel(KernelSource ks)
Supply a user kernel via MF_KERNEL.
Fluent assembler producing a ShaderSpec.

Definition at line 57 of file ShaderSpec.hpp.


The documentation for this struct was generated from the following file: