generalize allocation alignment for emscripten
Emscripten has a bug where its allocation do not align to
alignof(max_align_t). This is causing misalignment issues when
using SkParagraph in JavaScript.
Add the kAllocationAlignment to express this notion, and
us it when calculating additional memory allocation.
Change-Id: I62106d65333eca4d529b5f38a71b244b9192465e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414396
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Jiulong Wang <jiulongw@vibe.us>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/GrSubRunAllocator.cpp b/src/gpu/GrSubRunAllocator.cpp
index 2d08e0a..83d0f70 100644
--- a/src/gpu/GrSubRunAllocator.cpp
+++ b/src/gpu/GrSubRunAllocator.cpp
@@ -61,7 +61,7 @@
void GrBagOfBytes::needMoreBytes(int requestedSize, int alignment) {
int nextBlockSize = fFibProgression.nextBlockSize();
const int size = PlatformMinimumSizeWithOverhead(
- std::max(requestedSize, nextBlockSize), alignof(max_align_t));
+ std::max(requestedSize, nextBlockSize), kAllocationAlignment);
char* const bytes = new char[size];
// fEndByte is changed by setupBytesAndCapacity. Remember it to link back to.
char* const previousBlock = fEndByte;