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 129 of file MeshProcessor.cpp.

130{
131 const auto* vb = std::get_if<std::vector<uint8_t>>(
132 &buf->m_mesh_data.vertex_variant);
133 const auto* ib = std::get_if<std::vector<uint32_t>>(
134 &buf->m_mesh_data.index_variant);
135
136 if (!vb || vb->empty() || !ib || ib->empty()) {
138 "MeshProcessor::allocate_gpu_buffers: empty vertex or index data");
139 return;
140 }
141
142 if (!buf->is_host_visible()) {
144 }
145
146 const size_t idx_bytes = ib->size() * sizeof(uint32_t);
147 m_gpu_index_buffer = std::make_shared<VKBuffer>(
148 idx_bytes,
151
154
156 "MeshProcessor: allocated vertex buffer ({} bytes) + index buffer ({} bytes)",
157 vb->size(), idx_bytes);
158}
#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:471
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: