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

Revert [RetVal] annotation for multi-output DCompositionGetStatistics() #1980

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

MarijnS95
Copy link
Contributor

For #1970 (comment)

This function returns multiple values via multiple mutable pointer arguments, besides the annotated frameStats parameter not being the last parameter.

Revert it because it has no effect on windows-rs and could even break in the future, because it's not intended to be used this way.

@@ -986,7 +986,6 @@ IWICImagingFactory::CreateDecoderFromFilename::pguidVendor=[Optional]
DCompositionCreateDevice::dcompositionDevice=[ComOutPtr]
DCompositionCreateDevice2::dcompositionDevice=[ComOutPtr]
DCompositionCreateDevice3::dcompositionDevice=[ComOutPtr]
DCompositionGetStatistics::frameStats=[RetVal]
DCompositionGetTargetStatistics::targetStats=[RetVal]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
DCompositionGetTargetStatistics::targetStats=[RetVal]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disagreed. #1970 (comment).

Copy link
Collaborator

@riverar riverar Aug 29, 2024

Choose a reason for hiding this comment

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

This attribute wasn't initially designed for functions, but if all projection owners concur, we can retain it. Typically, this type of discussion occurs before a PR for more thorough consideration beyond a single API test, but since we're already here...

@kennykerr @AArnott The proposal here is to start using the [RetVal] attribute on function parameters--not just method parameters. As a reminder, this attribute enables projections to generate code with improved ergonomics, where the HRESULT is handled internally, and the return value of the function is represented by the parameter marked with [RetVal].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @riverar. Since we're generating "the same" syntactic sugar for functions as we are for methods, it seems to make sense to have it here.

There are only a handful of [RetVal] annotations in emitter.settings.rsp currently though.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with using that attribute on functions too. And it seems safe enough for projections to ignore until they decide to do the work to support it.

Copy link
Contributor Author

@MarijnS95 MarijnS95 Aug 29, 2024

Choose a reason for hiding this comment

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

On a separate note, it looks like the header has a broken name for the count field:

STDAPI DCompositionGetStatistics(
    _In_ COMPOSITION_FRAME_ID frameId,
    _Out_ COMPOSITION_FRAME_STATS* frameStats,
    _In_ UINT targetIdCount,
    _Out_writes_opt_(targetCount) COMPOSITION_TARGET_ID* targetIds,
    _Out_opt_ UINT* actualTargetIdCount);

s/targetCount/targetIdCount :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

And folks keep trying to convince me SAL is used/tested internally. 😜

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Confusingly actualTargetIdCount also has to do with this :)

@MarijnS95 MarijnS95 force-pushed the revert-retval branch 2 times, most recently from 22a67bd to 2ef4c6a Compare September 3, 2024 20:15
@MarijnS95 MarijnS95 requested a review from riverar September 3, 2024 20:15
scripts/ChangesSinceLastRelease.txt Outdated Show resolved Hide resolved
scripts/ChangesSinceLastRelease.txt Outdated Show resolved Hide resolved
…ics()`

This function returns multiple values via multiple mutable pointer
arguments, besides the annotated `frameStats` parameter not being the
last parameter.

Revert it because it has no effect on `windows-rs` and could even
break in the future, because it's not intended to be used this way.
@mikebattista
Copy link
Collaborator

Seems reasonable to me if it adds value for projections that choose to honor it.

mikebattista
mikebattista previously approved these changes Sep 9, 2024
@mikebattista mikebattista merged commit ef51ef9 into microsoft:main Sep 9, 2024
1 check passed
@MarijnS95 MarijnS95 deleted the revert-retval branch September 9, 2024 17:00
@riverar
Copy link
Collaborator

riverar commented Sep 9, 2024

@mikebattista I don't think this merged correctly or was ready for merge. Am only seeing a .txt file change?

@mikebattista
Copy link
Collaborator

I see that too even though there was an emitter settings change as well. I'll fix it.

mikebattista added a commit that referenced this pull request Sep 9, 2024
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.

4 participants