MayaFlux 0.4.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 241 of file DataWriteProcessor.cpp.

242{
243 auto access = Kakshya::as_texture_access(slot);
244 if (!access) {
246 "DataWriteProcessor: as_texture_access failed for modality {}",
248 return;
249 }
250
251 m_last_texture_format = access->format;
252
253 if (m_tex_width == 0 || m_tex_height == 0) {
255 "DataWriteProcessor: setup_pixel_target() not called before texture upload");
256 return;
257 }
258
260
261 if (!m_gpu_texture) {
262 m_gpu_texture = loom.create_2d(m_tex_width, m_tex_height, m_tex_format, nullptr, 1);
263 if (!m_gpu_texture) {
265 "DataWriteProcessor: failed to create GPU texture {}x{}",
267 return;
268 }
270 if (auto rp = vk->get_render_processor()) {
271 rp->bind_texture(m_tex_binding, m_gpu_texture);
272 }
273 }
274
275 loom.upload_data(m_gpu_texture, access->data_ptr, access->byte_count, m_image_staging);
276}
#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:83
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: