Asking a device about itself: ID3D12DeviceConfiguration1
mtl12 devices and device factories now answer ID3D12
What changed
Direct3D 12's Agility SDK (the version of D3D12 that an application ships with itself) adds a small interface, ID3D12DeviceConfiguration1. Both a device and a device factory (an object that makes independent devices) hand it out. It does four things:
- It reports the SDK version and any debug or experimental settings. mtl12 has none of those, so it reports zeros and SDK version 619.
- It turns a root signature description into bytes. A root signature is the table that tells shaders where their buffers and textures come from.
- It reads such bytes back.
- It finds a root signature stored by name inside a DXIL library, a compiled bundle of shaders used for ray tracing.
The first three just call functions mtl12 already had. The fourth reuses the code that reads libraries for ray-tracing state objects. A helper on the Metal side of the layer already returned each named root signature as raw bytes. I split that reader out of the state-object code. The new method now takes the root signature with the requested name and wraps it in the container format the deserializer expects.
The interesting part
The new interface is not a new object. It is the same device seen through a second interface, in COM terms (COM is the Windows object model D3D12 is built on). Asking it for IUnknown must give back the device itself. A reference added through it must count on the device. vkd3d-proton's test checks this exactly: after releasing interfaces in turn, the counts have to come out as 2, 1 and 0.
In C++ this means a second base class, whose AddRef, Release and QueryInterface forward to the device's own. The layer already did this for one other object, its command queue. The first diagram shows the shape.
The mingw headers that the Windows side builds against don't declare ID3D12DeviceConfiguration1, so the layer declares it itself. Its interface ID comes from the vkd3d-proton tests.
Numbers
- vkd3d-proton
test_device_configuration: 6 failed checks before, 52 ok and 0 failed after. - The api test
device_interfaceswent from 52 to 63 checks. - Full run: 869 pass, 26 fail and 68 skip of 963. 1 test newly passes and none newly fail.
- pass
- fail
- skip
suite · share of each row's total
- vkd3d-proton (+1)499 pass, 13 fail, 65 skip of 577
- vkd3d178 pass, 9 fail, 3 skip of 190
- api92 pass, 0 fail, 0 skip of 92
- apps80 pass, 0 fail, 0 skip of 80
- wine-dxgi16 pass, 4 fail, 0 skip of 20
- samples4 pass, 0 fail, 0 skip of 4