瀏覽代碼

video_core/memory_manager: Flush destination buffer on CopyBlock

When we copy into a buffer, it might contain data modified from the GPU
on the same pages. Because of this, we have to flush the contents before
writing new data.

An alternative approach would be to write the data in place, but games
can also write data in other ways, invalidating our contents.

Fixes geometry in Zombie Panic in Wonderland DX.
ReinUsesLisp 5 年之前
父節點
當前提交
0e9a6759f9
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/video_core/memory_manager.cpp

+ 4 - 0
src/video_core/memory_manager.cpp

@@ -332,6 +332,10 @@ void MemoryManager::FlushRegion(GPUVAddr gpu_addr, size_t size) const {
 void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size) {
     std::vector<u8> tmp_buffer(size);
     ReadBlock(gpu_src_addr, tmp_buffer.data(), size);
+
+    // The output block must be flushed in case it has data modified from the GPU.
+    // Fixes NPC geometry in Zombie Panic in Wonderland DX
+    FlushRegion(gpu_dest_addr, size);
     WriteBlock(gpu_dest_addr, tmp_buffer.data(), size);
 }