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

◆ on_before_gpu_dispatch()

void MayaFlux::Yantra::TextureExecutionContext::on_before_gpu_dispatch ( const std::vector< std::vector< double > > &  ,
const DataStructureInfo  
)
inlineoverrideprotectedvirtual

Stages the pending TextureContainer at the declared input image binding and, in CONTAINER or IMAGE mode, allocates the output storage image at the declared output binding.

Reimplemented from MayaFlux::Yantra::GpuDispatchCore.

Definition at line 402 of file TextureExecutionContext.hpp.

405 {
408 std::shared_ptr<Core::VKImage> img;
409 if (m_pending_container->get_layer_count() > 1) {
410 if (!m_upload_staging) {
412 m_pending_container->byte_size() * m_pending_container->get_layer_count());
413 }
414 img = m_pending_container->to_image_array(m_upload_staging);
415 } else {
416 if (!m_upload_staging) {
418 m_pending_container->byte_size());
419 }
421 }
422
423 auto& in_slot = input_slot();
424 if (in_slot.binding.element_type == GpuBufferBinding::ElementType::IMAGE_STORAGE) {
426 } else {
427 stage_image_at(in_slot.binding.binding, img, GpuBufferBinding::ElementType::IMAGE_SAMPLED, sampler);
428 }
429 in_slot.image = img;
430
433 const uint32_t ow = m_output_dim_override
434 ? m_output_dim_override->first
435 : m_pending_container->get_width();
436 const uint32_t oh = m_output_dim_override
437 ? m_output_dim_override->second
438 : m_pending_container->get_height();
439 prepare_output_image(ow, oh);
440 }
441 }
442 }
vk::Sampler get_default_linear()
Get a default linear sampler.
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.
std::shared_ptr< Buffers::VKBuffer > m_upload_staging
std::shared_ptr< Kakshya::TextureContainer > m_pending_container
void prepare_output_image(uint32_t width, uint32_t height)
Allocates the output storage image and stages it at the declared output binding.
ImageSlot & input_slot()
Find the declared input image slot.
std::optional< std::pair< uint32_t, uint32_t > > m_output_dim_override
@ IMAGE
Transition output image to shader-read layout; no CPU download.
@ CONTAINER
Download storage image at binding 0 into a TextureContainer.
std::shared_ptr< VKBuffer > create_image_staging_buffer(size_t size)
Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of...