From feb88ee6b1bedbfcfee4d5e682b3bf782cfa8a9b Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sat, 10 Aug 2024 21:33:56 +0200 Subject: [PATCH] [GPU] Check page access only once for specific range --- src/xenia/gpu/d3d12/d3d12_shared_memory.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/d3d12/d3d12_shared_memory.cc b/src/xenia/gpu/d3d12/d3d12_shared_memory.cc index 9c895abe1..6cb081241 100644 --- a/src/xenia/gpu/d3d12/d3d12_shared_memory.cc +++ b/src/xenia/gpu/d3d12/d3d12_shared_memory.cc @@ -420,7 +420,8 @@ bool D3D12SharedMemory::UploadRanges( uint32_t upload_range_length = upload_range.second; trace_writer_.WriteMemoryRead(upload_range_start << page_size_log2(), upload_range_length << page_size_log2()); - while (upload_range_length != 0) { + + if (upload_range_length > 0) { // Hacky handling for certain games (494707D4, 55530874) that crashes due // to accessing unallocated pages const uint32_t upload_range_last_page = @@ -436,7 +437,9 @@ bool D3D12SharedMemory::UploadRanges( XELOGE("Invalid upload range for GPU: {:08X}", upload_range_start); return false; } + } + while (upload_range_length != 0) { ID3D12Resource* upload_buffer; size_t upload_buffer_offset, upload_buffer_size; uint8_t* upload_buffer_mapping = upload_buffer_pool_->RequestPartial(