From 9b64e67e1412926c19b79c0114f97bf68fe8259c Mon Sep 17 00:00:00 2001 From: gibbed Date: Sat, 12 May 2018 20:19:58 -0500 Subject: [PATCH] [Vulkan] Fix following mips for compressed textures. --- src/xenia/gpu/texture_info.cc | 10 ++++------ src/xenia/gpu/vulkan/texture_cache.cc | 10 ++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/xenia/gpu/texture_info.cc b/src/xenia/gpu/texture_info.cc index b4011ddd7..6ddccfbb5 100644 --- a/src/xenia/gpu/texture_info.cc +++ b/src/xenia/gpu/texture_info.cc @@ -452,12 +452,10 @@ uint32_t TextureInfo::GetMipByteSize(const TextureInfo& src, uint32_t mip) { xe::round_up(logical_height, src.format_info()->block_height) / src.format_info()->block_height; - if (mip == 0) { - // Texture dimensions must be a multiple of tile - // dimensions (32x32 blocks). - block_width = xe::round_up(block_width, 32); - block_height = xe::round_up(block_height, 32); - } + // Texture dimensions must be a multiple of tile + // dimensions (32x32 blocks). + block_width = xe::round_up(block_width, 32); + block_height = xe::round_up(block_height, 32); uint32_t byte_pitch = block_width * bytes_per_block; diff --git a/src/xenia/gpu/vulkan/texture_cache.cc b/src/xenia/gpu/vulkan/texture_cache.cc index 12ffca8cb..05b9554f4 100644 --- a/src/xenia/gpu/vulkan/texture_cache.cc +++ b/src/xenia/gpu/vulkan/texture_cache.cc @@ -905,8 +905,14 @@ bool TextureCache::ConvertTexture2D(uint8_t* dest, void* host_address = memory_->TranslatePhysical(address); // Pitch of the source texture in blocks. - uint32_t block_width = mip == 0 ? src.size.block_width - : xe::next_pow2(src.size.block_width) >> mip; + uint32_t block_width; + if (mip == 0) { + block_width = src.size.block_width; + } else { + block_width = xe::next_pow2(src.size.block_width) >> mip; + block_width = xe::round_up(block_width, 32); + } + uint32_t logical_width = src.size.logical_width >> mip; uint32_t logical_height = src.size.logical_height >> mip; uint32_t input_width = src.size.input_width >> mip;