I am attempting to use ID3DUserDefinedAnnotation to visualize regions of calls in RenderDoc. When I use it though I will always get resource leaks at the application. The call to QueryInterface always succeeds but according to the documentation BeginEvent will return -1 when not running under a Direct3D profiling tool. When I run in RenderDoc I see my regions so I believe it is working, although I am not sure how to view the output log from RenderDoc so I do not know if I am leaking resources there. I verified that when I create my device I am using D3D_FEATURE_LEVEL_11_1 and D3D11_CREATE_DEVICE_DEBUG
How could I have my running application not always report live objects when using ID3DUserDefinedAnnotation? Do applications such as RenderDoc set a special configuration flag that I can set?
Even a simple example such as this will trigger reporting live objects
ID3DUserDefinedAnnotation* Annotation;
HRESULT hr = m_pD3D11DeviceContext->QueryInterface(__uuidof(ID3DUserDefinedAnnotation), (void **)&Annotation);
//HRESULT hr = m_pD3D11DeviceContext->QueryInterface(IID_PPV_ARGS(&Annotation));
if(FAILED(hr))
return -1;
UINT code = Annotation->BeginEvent(L"TestEvent");
if(code == -1)
return -1;
code = Annotation->EndEvent();
if(code == -1)
return -1;
return 0;
My output log will have this, where I think 146 is the number of frames that has been called with this running. When I remove the code mentioned above then there are no resources still in use
D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x04EF42D4, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x04E92BF8, Refcount: 146. [ STATE_CREATION WARNING #0: UNKNOWN]