amber
amber copied to clipboard
Add comments to private data members of buffer.h to determine the single source of truth
There's a fragile disconnect between setting max_size_in_bytes_, element_count_ and resizing the bytes_ vector. No single one of them is the source of truth. Write comments at their member declarations to define exactly what they mean, and therefore determine the single source of truth.
There are a bunch of things that get tangled here.
- Element Count is the number of 'elements' in the buffer
- Value Count is the number of individual values (element count * values per element)
- The byte size is the element count * the format byte size
- The max size is the format byte size * maximum number of elements ever specified
- These byte sizes can change if the format is changed (or set later as happens with
ssbo size - The value count can also change as the values per element is specified in the format