🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

ID3D11DeviceContext->Map hangs forever

Started by
2 comments, last by RobM 3 years, 4 months ago

Hi

I'm having a strange issue with Map on my device context. I've implemented scene picking functionality that essentially renders the scene to a texture using a shader that, for each object, renders a unique colour. I then copy that texture to a STAGING texture whereupon I Map it, read the pixel under the mouse and check the colour map.

It usually works well and is something I used heavily in my engine when it used DX9 without issue but since I've ported it across and I'm using Map, I get a strange problem whereby after a seemingly random number of selections, the Map device context method just locks up and never breaks out.

I've got critical sections around my rendering so I'm fairly certain it's not a threading issue. Just to be sure, I've switched off rendering to any other swapchains so there's only one.

Any ideas how I may be able to find out what's happening in this call? I've switched debugging on and that doesn't give me anything.

Thanks

Advertisement

Apply D3D11_MAP_FLAG_DO_NOT_WAIT if you haven't already. Also wait 2 frames between you write to the STAGING resource until you read it, if read each frame triple buffer. If neither of these things help you'll need to debug the issue further. Use D3D debug layer or https://developer.nvidia.com/nsight-aftermath​.

@undefined Thanks for the post, I tried that DONOTWAIT flag but it always returns a failed HRESULT saying the GPU is busy. I’ll try waiting for a frame or two to go past, that might work, thanks. Nothing happens in the debug layer, it just hangs on that call with nothing logged. I had put a device context flush and ClearState before it and I thought that had resolved it as I hadn’t seen it for a bit but it just happened again.

This topic is closed to new replies.

Advertisement