Revive old alignment utility functions, give them better names.

This commit is contained in:
Henrik Rydgård committed 2025-09-03 20:48:51 +02:00
1 parent f2df336f79
commit 33b87578c5
6 files changed
+31 -19

No files matched your search

+3 -2
View File
@@ -582,8 +582,9 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
plan.GetMipSize(i, &mipWidth, &mipHeight);
int bpp = VkFormatBytesPerPixel(actualFmt);
int optimalStrideAlignment = std::max(4, (int)vulkan->GetPhysicalDeviceProperties().properties.limits.optimalBufferCopyRowPitchAlignment);
int byteStride = RoundUpToPowerOf2(mipWidth * bpp, optimalStrideAlignment); // output stride
// RoundToNextPowerOf2 is probably not necessary as the optimal alignment is gonna be a power of 2.
int optimalStrideAlignment = RoundToNextPowerOf2(std::max(4, (int)vulkan->GetPhysicalDeviceProperties().properties.limits.optimalBufferCopyRowPitchAlignment));
int byteStride = RoundUpToMultipleOf(mipWidth * bpp, optimalStrideAlignment); // output stride
int pixelStride = byteStride / bpp;
int uploadSize = byteStride * mipHeight;