Set system page blocks to gpu-written every frame

This commit is contained in:
Gliniak 2022-02-02 14:03:10 +01:00
parent ba60b94c7d
commit 620aa3562e
3 changed files with 14 additions and 5 deletions

View File

@ -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();

View File

@ -103,13 +103,14 @@ void SharedMemory::ClearCache() {
delete[] pool;
}
watch_range_pools_.clear();
SetSystemPageBlocksValidWithGpuDataWritten();
}
{
void SharedMemory::SetSystemPageBlocksValidWithGpuDataWritten() {
auto global_lock = global_critical_region_.Acquire();
for (SystemPageFlagsBlock& block : system_page_flags_) {
block.valid = block.valid_and_gpu_written;
}
}
}
SharedMemory::GlobalWatchHandle SharedMemory::RegisterGlobalWatch(

View File

@ -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<std::recursive_mutex>& global_lock, void* context,