Hello, everyone,
let me share a weird bug with you and hope, that someone can help me deal with it.
I've just started a new project using DirectX11 and this bug wouldn't let me move any further than a blank screen. What happens is when the program is terminating it either crashes (if I run the executable) or says it has triggered a breakpoint (if run in a debugger). After the breakpoint I'm able to continue and the program terminates with the following output:
blocks.exe has triggered a breakpoint.
'blocks.exe' (Win32): Unloaded 'C:\Windows\System32\nvwgf2umx.dll'
'blocks.exe' (Win32): Unloaded 'C:\Windows\System32\psapi.dll'
The thread 0x1e8c has exited with code 0 (0x0).
D3D11 WARNING: Live child object (0x0000000004E89D50, RefCount=1) with no live parent (0x000000000031BAD8). [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live child object (0x0000000004E8A1B0, RefCount=1) with no live parent (0x000000000031BAD8). [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live child object (0x0000000004EA79C0, RefCount=1) with no live parent (0x000000000031BAD8). [ STATE_CREATION WARNING #0: UNKNOWN]
The program '[7880] blocks.exe' has exited with code 0 (0x0).
Renderer::~Renderer()
{
ID3D11Debug* DebugDevice = nullptr;
device_->QueryInterface(__uuidof(ID3D11Debug), (void**)(&DebugDevice));
RELEASE( defaultRasterizerState_ );
RELEASE( backBufferView_ );
RELEASE( swapChain_ );
RELEASE( context_ );
RELEASE( device_ );
DebugDevice->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL);
RELEASE(DebugDevice);
}
Through a bit of experimenting I found out, that all the following conditions must be met, for the error to occur:
1) DirectX Debug Layer is enabled (I guess, the problem still persists when it's not, there's just no one to break),
2) Fraps overlay is enabled,
3) The swapchain is created with multisampling turned on.
Using ReportLiveDeviceObjects() I learned, that there are indeed live objects at the specified addresses, and they are ID3D11InputLayout, ID3D11VertexShader and ID3D11PixelShader. I'm not creating those (the program only clears the back buffer and presents it to the screen), and I made sure to release my objects.
My guess is that these are the shaders and the input layout Fraps uses to draw its frame counter, and for some reason it fails to cleanup after itself. I wonder, what does it have to do with multisampling, though? When it is disabled, no live objects are reported.
Well, this one's getting a bit long, sorry for that:) I guess I'll try to reproduce the bug with a clean/minimal program, and meanwhile, if someone has any ideas on why does it happen or how to fix it, I'd greatly appreciate any help!