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

◆ upload_texture()

void MayaFlux::Buffers::DataWriteProcessor::upload_texture ( const std::shared_ptr< VKBuffer > &  vk,
Kakshya::DataVariant &  slot 
)
private

Definition at line 430 of file DataWriteProcessor.cpp.

431{
432 auto access = Kakshya::as_texture_access(slot);
433 if (!access) {
435 "DataWriteProcessor: as_texture_access failed for modality {}",
437 return;
438 }
439
440 m_last_texture_format = access->format;
441
442 if (m_tex_width == 0 || m_tex_height == 0) {
444 "DataWriteProcessor: setup_pixel_target() not called before texture upload");
445 return;
446 }
447
449
450 if (!m_gpu_texture) {
451 m_gpu_texture = loom.create_2d(m_tex_width, m_tex_height, m_tex_format, nullptr, 1);
452 if (!m_gpu_texture) {
454 "DataWriteProcessor: failed to create GPU texture {}x{}",
456 return;
457 }
459 if (auto rp = vk->get_render_processor()) {
460 rp->bind_texture(m_tex_binding, m_gpu_texture);
461 }
462 }
463
464 loom.upload_data(m_gpu_texture, access->data_ptr, access->byte_count, m_image_staging);
465}
#define MF_RT_ERROR(comp, ctx,...)
Portal::Graphics::ImageFormat m_tex_format
std::shared_ptr< Core::VKImage > m_gpu_texture
std::shared_ptr< VKBuffer > m_image_staging
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...
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::string_view modality_to_string(DataModality modality)
Convert DataModality enum to string representation.
Definition NDData.cpp:102
std::optional< TextureAccess > as_texture_access(const DataVariant &variant)
Extract a TextureAccess from a DataVariant.
MAYAFLUX_API TextureLoom & get_texture_manager()
Get the global texture manager instance.

References MayaFlux::Kakshya::as_texture_access(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_image_staging_buffer(), MayaFlux::Portal::Graphics::get_texture_manager(), m_gpu_texture, m_image_staging, m_last_texture_format, m_modality, m_tex_binding, m_tex_format, m_tex_height, m_tex_width, MF_RT_ERROR, and MayaFlux::Kakshya::modality_to_string().

Referenced by processing_function(), and upload_primary().

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