From 3d9230ac93dd06ed1a5b3bb600b4516100eb21bd Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 29 Dec 2017 07:15:59 +1100 Subject: [PATCH] [host] dxgi: fixed frame update regression --- host/Capture/DXGI.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/host/Capture/DXGI.cpp b/host/Capture/DXGI.cpp index 6572e8bb..a4c6917d 100644 --- a/host/Capture/DXGI.cpp +++ b/host/Capture/DXGI.cpp @@ -416,10 +416,6 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) return GRAB_STATUS_ERROR; } - TRACE_START("DXGI Memory Copy"); - // wake up the copy threads - m_memcpy.Wake(); - ID3D11Texture2DPtr src(res); res.Release(); if (!src) @@ -431,6 +427,12 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) m_deviceContext->CopyResource(m_texture, src); src.Release(); + if (m_surfaceMapped) + { + m_deviceContext->Unmap(m_texture, 0); + m_surfaceMapped = false; + } + status = m_deviceContext->Map(m_texture, 0, D3D11_MAP_READ, 0, &m_mapping); if (FAILED(status)) { @@ -440,6 +442,10 @@ GrabStatus DXGI::GrabFrame(FrameInfo & frame) } m_surfaceMapped = true; + TRACE_START("DXGI Memory Copy"); + // wake up the copy threads + m_memcpy.Wake(); + frame.width = m_width; frame.height = m_height; frame.pitch = m_mapping.RowPitch;