MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::ShaderSpec Struct Reference

Complete declarative description of a generated compute shader. More...

#include <ShaderSpec.hpp>

Collaboration diagram for MayaFlux::Buffers::ShaderSpec:

Classes

class  Assemble
 Fluent assembler producing a ShaderSpec. More...

Public Attributes

std::vector< BindingSlot > bindings
bool centred { false }
 LaggedPair only. Subtract each window's mean from both operands first.
uint32_t descriptors { 0 }
 FFT with SpectrumOutput::Projection only. Rows of weights.
std::vector< FunctionDef > functions
 Emitted before main(). GLSL path only.
std::string glsl_preamble
 Global declarations emitted before the functions, such as shared arrays. GLSL path only.
std::optional< KernelSource > kernel
 When set, KernelOp is ignored.
ReductionMap map { ReductionMap::Identity }
 SegmentedReduction only.
KernelOp op { KernelOp::Scale }
PairMap pair_map { PairMap::Product }
 LaggedPair only.
std::vector< PushConstantField > pc_fields
uint32_t points { 0 }
 FFT only. Points per window.
uint32_t push_constant_bytes { 0 }
SpectrumOutput spectrum { SpectrumOutput::Complex }
 FFT only.
KernelTemplate tmpl { KernelTemplate::Elementwise }
WordPairOp word_op { WordPairOp::Add }
 WordPairMap only.
std::array< uint32_t, 3 > workgroup_size { 256, 1, 1 }

Detailed Description

Complete declarative description of a generated compute shader.

Pure value type. Consumed by ShaderFoundry::load_shader(const ShaderSpec&) which emits SPIR-V assembly via VKShaderModule::emit_spirv_asm() and assembles it via VKShaderModule::create_from_spirv_asm(). No shaderc or GLSL toolchain is involved.

The op field selects a named operation the emitter knows how to lower to SPIR-V opcodes deterministically. PC fields are consumed in declaration order as operands.

auto spec = ShaderSpec::Assemble{}
.ssbo("sig", BindingDirection::InOut, Kakshya::GpuDataFormat::FLOAT32)
.pc("gain")
.pc("offset")
.op(KernelOp::ScaleOffset)
.build();
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.
Fluent assembler producing a ShaderSpec.
@ FLOAT32
32-bit float (standard GPU)

Definition at line 453 of file ShaderSpec.hpp.


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