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.
This commit is contained in:
parent
dd790abab0
commit
0e9a6759f9
|
@ -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) {
|
void MemoryManager::CopyBlock(GPUVAddr gpu_dest_addr, GPUVAddr gpu_src_addr, std::size_t size) {
|
||||||
std::vector<u8> tmp_buffer(size);
|
std::vector<u8> tmp_buffer(size);
|
||||||
ReadBlock(gpu_src_addr, tmp_buffer.data(), 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);
|
WriteBlock(gpu_dest_addr, tmp_buffer.data(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue