brutal/Brutal.Ktx/Abstractions/GpuUploadUtils.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

18 lines
629 B
C#

namespace Brutal.KtxApi.Abstractions;
public static class GpuUploadUtils
{
public static bool IsRowSize4BytePadded(KtxTextureHandle textureHandle, int level)
{
if (textureHandle.ClassId == ClassId.Texture2C)
return false;
// Catches compressed textures (All multiple of 4 in element size), and uncompressed with 4 byte elements
if (textureHandle.GetElementSize() % 4 == 0)
return false;
var levelPixelWidth = textureHandle.BaseWidth >> level;
return textureHandle.GetRowPitch((uint)level) != textureHandle.GetElementSize() * levelPixelWidth;
}
}