Browse Source

[TEST] Late catch on accelerated image upload path

lsfg-android
CamilleLaVey 4 weeks ago
parent
commit
b270bae970
  1. 6
      src/video_core/renderer_vulkan/vk_compute_pass.cpp
  2. 10
      src/video_core/renderer_vulkan/vk_texture_cache.cpp

6
src/video_core/renderer_vulkan/vk_compute_pass.cpp

@ -746,10 +746,8 @@ void BlockLinearUnswizzle3DPass::Unswizzle(
const u32 MAX_BATCH_SLICES = (std::min)(z_count, image.info.size.depth);
if (!image.has_compute_unswizzle_buffer) {
// Allocate exactly what this batch needs
image.AllocateComputeUnswizzleBuffer(MAX_BATCH_SLICES);
}
// Allocate or grow to cover this batch's slice count
image.AllocateComputeUnswizzleBuffer(MAX_BATCH_SLICES);
ASSERT(swizzles.size() == 1);
const auto& sw = swizzles[0];

10
src/video_core/renderer_vulkan/vk_texture_cache.cpp

@ -1635,9 +1635,6 @@ Image::Image(const VideoCommon::NullImageParams& params) : VideoCommon::ImageBas
Image::~Image() = default;
void Image::AllocateComputeUnswizzleBuffer(u32 max_slices) {
if (has_compute_unswizzle_buffer)
return;
using VideoCore::Surface::BytesPerBlock;
const u32 block_bytes = BytesPerBlock(info.format); // 8 for BC1, 16 for BC6H
@ -1654,7 +1651,12 @@ void Image::AllocateComputeUnswizzleBuffer(u32 max_slices) {
static_cast<u64>(blocks_y) *
static_cast<u64>(blocks_z);
compute_unswizzle_buffer_size = block_count * block_bytes;
const VkDeviceSize required_size = block_count * block_bytes;
if (has_compute_unswizzle_buffer && required_size <= compute_unswizzle_buffer_size) {
return;
}
compute_unswizzle_buffer_size = required_size;
VkBufferCreateInfo ci{
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,

Loading…
Cancel
Save