Add kTextureRowPitchAlignment and Align helper

This commit is contained in:
Austin Eng
2017-07-14 10:58:50 -04:00
committed by Austin Eng
parent 8867e5d8df
commit 98b781527f
3 changed files with 8 additions and 0 deletions

View File

@@ -60,3 +60,9 @@ void* AlignVoidPtr(void* ptr, size_t alignment) {
ASSERT(alignment != 0);
return reinterpret_cast<void*>((reinterpret_cast<intptr_t>(ptr) + (alignment - 1)) & ~(alignment - 1));
}
uint32_t Align(uint32_t value, size_t alignment) {
ASSERT(IsPowerOfTwo(alignment));
ASSERT(alignment != 0);
return (value + (alignment - 1)) & ~(alignment - 1);
}