This program:
#include <d3d12.h>
#pragma comment(lib,"d3d12")
int main()
{
ID3D12Debug *pDebug = NULL;
D3D12GetDebugInterface(__uuidof(ID3D12Debug),(void**)&pDebug);
pDebug->EnableDebugLayer();
pDebug->Release();
ID3D12Device *pDev = NULL;
D3D12CreateDevice(NULL,D3D_FEATURE_LEVEL_12_1,__uuidof(ID3D12Device),(void**)&pDev);
ID3D12DebugDevice *pDebugDevice = NULL;
pDev->QueryInterface(&pDebugDevice);
pDev->Release();
pDebugDevice->ReportLiveDeviceObjects(D3D12_RLDO_DETAIL);
pDebugDevice->Release();
}
gives this in the debug output:
D3D12 WARNING: Live ID3D12Device at 0x000C6BA8, Refcount: 2 [ STATE_CREATION WARNING #274: LIVE_DEVICE]
D3D12 WARNING: Live ID3D12RootSignature at 0x000E62E8, Refcount: 0, IntRef: 2 [ STATE_CREATION WARNING #577: LIVE_ROOTSIGNATURE]
D3D12 WARNING: Live ID3D12PipelineState at 0x0011C3C8, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING: Live ID3D12PipelineState at 0x001421D8, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #572: LIVE_PIPELINESTATE]
D3D12 WARNING: Live ID3D12Resource at 0x00138FF8, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #575: LIVE_RESOURCE]
D3D12 WARNING: Live ID3D12Heap at 0x00144DD8, Refcount: 0, IntRef: 1 [ STATE_CREATION WARNING #579: LIVE_HEAP]
The debug device is reporting that the D3D12 device I created is still alive even after I release it. I know this is indeed true because the debug device itself is actually the only remaining referrer that is keeping the D3D12 device alive, but that is not a leak from my perspective, as I have correctly released my D3D12 device. This is just pollution to my program's output giving the false indication that I have a bug in my code.
My question is: am I indeed doing something wrong here? or is it a bad behavior in how reporting works in the D3D12 debug device? Any ideas on how to solve it?
Thanks!