First post, by Narzoul
I've recently upgraded to an Alder Lake CPU with an integrated GPU (UHD 770). While I was testing whether it works with DDrawCompat (it doesn't without changes, sadly), I noticed some interesting things.
First, it's not loading the usual igdumdim32.dll user-mode display driver, instead it's loading d3d9on12.dll. While debugging how this happens, I found that the call to D3DKMTQueryAdapterInfo with Type=KMTQAITYPE_UMDRIVERNAME (which is supposed to return a path to the user-mode display driver) fails with STATUS_INVALID_PARAMETER (0xC000000D). After this, the DirectDraw runtime seems to automatically fall back to loading d3d9on12.dll instead.
I looked at the inf file of the Intel driver and it seems like this would be the case for all Alder Lake S iGPUs. The installer intentionally doesn't register any D3D9 driver (even though it does still install the igdumdim32/64.dlls).
Well, that's interesting in itself, but more to the point: I'm fairly sure this could be (ab)used to load D3D9On12 in any DX 1-9 game with a very simple wrapper that hooks D3DKMTQueryAdapterInfo to reproduce the above error code for the driver path query. I tried this briefly with DDrawCompat and it worked for both AMD and NVIDIA drivers - at least in windowed mode. Exclusive full-screen mode needs more work specifically in DDrawCompat, because D3D9On12 doesn't seem to support that. It doesn't work with the DXPrimaryEmulation -DisableMaxWindowedMode shim either when using the Intel iGPU without a wrapper.
There is also a compatibility shim that can do the same already for D3D9 at least (I don't think the shim works with anything older): D3D9On12Enabler -On (the "-On" parameter is important).
I tested it very briefly with the Black & White 2 demo and it seemed to work fine. It definitely loaded d3d9on12.dll and not my usual AMD D3D9 drivers.
I wonder if this could be used to fix some compatibility issues, especially driver related ones, like the NVIDIA color key bugs, blt mirroring issues, etc.
I might put together some wrappers for this when I have some more time. Of course, this would only work on Windows 10/11.