I've been trying to figure out if my planned usage of managed buffers breaks any rules, but didn't find anything, so apologies if this has already been answered.
If I have a single Metal buffer which:
* is marked as managed and uses -didModifyRange:
* is only written to by the CPU and read by the GPU
* is only appended to
Can I keep a single copy of it around regardless of other n-buffering I do? E.g. can I do triple buffering elsewhere but keep one of this buffer around and append to it between draw loops when necessary?
A trivial example might be a buffer of int32s which contains the current item index as its value (bytes[i] = i;). If the buffer is over-allocated initially, (e.g. 1,000 items) but I only use the first 100 (and use -[id<MTLBuffer> didModifyRange:NSRange(0, 100 * sizeof(int32_t)]), can I later populate indices 100-200 and call -didModifyRange: on that portion in the next loop without tearing? Are there rules about this?