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

◆ emit_fft()

std::string MayaFlux::Portal::Graphics::detail::emit_fft ( const ShaderSpec & spec)
nodiscard

Emit the globals, soft-double functions and entry point of the FFT template.

Returns an empty string when the spec does not have the template's shape: four VEC2_U32 bindings (five for a projection, with descriptors of at least one), five UINT32 push constants, points a power of two from 2 to 2048 and a power of two workgroup size of at most points / 2.

Definition at line 1147 of file AsmSoftDouble.cpp.

1148{
1149 const uint32_t points = spec.points;
1150 const uint32_t local = spec.workgroup_size[0];
1151 const bool projecting = spec.spectrum == SpectrumOutput::Projection;
1152 const bool shaped = spec.bindings.size() == (projecting ? 5U : 4U) && spec.pc_fields.size() == 5
1153 && (!projecting || spec.descriptors >= 1)
1154 && std::ranges::all_of(spec.bindings, [](const BindingSlot& b) {
1155 return b.format == Kakshya::GpuDataFormat::VEC2_U32;
1156 })
1157 && std::ranges::all_of(spec.pc_fields, [](const PushConstantField& f) {
1158 return f.format == Kakshya::GpuDataFormat::UINT32;
1159 });
1160 const bool sized = points >= 2 && points <= 2048 && (points & (points - 1)) == 0
1161 && local >= 1 && local <= points / 2 && (local & (local - 1)) == 0;
1162 if (!shaped || !sized) {
1163 return {};
1164 }
1165
1166 Builder builder;
1167 return builder.fft(spec);
1168}
@ Projection
descriptors values per window: row r of a weights binding, one weight per power bin,...
Declaration of one SSBO or image binding in a generated shader.
One field in the generated push constant block.
uint32_t points
FFT only. Points per window.
std::vector< PushConstantField > pc_fields
std::vector< BindingSlot > bindings
uint32_t descriptors
FFT with SpectrumOutput::Projection only. Rows of weights.
std::array< uint32_t, 3 > workgroup_size

References MayaFlux::Portal::Graphics::ShaderSpec::bindings, MayaFlux::Portal::Graphics::ShaderSpec::descriptors, MayaFlux::Portal::Graphics::ShaderSpec::pc_fields, MayaFlux::Portal::Graphics::ShaderSpec::points, MayaFlux::Portal::Graphics::Projection, MayaFlux::Portal::Graphics::ShaderSpec::spectrum, and MayaFlux::Portal::Graphics::ShaderSpec::workgroup_size.

Referenced by emit_spirv_asm().

Here is the caller graph for this function: