1

I'm doing desktop capturing in a loop with DXGI. In that I call this function in loop.

dxgiSurface1->Map(&map, DXGI_MAP_READ)  

But sometimes map.pBits is null. I cannot figure out at what time. It's like random times. If I increase the Sleep() time in the loop it's not become null. Please tell me the reason...

ivpavici
  • 1,117
  • 2
  • 19
  • 30
  • Where does `dxgiSurface1` come from? By "desktop capturing" do you mean you're using [DDA](https://msdn.microsoft.com/en-us/library/windows/desktop/hh404487(v=vs.85).aspx)? – MooseBoys Feb 19 '16 at 00:15
  • When I use Sleep(1000) before IDXGIOutputDuplication::AcquireNextFrame function it works fine. But if the time value of Sleep() is small (eg : Sleep(10) ) ,then map.pBits doesn't get correct values. – Ishara Somathilaka Feb 23 '16 at 05:13
  • Do you check the HRESULT returned from Map? The GPU may already be accessing the surface when you make the call, preventing you from accessing the memory concurrently. – Alex Jun 25 '18 at 21:19

0 Answers0