baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.6k stars 1.3k forks source link

Crash on D3D12 Command Queue Creation while DLL is Loaded #3366

Closed jkunstwald closed 1 week ago

jkunstwald commented 1 week ago

Description

renderdoc.dll crashes when the host application calls ID3D12Device::CreateCommandQueue. It crashes in GpuBufferAllocator::Alloc because this is null, which apparently is never set or subject to a race condition. This same application works fine either when not loading renderdoc, or with renderdoc 1.32 (and all versions before that which i tried).

image

Steps to reproduce

I can share a crashdump privately (and an application with some extra work), please just contact me. Fundamentally:

  1. Load renderdoc.dll programatically and initialize properly, or launch host application via GUI
  2. Initialize D3D12, eventually create a command queue

One thing to note about this setup, the host application initializes D3D12 in a multithreaded manner. Thread A creates the device, then after that, thread B creates queues and thread C allocates command lists:

image

Environment

baldurk commented 1 week ago

Can you test this with a recent nightly build? I believe this was a bug in v1.33 which would break if you did something like:

  1. Create D3D12 Device A
  2. Create D3D12 Device B
  3. Destroy either device, and use the other

Instead it would only work if the create/destroys were 'matched' or if there were only one device created. That bug has been fixed since v1.33 in nightly builds.

Otherwise yes I need a reproducible test case, as it's definitely not the case that all D3D12 command queue creation will crash.

jkunstwald commented 1 week ago

The nightly fixes it, thank you!