diff --git a/host/platform/Windows/capture/DXGI/src/d3d12.c b/host/platform/Windows/capture/DXGI/src/d3d12.c index 4968cda0..75089aca 100644 --- a/host/platform/Windows/capture/DXGI/src/d3d12.c +++ b/host/platform/Windows/capture/DXGI/src/d3d12.c @@ -23,6 +23,7 @@ #include #include #include "common/debug.h" +#include "common/option.h" #include "common/windebug.h" #define ALIGN_TO(value, align) (((value) + (align) - 1) & -(align)) @@ -40,6 +41,7 @@ struct D3D12Texture struct D3D12Backend { + int copySleep; ID3D12Device * device; ID3D12CommandQueue * commandQueue; ID3D12Resource * src; @@ -84,6 +86,9 @@ static bool d3d12_create(struct DXGIInterface * intf) return false; } + this->copySleep = option_get_int("dxgi", "d3d12CopySleep"); + DEBUG_INFO("Sleep before copy : %d ms", this->copySleep); + status = D3D12CreateDevice((IUnknown *) dxgi->adapter, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&this->device); @@ -277,6 +282,9 @@ static bool d3d12_copyFrame(Texture * parent, ID3D11Texture2D * src) IDXGIResource1 * res1 = NULL; HRESULT status; + if (this->copySleep > 0) + Sleep(this->copySleep); + status = ID3D11Texture2D_QueryInterface(src, &IID_IDXGIResource1, (void **)&res1); if (FAILED(status)) { diff --git a/host/platform/Windows/capture/DXGI/src/dxgi.c b/host/platform/Windows/capture/DXGI/src/dxgi.c index 694192a7..3b9fd771 100644 --- a/host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/host/platform/Windows/capture/DXGI/src/dxgi.c @@ -120,6 +120,13 @@ static void dxgi_initOptions(void) .type = OPTION_TYPE_BOOL, .value.x_bool = false }, + { + .module = "dxgi", + .name = "d3d12CopySleep", + .description = "Milliseconds to sleep before copying frame with d3d12", + .type = OPTION_TYPE_INT, + .value.x_int = 5 + }, {0} };