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

◆ ensure_kernel()

bool MayaFlux::Portal::Graphics::PrimitiveMill::ensure_kernel ( )
private

Compiles the kernel and allocates its descriptor sets, once.

Definition at line 485 of file PrimitiveMill.cpp.

486{
488 return true;
489 }
490
491 const auto spec = build_mill_spec();
492 m_push_constant_size = spec.push_constant_bytes;
493
494 if (m_push_constant_size != sizeof(MillPC)) {
496 "PrimitiveMill: kernel expects {} push constant bytes but MillPC is {}",
497 m_push_constant_size, sizeof(MillPC));
498 return false;
499 }
500
501 auto& foundry = get_shader_foundry();
502 m_shader = foundry.load_shader(spec);
503 if (m_shader == INVALID_SHADER) {
505 "PrimitiveMill: kernel failed to compile");
506 return false;
507 }
508
509 auto& press = get_compute_press();
510 m_pipeline = press.create_pipeline_auto(m_shader, m_push_constant_size);
513 "PrimitiveMill: pipeline creation failed");
514 return false;
515 }
516
517 m_sets = press.allocate_pipeline_descriptors(m_pipeline);
518 if (m_sets.empty()) {
520 "PrimitiveMill: descriptor allocation failed");
521 return false;
522 }
523
524 return true;
525}
#define MF_ERROR(comp, ctx,...)
std::vector< DescriptorSetID > m_sets
@ Rendering
GPU rendering operations (graphics pipeline, frame rendering)
@ Portal
High-level user-facing API layer.
constexpr ShaderID INVALID_SHADER
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr ComputePipelineID INVALID_COMPUTE_PIPELINE
MAYAFLUX_API ComputePress & get_compute_press()
std::shared_ptr< Buffers::TextBuffer > press(std::string_view text, const PressParams &params)
Composite a UTF-8 string into a new TextBuffer.
Definition InkPress.cpp:344

References MayaFlux::Portal::Graphics::get_compute_press(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::INVALID_COMPUTE_PIPELINE, MayaFlux::Portal::Graphics::INVALID_SHADER, m_pipeline, m_push_constant_size, m_sets, m_shader, MF_ERROR, MayaFlux::Journal::Portal, MayaFlux::Journal::Rendering, and spec().

Referenced by mill().

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