diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index 9e549d19b..26b14c1fa 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -49,6 +49,10 @@ DEFINE_bool(d3d12_submit_on_primary_buffer_end, true, "Submit the command list when a PM4 primary buffer ends if it's " "possible to submit immediately to try to reduce frame latency.", "D3D12"); +DEFINE_bool(d3d12_clear_memory_page_state, false, + "Refresh state of memory pages to enable gpu written data. (Use " + "for 'Team Ninja' Games to fix missing character models)", + "D3D12"); namespace xe { namespace gpu { @@ -3008,6 +3012,9 @@ bool D3D12CommandProcessor::EndSubmission(bool is_swap) { } if (is_closing_frame) { + if (cvars::d3d12_clear_memory_page_state) { + shared_memory_->SetSystemPageBlocksValidWithGpuDataWritten(); + } // Close the capture after submitting. if (pix_capturing_) { IDXGraphicsAnalysis* graphics_analysis = provider.GetGraphicsAnalysis(); diff --git a/src/xenia/gpu/shared_memory.cc b/src/xenia/gpu/shared_memory.cc index c7c5c9c19..89743b71c 100644 --- a/src/xenia/gpu/shared_memory.cc +++ b/src/xenia/gpu/shared_memory.cc @@ -103,12 +103,13 @@ void SharedMemory::ClearCache() { delete[] pool; } watch_range_pools_.clear(); + SetSystemPageBlocksValidWithGpuDataWritten(); +} - { - auto global_lock = global_critical_region_.Acquire(); - for (SystemPageFlagsBlock& block : system_page_flags_) { - block.valid = block.valid_and_gpu_written; - } +void SharedMemory::SetSystemPageBlocksValidWithGpuDataWritten() { + auto global_lock = global_critical_region_.Acquire(); + for (SystemPageFlagsBlock& block : system_page_flags_) { + block.valid = block.valid_and_gpu_written; } } diff --git a/src/xenia/gpu/shared_memory.h b/src/xenia/gpu/shared_memory.h index 75d98f143..8fdb1af45 100644 --- a/src/xenia/gpu/shared_memory.h +++ b/src/xenia/gpu/shared_memory.h @@ -32,6 +32,7 @@ class SharedMemory { virtual ~SharedMemory(); // Call in the implementation-specific ClearCache. virtual void ClearCache(); + virtual void SetSystemPageBlocksValidWithGpuDataWritten(); typedef void (*GlobalWatchCallback)( const std::unique_lock& global_lock, void* context,