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

◆ emit_spirv_asm()

std::string MayaFlux::Portal::Graphics::detail::emit_spirv_asm ( const ShaderSpec spec)

Emit complete SPIR-V assembly text for a generated compute kernel.

Parameters
specShaderSpec produced by ShaderSpec::Assemble::build().
Returns
SPIR-V assembly string suitable for spvTextToBinary.

Definition at line 1383 of file AsmGenerator.cpp.

1384{
1385 std::string src;
1386 src += emit_header(spec);
1387 src += emit_decorations(spec);
1388 src += emit_types(spec);
1389
1390 if (spec.tmpl == KernelTemplate::Convolve2D) {
1391 src += emit_convolve2d_body(spec);
1392 return src;
1393 }
1394
1395 bool has_image = false;
1396 for (const auto& b : spec.bindings) {
1397 if (b.modality == Kakshya::DataModality::IMAGE_2D) {
1398 has_image = true;
1399 break;
1400 }
1401 }
1402
1403 if (has_image) {
1404 src += emit_image_body(spec);
1405 return src;
1406 }
1407
1408 switch (spec.tmpl) {
1409 case KernelTemplate::Reduction:
1410 src += (spec.op == KernelOp::MaxIndex) ? emit_max_index_body(spec) : emit_reduction_body(spec);
1411 break;
1412 case KernelTemplate::Scan:
1413 src += emit_scan_body(spec);
1414 break;
1415 case KernelTemplate::BitonicSort:
1416 src += emit_bitonic_body(spec);
1417 break;
1418 case KernelTemplate::Elementwise:
1419 case KernelTemplate::Stencil:
1420 case KernelTemplate::GeometryEmit:
1421 default:
1422 src += emit_elementwise_body(spec);
1423 break;
1424 }
1425 return src;
1426}
size_t b

References b, MayaFlux::Portal::Graphics::ShaderSpec::bindings, MayaFlux::Portal::Graphics::BitonicSort, MayaFlux::Portal::Graphics::Convolve2D, MayaFlux::Portal::Graphics::Elementwise, MayaFlux::Portal::Graphics::GeometryEmit, MayaFlux::Kakshya::IMAGE_2D, MayaFlux::Portal::Graphics::MaxIndex, MayaFlux::Portal::Graphics::ShaderSpec::op, MayaFlux::Portal::Graphics::Reduction, MayaFlux::Portal::Graphics::Scan, MayaFlux::Portal::Graphics::Stencil, and MayaFlux::Portal::Graphics::ShaderSpec::tmpl.

Referenced by MayaFlux::Portal::Graphics::ShaderFoundry::load_shader().

+ Here is the caller graph for this function: