| 205 | } |
| 206 | |
| 207 | void *VkHardwareBuffer::Lock(unsigned int size) |
| 208 | { |
| 209 | size = max(size, (unsigned int)16); // For supporting zero byte buffers |
| 210 | |
| 211 | if (!mBuffer) |
| 212 | { |
| 213 | // The model mesh loaders lock multiple non-persistent buffers at the same time. This is not allowed in vulkan. |
| 214 | // VkDeviceMemory can only be mapped once and multiple non-persistent buffers may come from the same device memory object. |
| 215 | mStaticUpload.Resize(size); |
| 216 | map = mStaticUpload.Data(); |
| 217 | } |
| 218 | else if (!mPersistent) |
| 219 | { |
| 220 | map = mBuffer->Map(0, size); |
| 221 | } |
| 222 | return map; |
| 223 | } |
| 224 | |
| 225 | void VkHardwareBuffer::Unlock() |
| 226 | { |