Add more ASTC texture formats with larger block sizes

This commit is contained in:
Wojtek Figat
2023-12-20 15:12:12 +01:00
parent e4df1fc756
commit 53a2ebbd17
5 changed files with 80 additions and 25 deletions

View File

@@ -337,14 +337,12 @@ int32 GPUTexture::ComputeBufferOffset(int32 subresource, int32 rowAlign, int32 s
int32 GPUTexture::ComputeBufferTotalSize(int32 rowAlign, int32 sliceAlign) const
{
int32 result = 0;
for (int32 mipLevel = 0; mipLevel < MipLevels(); mipLevel++)
{
const int32 slicePitch = ComputeSlicePitch(mipLevel, rowAlign);
const int32 depth = CalculateMipSize(Depth(), mipLevel);
result += Math::AlignUp<int32>(slicePitch * depth, sliceAlign);
}
return result * ArraySize();
}
@@ -355,8 +353,11 @@ int32 GPUTexture::ComputeSlicePitch(int32 mipLevel, int32 rowAlign) const
int32 GPUTexture::ComputeRowPitch(int32 mipLevel, int32 rowAlign) const
{
const int32 formatSize = PixelFormatExtensions::SizeInBytes(Format());
return Math::AlignUp<int32>(CalculateMipSize(Width(), mipLevel) * formatSize, rowAlign);
int32 mipWidth = CalculateMipSize(Width(), mipLevel);
int32 mipHeight = CalculateMipSize(Height(), mipLevel);
uint32 rowPitch, slicePitch;
RenderTools::ComputePitch(Format(), mipWidth, mipHeight, rowPitch, slicePitch);
return Math::AlignUp<int32>(rowPitch, rowAlign);
}
bool GPUTexture::Init(const GPUTextureDescription& desc)