d3d12, wgl: Fix leaks in the d3d12 winsys framebuffer
The main fix here is
d3d12: Clean up swapchains on framebuffer destruction. The commit before that (
wgl: Add a context to framebuffer destruction) makes it safe to destroy a window without unbinding the current GL context, but still lets us clean up the swapchain.
The first commit (
d3d12: Use CreateDXGIFactory2 and use the debug flag when appropriate) I thought was going to be needed for writing the unit test, since I thought the DXGI swapchain would go into the DXGI info queue list, but it turns out it goes into the D3D info queue instead. Either way, it's still good to have.
The other commits add a unit test, plus infrastructure for adding more WGL generic unit tests, or Windows driver-specific tests. This test let me confirm that the current TLS window hook stuff we're using does actually seem to work correctly, so the fact that this fix didn't work for Photoshop means that Photoshop is really (probably) leaking the window. It might be interesting to adjust the window hook eventually to not apply to every thread in the process, and instead just apply to the window's threads, but that might cause compat issues if apps try to do some crazy threading.