I’m trying to use Nsight to profile and optimize a project I’m working on, but I’m consistently getting a crash inside the Nsight DLLS that are intercepting the D3D11 API calls. Specifically, it’s crashing trying to unmap a buffer that is a staging resource that had data copied to it last frame. The data is being created by a compute shader. It’s very rare, but this same crash also seems to happen on other coworkers’ machines (who are just running the game normally, without Nsight), but not with any sort of consistency. I’ve run with D3D’s debug layer and it doesn’t report any API misuse, so I’m at a loss about how to fix this. If I comment out the buffer copy the crash goes away, but obviously so does the data it was calculating for me! :)
Here’s the call stack of the crash (function names removed as per NDA); the function at the very bottom is just calling ID3D11DeviceContext::Unmap() through our wrapper:
EXCEPTION_ACCESS_VIOLATION: Read of address 0x0000000000000378
Nvda.Graphics.Interception.dll!000007feec7830a0() [CreateNexusExperiment + 0xB100] Nvda.Graphics.Interception.dll!000007feebda1a6c() [GraphicsInterceptionDummy + 0x1EBCBC] Nvda.Graphics.Interception.dll!000007feebda15ab() [GraphicsInterceptionDummy + 0x1EB7FB] Nvda.Graphics.Interception.dll!000007feebd9e4b5() [GraphicsInterceptionDummy + 0x1E8705] Nvda.Graphics.Interception.dll!000007feebd50af3() [GraphicsInterceptionDummy + 0x19AD43] Nvda.Graphics.Interception.dll!000007feebd43449() [GraphicsInterceptionDummy + 0x18D699] ****.exe!****::DeviceContext::UnmapBuffer(****::Buffer * pBuffer)
Interestingly, 0x378 is almost the exact size of the buffer I’m mapping!
Is there maybe some “gotcha” about the way I’m using the compute shader to fill the buffer and then how I’m copying it to the staging resource or something that can cause problems like this? I can go into more detail about what I’m doing if it would help.