diff --git a/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp b/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp index 28f4577085..33d35abbbd 100644 --- a/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp +++ b/rpcs3/Emu/RSX/Common/tiled_dma_copy.hpp @@ -3,6 +3,9 @@ #include #include +// Set this to 1 to force all decoding to be done on the CPU. +#define DEBUG_DMA_TILING 0 + // This is a 1:1 port of the GPU code for my own sanity when debugging misplaced bits // For a high-level explanation, read https://envytools.readthedocs.io/en/latest/hw/memory/vram.html namespace rsx diff --git a/rpcs3/Emu/RSX/VK/VKRenderTargets.cpp b/rpcs3/Emu/RSX/VK/VKRenderTargets.cpp index 74b7f565e4..7ac76fe8f7 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderTargets.cpp +++ b/rpcs3/Emu/RSX/VK/VKRenderTargets.cpp @@ -687,8 +687,28 @@ namespace vk rsx::flags32_t upload_flags = upload_contents_inline; u32 heap_align = rsx_pitch; +#if DEBUG_DMA_TILING + std::vector ext_data; +#endif + if (auto tiled_region = rsx::get_current_renderer()->get_tiled_memory_region(range)) { +#if DEBUG_DMA_TILING + auto real_data = vm::get_super_ptr(range.start); + ext_data.resize(tiled_region.tile->size); + rsx::tile_texel_data( + ext_data.data(), + real_data, + tiled_region.base_address, + range.start - tiled_region.base_address, + tiled_region.tile->size, + tiled_region.tile->bank, + tiled_region.tile->pitch, + subres.width_in_block, + subres.height_in_block + ); + subres.data = std::span(ext_data); +#else const auto available_tile_size = tiled_region.tile->size - (range.start - tiled_region.base_address); const auto max_content_size = tiled_region.tile->pitch * utils::align(subres.height_in_block, 64); const auto section_length = std::min(max_content_size, available_tile_size); @@ -747,6 +767,7 @@ namespace vk subres.data = { scratch_buf, linear_data_scratch_offset }; upload_flags |= source_is_gpu_resident; heap_align = subres.width_in_block * get_bpp(); +#endif } if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]] diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index f418f761a7..5c4d87b587 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -8,18 +8,13 @@ #include "vkutils/image_helpers.h" #include "../Common/texture_cache.h" +#include "../Common/tiled_dma_copy.hpp" #include "Emu/Cell/timers.hpp" #include #include -#define DEBUG_DMA_TILING 0 - -#if DEBUG_DMA_TILING -#include "../Common/tiled_dma_copy.hpp" -#endif - namespace vk { class cached_texture_section;