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

◆ allocate_gpu_buffers()

void MayaFlux::Buffers::MeshProcessor::allocate_gpu_buffers ( const std::shared_ptr< MeshBuffer > &  buf)
private

Definition at line 113 of file MeshProcessor.cpp.

114{
115 const auto* vb = std::get_if<std::vector<uint8_t>>(
116 &buf->m_mesh_data.vertex_variant);
117 const auto* ib = std::get_if<std::vector<uint32_t>>(
118 &buf->m_mesh_data.index_variant);
119
120 if (!vb || vb->empty() || !ib || ib->empty()) {
122 "MeshProcessor::allocate_gpu_buffers: empty vertex or index data");
123 return;
124 }
125
126 if (!buf->is_host_visible()) {
128 }
129
130 const size_t idx_bytes = ib->size() * sizeof(uint32_t);
131 m_gpu_index_buffer = std::make_shared<VKBuffer>(
132 idx_bytes,
135
138
140 "MeshProcessor: allocated vertex buffer ({} bytes) + index buffer ({} bytes)",
141 vb->size(), idx_bytes);
142}
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::shared_ptr< VKBuffer > m_vertex_staging
std::shared_ptr< VKBuffer > m_index_staging
std::shared_ptr< VKBuffer > m_gpu_index_buffer
void ensure_initialized(const std::shared_ptr< VKBuffer > &buffer)
Definition VKBuffer.cpp:462
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
@ UNKNOWN
Unknown or undefined modality.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_staging_buffer(), MayaFlux::Buffers::VKBufferProcessor::ensure_initialized(), MayaFlux::Buffers::VKBuffer::INDEX, m_gpu_index_buffer, m_index_staging, m_vertex_staging, MF_DEBUG, MF_ERROR, and MayaFlux::Kakshya::UNKNOWN.

Referenced by on_attach().

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