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

◆ prepare_output_image()

void MayaFlux::Yantra::TextureExecutionContext::prepare_output_image ( uint32_t  width,
uint32_t  height 
)
inline

Allocates the output storage image and stages it at the declared output binding.

Only called in CONTAINER or IMAGE mode, from on_before_gpu_dispatch or per-step by callers chaining multi-pass sequences. The output slot keeps the images it has used, keyed by their creation parameters, so a caller that alternates between a few sizes, such as a sequence that downsamples every run, reuses them instead of allocating on every change. Images beyond a byte budget are dropped least recently used first, and asking for a dropped shape allocates again.

TextureLoom retains every image it creates for the life of the process, so an image that is dropped from the cache is not freed.

Definition at line 375 of file TextureExecutionContext.hpp.

376 {
377 auto& slot = output_slot();
379 auto primary = acquire_output_image(slot, width, height);
380 const auto input = input_slot().image;
381 slot.image = primary && primary == input
382 ? acquire_output_image(slot, width, height, true)
383 : std::move(primary);
384 slot.width = width;
385 slot.height = height;
386 } else if (!slot.image || slot.width != width || slot.height != height) {
387 slot.image = acquire_output_image(slot, width, height);
388 slot.width = width;
389 slot.height = height;
390 }
391 stage_image_at(slot.binding.binding, slot.image, GpuBufferBinding::ElementType::IMAGE_STORAGE);
392 }
Core::GlobalInputConfig input
Definition Config.cpp:42
uint32_t width
uint32_t height
void stage_image_at(size_t binding_index, std::shared_ptr< Core::VKImage > image, GpuBufferBinding::ElementType kind, vk::Sampler sampler=nullptr)
Register a VKImage at an explicit binding index.
ImageSlot & output_slot()
Find the declared output image slot.
ImageSlot & input_slot()
Find the declared input image slot.
std::shared_ptr< Core::VKImage > acquire_output_image(ImageSlot &slot, uint32_t width, uint32_t height, bool alternate=false)
Return this slot's cached image for these creation parameters, creating and caching one when there is...
void move(EditableText &s, int n)
Move the cursor by n codepoints.
Definition TextEdit.cpp:20

References height, input, and width.