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

◆ compute_stride()

void MayaFlux::Kakshya::VertexLayout::compute_stride ( )
inline

Helper: compute stride from attributes if not explicitly set.

Definition at line 62 of file VertexLayout.hpp.

63 {
64 if (stride_bytes == 0 && !attributes.empty()) {
65 uint32_t max_offset = 0;
66 uint32_t last_size = 0;
67
68 for (const auto& attr : attributes) {
69 uint32_t attr_size = modality_size_bytes(attr.component_modality);
70 max_offset = std::max(max_offset, attr.offset_in_vertex);
71 if (attr.offset_in_vertex == max_offset) {
72 last_size = attr_size;
73 }
74 }
75
76 stride_bytes = max_offset + last_size;
77 }
78 }
uint32_t stride_bytes
Total bytes per vertex (stride in Vulkan terms) e.g., 3 floats (position) + 3 floats (normal) = 24 by...
static uint32_t modality_size_bytes(DataModality mod)
Get size in bytes for a given modality Mirrors VKBuffer::get_format() logic.
std::vector< VertexAttributeLayout > attributes
All attributes that make up one vertex Ordered by shader location (0, 1, 2, ...)

References attributes, modality_size_bytes(), and stride_bytes.

Referenced by MayaFlux::Buffers::VKBuffer::set_vertex_layout().

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