d3d12, util: Fix wgl unit test
- The wgl unit test was broken after the introduction of the device factory stuff, since that test relies on using the same device in the test code and in the driver. So this MR adds a debug flag to revert to the old behavior.
- But trying to set that debug flag in the test doesn't work if Mesa statically links the CRT, since the test and the driver then end up with different cached environment state. Since Mesa's already going to cache environment state, just remove the Windows calls to
getenv
and go to the Win32 API directly. Then we see the results of theputenv
even if it happens after initializing the driver. - The test for context reset was regressed at some point because winsys cleanup is happening in the wrong cleanup helper, so fix those too.