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

◆ resolve_vertex_layout()

MAYAFLUX_API std::optional< Kakshya::VertexLayout > MayaFlux::Buffers::resolve_vertex_layout ( const std::shared_ptr< VKBuffer > &  source)

Resolve the vertex extent of a buffer's primary storage for reading.

Parameters
sourceInitialized buffer carrying a vertex layout.
Returns
The buffer's layout when it has a nonzero stride and count and vertex_count * stride_bytes fits inside the allocation; nullopt otherwise.

vertex_count is whatever the layout declares. On buffers whose geometry is generated on the GPU it may describe capacity rather than live vertices.

Definition at line 422 of file StagingUtils.cpp.

424{
425 if (!source || !source->is_initialized()) {
426 return std::nullopt;
427 }
428
429 auto layout = source->get_vertex_layout();
430 if (!layout || layout->stride_bytes == 0 || layout->vertex_count == 0
431 || layout->vertex_count > source->get_size_bytes() / layout->stride_bytes) {
432 return std::nullopt;
433 }
434
435 return layout;
436}

Referenced by MayaFlux::Buffers::DataReadProcessor::read_vertices().

+ Here is the caller graph for this function: