Skip to content

Commit

Permalink
Annotate missing ComOutPtr in CompositionSwapchain and `DirectCom…
Browse files Browse the repository at this point in the history
…position` (#1970)

`dcomp.h` and `Presentation.h` are missing some `_COM_Outptr_`
annotations, turning these functions in `windows-rs` to take a
meaningless `*mut *mut c_void`.  With this annotation the functions
return a generic `T: Interface` _and_ automatically pass its `&T::IID`
to the `riid` parameter resulting in a much more ergonomic API.

Also annotate some return-only functions with `RetVal` to make it easier
to retrieve these objects.
  • Loading branch information
MarijnS95 authored Aug 27, 2024
1 parent 9b34526 commit 4a93b08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions generation/WinSDK/emitter.settings.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,13 @@ IWICImagingFactory::CreateDecoderFromFilename::pguidVendor=[Optional]
DCompositionCreateDevice::dcompositionDevice=[ComOutPtr]
DCompositionCreateDevice2::dcompositionDevice=[ComOutPtr]
DCompositionCreateDevice3::dcompositionDevice=[ComOutPtr]
DCompositionGetStatistics::frameStats=[RetVal]
DCompositionGetTargetStatistics::targetStats=[RetVal]
CreatePresentationFactory::presentationFactory=[ComOutPtr]
IPresentationManager::GetPresentRetiringFence::fence=[ComOutPtr]
IDCompositionTexture::GetAvailableFence::availableFence=[ComOutPtr]
IDCompositionDevice::GetFrameStatistics::statistics=[RetVal]
IDCompositionDevice2::GetFrameStatistics::statistics=[RetVal]
HttpAddFragmentToCache::Overlapped=[In][Out][Optional][Retained]
HttpCancelHttpRequest::Overlapped=[In][Out][Optional][Retained]
HttpCreateRequestQueue::Flags=[Optional]
Expand Down
8 changes: 8 additions & 0 deletions scripts/ChangesSinceLastRelease.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Annotate ComOutPtr in CompositionSwapchain and DirectComposition
Windows.Win32.Graphics.CompositionSwapchain.Apis.CreatePresentationFactory : presentationFactory : [Out] => [ComOutPtr,Out]
Windows.Win32.Graphics.CompositionSwapchain.IPresentationManager.GetPresentRetiringFence : fence : [Out,RetVal] => [ComOutPtr,Out,RetVal]
Windows.Win32.Graphics.DirectComposition.Apis.DCompositionGetStatistics : frameStats : [Out] => [Out,RetVal]
Windows.Win32.Graphics.DirectComposition.Apis.DCompositionGetTargetStatistics : targetStats : [Out] => [Out,RetVal]
Windows.Win32.Graphics.DirectComposition.IDCompositionDevice.GetFrameStatistics : statistics : [Out] => [Out,RetVal]
Windows.Win32.Graphics.DirectComposition.IDCompositionDevice2.GetFrameStatistics : statistics : [Out] => [Out,RetVal]
Windows.Win32.Graphics.DirectComposition.IDCompositionTexture.GetAvailableFence : availableFence : [Out] => [ComOutPtr,Out]

0 comments on commit 4a93b08

Please sign in to comment.