Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The willing api for fixing aggregate returns #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lygstate
Copy link
Contributor

No description provided.

@lygstate lygstate changed the title The will api for struct return type The willing api for struct return type Jul 31, 2022
( (This)->lpVtbl -> GetDesc(This) )
#define ID3D12DescriptorHeap_GetDesc(This,RetVal) \
do { \
*(RetVal) = ( (This)->lpVtbl -> GetDesc(This) ) \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

as it's non-win32, maybe we can use static inline, as linux always using gcc or gcc-compat compilers.
I think support for inline is not a issue for C language

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not for mingw, it's for Linux only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with inline function, so they are very consistence now

@lygstate lygstate changed the title The willing api for struct return type The willing api for aggregate returns Aug 1, 2022
@lygstate lygstate changed the title The willing api for aggregate returns The willing api for fixing aggregate returns Aug 1, 2022
@jenatali
Copy link
Member

jenatali commented Aug 4, 2022

Using an inline function for C is slightly different compared to the macros. Specifically, this is valid with a macro but not with an inline:

ID3D12Resource1 *res;
D3D12_RESOURCE_DESC desc;
ID3D12Resource_GetDesc(res, &desc);

With the macro, that calls into ID3D12Resource1Vtbl::GetDesc, which takes an ID3D12Resource1 * as the This pointer, even though the macro name is ID3D12Resource_GetDesc. With the inline function, the type of the This pointer has to match the name of the function being called. It's minor, but it means that upgrading a C codebase from (e.g.) ID3D12Device to ID3D12Device1 or any of the other 10+ variations on the device interface need to find/replace the macros.

This is on my to-do list, to see what can be done in MIDL vs what can be done manually via helper headers externally to MIDL. Note that I'm treating this as low priority though - the important thing is that the D3D12 APIs can be invoked by the various compilers for the various platforms across C and C++ and actually work correctly, even if it requires some #ifdef soup in the calling code. At this juncture, the only real cross-platform and cross-compiler codebase is Mesa, and I expect the total number of callers who care about this to be in the single digits for the foreseeable future.

@walbourn walbourn added the enhancement New feature or request label Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants