Ver código fonte

Forced 4-bits alignment for glTF buffers

Alexis Breust 7 anos atrás
pai
commit
0f4189c77e
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      code/glTF2Asset.inl

+ 2 - 1
code/glTF2Asset.inl

@@ -485,7 +485,8 @@ uint8_t* new_data;
 inline size_t Buffer::AppendData(uint8_t* data, size_t length)
 {
     size_t offset = this->byteLength;
-    Grow(length);
+    // Force alignment to 4 bits
+    Grow((length + 3) & ~3);
     memcpy(mData.get() + offset, data, length);
     return offset;
 }