diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 2738345b9..28f974841 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -252,6 +252,11 @@ namespace dxvk { break; } + if (memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT && m_device->GetOptions()->apitraceMode) { + memoryFlags |= VK_MEMORY_PROPERTY_HOST_COHERENT_BIT + | VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + } + return memoryFlags; } diff --git a/src/d3d11/d3d11_options.cpp b/src/d3d11/d3d11_options.cpp index 6f5e3ed35..063a2e6b9 100644 --- a/src/d3d11/d3d11_options.cpp +++ b/src/d3d11/d3d11_options.cpp @@ -17,6 +17,18 @@ namespace dxvk { this->numBackBuffers = config.getOption("dxgi.numBackBuffers", 0); this->maxFrameLatency = config.getOption("dxgi.maxFrameLatency", 0); this->syncInterval = config.getOption("dxgi.syncInterval", -1); + + bool apitraceAttached = false; + #ifndef __WINE__ + apitraceAttached = ::GetModuleHandle("dxgitrace.dll") != nullptr; + #endif + + this->apitraceMode = config.getOption("d3d11.apitraceMode", apitraceAttached); + + // Inform user in case they have the option enabled or a game + // ships a file called dxgitrace.dll for whatever reason. + if (this->apitraceMode) + Logger::warn("D3D11: Apitrace mode enabled, may affect performance!"); } } \ No newline at end of file diff --git a/src/d3d11/d3d11_options.h b/src/d3d11/d3d11_options.h index c87d5a058..bce2d25e7 100644 --- a/src/d3d11/d3d11_options.h +++ b/src/d3d11/d3d11_options.h @@ -76,6 +76,10 @@ namespace dxvk { /// fixes issues with games that create multiple swap chains /// for a single window that may interfere with each other. bool deferSurfaceCreation; + + /// Apitrace mode: Maps all buffers in cached memory. + /// Enabled automatically if dxgitrace.dll is attached. + bool apitraceMode; }; } \ No newline at end of file