Skip to content

Conversation

@TheRealMJP
Copy link

Description

Calls to ID3D12Device::CreateCommandQueue and ID3D12Device9::CreateCommandQueue1 were failing with E_NOINTERFACE when passing the IID of ID3D12CommandQueue1. The 1 version of the interface is already implemented by WrappedID3D12CommandQueue, the IID checks in the wrapped CreateCommandQueue functions were just missing the check for __uuiodof(ID3D12CommandQueue1. This PR adds the missing checks, and captures now work correctly with ID3D12CommandQueue1.

Copy link
Owner

@baldurk baldurk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this! There is one other thing needed, since we are passing the user's IID into the create function we need to be careful about handling the returned pointer. Although practically you can usually cast freely, I always make sure I do proper casts since occasionally that has bitten me in a nasty way.

If you look at CreateFence which has the same Interface + Interface1 you can see the pattern used both to make sure we explicitly cast from the requested interface to the base interface, and then back again on return after wrapping. As I say these casts are probably no-ops but I make sure they're there anyway. I think technically COM doesn't allow any casts at all but upcasts are typically safe for the real interface by C++ rules and downcasts are safe for our wrappers.

@TheRealMJP
Copy link
Author

Thanks Baldur, I appreciate the thorough explanation! I added the proper casting following CreateFence as an example, like you suggested.

@TheRealMJP TheRealMJP requested a review from baldurk January 6, 2026 03:03
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also be updated (and the same in CreateCommandQueue1) - to check the IID requested and cast to the right pointer on return. Again in principle should be the same but this can be a really nasty bug to track if for some reason it is a different pointer. E.g. it's not universally true that all IFoo1 derive from IFoo 🥲 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants