Greetings,
In order to better understand internals I want to create a demo application where the user can change adapters, resolutions, monitors runtime. And I immediately encountered a problem. When I create a device second time (after adapter change) I can't create a swap chain. I receive an error:
E_ACCESSDENIED General access denied error.
that makes not a lot of sense. Debug log tells me:
Microsoft C++ exception: _com_error at memory location 0x002DDE84.
This looks not like a d3d error.
After some investigation I found that this error happens if I don't clear resources (vertex buffer, for example). I'm using a ComPtr for storing all d3d interfaces. The funny thing - I'm not using this resource at all! I just created it and forgot (actually, not forgot - I'm clearing it and creating it once more after the swap chain creation). So why I have this error? Who use this resource if not me and why? Why I should clear it exactly before a swap chain creation?