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

◆ emit_segmented_argmax()

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

Emit the globals and entry point of the SegmentedArgMax template.

Returns an empty string when the spec does not have the template's shape: two VEC2_U32 bindings, three UINT32 push constants and a power of two workgroup size from 2 to 1024.

Definition at line 1189 of file AsmSoftDouble.cpp.

1190{
1191 const uint32_t local = spec.workgroup_size[0];
1192 const bool shaped = spec.bindings.size() == 2 && spec.pc_fields.size() == 3
1193 && std::ranges::all_of(spec.bindings, [](const BindingSlot& b) {
1194 return b.format == Kakshya::GpuDataFormat::VEC2_U32;
1195 })
1196 && std::ranges::all_of(spec.pc_fields, [](const PushConstantField& f) {
1197 return f.format == Kakshya::GpuDataFormat::UINT32;
1198 });
1199 const bool sized = local >= 2 && local <= 1024 && (local & (local - 1)) == 0;
1200 if (!shaped || !sized) {
1201 return {};
1202 }
1203
1204 Builder builder;
1205 return builder.segmented_argmax(spec);
1206}
Declaration of one SSBO or image binding in a generated shader.
One field in the generated push constant block.
std::vector< PushConstantField > pc_fields
std::vector< BindingSlot > bindings
std::array< uint32_t, 3 > workgroup_size

References MayaFlux::Portal::Graphics::ShaderSpec::bindings, MayaFlux::Portal::Graphics::ShaderSpec::pc_fields, and MayaFlux::Portal::Graphics::ShaderSpec::workgroup_size.

Referenced by emit_spirv_asm().

Here is the caller graph for this function: