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

◆ config_from_spec()

GpuComputeConfig MayaFlux::Yantra::config_from_spec ( const Portal::Graphics::ShaderSpec spec)
inline

Derive a GpuComputeConfig from a ShaderSpec.

Compiles (or retrieves cached) the shader via ShaderFoundry and packages the result with workgroup size and push constant size. Returns a config with INVALID_SHADER on compilation failure.

Callers use this alongside bindings_from_spec() to configure any concrete GpuExecutionContext subclass without depending on a specific executor type.

auto spec = ShaderSpec::Assemble{}
.ssbo("sig", BindingDirection::InOut, Kakshya::GpuDataFormat::FLOAT32)
.pc("gain")
.op(KernelOp::Scale)
.build();
auto cfg = config_from_spec(spec);
auto bindings = bindings_from_spec(spec);
auto exec = std::make_shared<ShaderExecutionContext<>>(cfg, bindings);
my_op->set_gpu_backend(exec);
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.
GpuComputeConfig config_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuComputeConfig from a ShaderSpec.
std::vector< GpuBufferBinding > bindings_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuBufferBinding list from a ShaderSpec.

Definition at line 100 of file ShaderSpecBinding.hpp.

102{
103 return GpuComputeConfig {
105 .push_constant_size = spec.push_constant_bytes,
106 .shader_id = Portal::Graphics::get_shader_foundry().load_shader(spec),
107 };
108}
Plain-data description of the compute shader to dispatch.
std::array< uint32_t, 3 > workgroup_size

References MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::ShaderFoundry::load_shader(), MayaFlux::Portal::Graphics::ShaderSpec::push_constant_bytes, MayaFlux::Portal::Graphics::ShaderSpec::workgroup_size, and MayaFlux::Portal::Graphics::GpuComputeConfig::workgroup_size.

Referenced by MayaFlux::Yantra::VisionGpuExecutor::config(), MayaFlux::Yantra::ComputationGrammar::RuleBuilder::executes(), and MayaFlux::Yantra::VisionGpuExecutor::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: