Repository navigation
Conversation
The device answers QueryInterface for ID3D12Device and its newer levels (1-8 and 11, the last what Grand Theft Auto VI creates). Its children's GetDevice (queues, lists, resources, heaps, fences, query heaps, root signatures) and the DXGI device's QueryInterface only took the first: asking them for the ID3D12Device11 the title holds gave E_NOINTERFACE and a null pointer, though it is the same object. Both now use the device's own test for its interfaces.
Contributor
Author
|
Closing as a duplicate of #249, which makes the same change (with broader tests) and was opened first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's wrong
The D3D12 device answers
QueryInterfaceforID3D12Deviceand for its newer levels (device::LEVEL_IIDS: 1–8 and 11).ID3D12Device11is the one Grand Theft Auto VI creates. Two other places hand out the same device object, but each accepts only the first IID:object::parent_device:ID3D12DeviceChild::GetDevicefor every device child (command queues, command lists and allocators, resources, heaps, descriptor heaps, fences, query heaps, root and command signatures).dxgi::device_query: the DXGI device'sQueryInterface, which "also answers for the D3D12 device".So a title that holds an
ID3D12Device11and asks one of its objects for it getsE_NOINTERFACEand a null pointer:The
GetDevicedocs only ask for "the GUID for the device interface". COM'sQueryInterfacerules also require that an object reachable through one interface answers for every interface it has. WithIID_PPV_ARGS(&device11)the failure ends in a null dereference in the title.What the fix does
device::is_device, the device's own check for its interfaces (base IID and every level), becomespub(crate).parent_deviceanddxgi::device_querynow use it instead of comparing against the base IID only.How it behaves after the fix
GetDeviceon any device child, andQueryInterfaceon the DXGI device, return the device for any interface level the device itself answers:ID3D12Device,ID3D12Device1–8orID3D12Device11. Other IIDs still getE_NOINTERFACE.Tests
The new test
children_and_the_dxgi_device_give_every_device_level(indevice.rs):GetDevice(slot0x38) forID3D12Device,ID3D12Device1andID3D12Device11;QueryInterface(slot 0) for the same three IIDs.Each call must return
S_OKand the device.I ran
cargo test --workspaceon GitHub'swindows-latestwith Rust 1.98.1 fromrust-toolchain.toml:victory-gpuhas 44 passed (1 ignored), the other crates have 0 failed.main: it fails on the fence's firstGetDevicewith a device level:left: -2147467262(E_NOINTERFACE),right: 0.--test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (Tests: victory-shader tests crash (0xC0000005) when several tests use WARP devices in parallel #181, Shaders: share and serialize WARP host operations across threads #244).Not tested: the title's own
GetDevicecalls.Not in this PR: none of these objects answers
IUnknown. That's a separate identity question, and nothing shows a title asking for it.