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

◆ bind_texture_node()

void MayaFlux::Buffers::NodeTextureProcessor::bind_texture_node ( const std::string &  name,
const std::shared_ptr< Nodes::GpuSync::TextureNode > &  node,
const std::shared_ptr< Core::VKImage > &  texture 
)

Bind a TextureNode to a GPU texture.

Parameters
nameLogical binding name
nodeTextureNode to read pixels from
textureGPU VKImage to upload to

TextureLoom handles all staging buffer creation/cleanup internally.

Definition at line 21 of file NodeTextureProcessor.cpp.

25{
26 if (!node) {
27 error<std::invalid_argument>(
30 std::source_location::current(),
31 "Cannot bind null texture node '{}'", name);
32 }
33
34 if (!texture) {
35 error<std::invalid_argument>(
38 std::source_location::current(),
39 "Cannot bind texture node '{}' to null VKImage", name);
40 }
41
42 size_t texture_size = static_cast<size_t>(node->get_width())
43 * static_cast<size_t>(node->get_height())
44 * 4
45 * sizeof(float);
46
47 m_bindings[name] = TextureBinding {
48 .node = node,
49 .gpu_texture = texture
50 };
51
53 "Bound texture node '{}' ({}x{}, {} bytes)",
54 name, node->get_width(), node->get_height(), texture_size);
55}
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< std::string, TextureBinding > m_bindings
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_bindings, MF_DEBUG, and MayaFlux::Buffers::NodeTextureProcessor::TextureBinding::node.