Skip to content

Add Windows IDCompositionVisual and its HANDLE? #172

@MarijnS95

Description

@MarijnS95

After working on wgpu's Dx12 backend some, two new "drawble" handle types showed up in https://docs.rs/wgpu/latest/x86_64-pc-windows-msvc/wgpu/enum.SurfaceTargetUnsafe.html: IDCompositionVisual and the (badly named and badly documented) SurfaceHandle which really is a HANDLE created from DCompositionCreateSurfaceHandle() (and represents an IDCompositionSurface via CreateSurfaceFromHandle()). The HANDLE allows this surface to be shared and rendered to across process boundaries.

Should we add some enum variants to wrap these types?

Note that in wgpu, IDCompositionVisual is used to set a swapchain to be its content via visual.SetContent(swap_chain).
For the HANDLE IDXGIFactoryMedia::CreateSwapChainForCompositionSurfaceHandle() is used which is documented to create a YUV swapchain as if it is specifically designed for media, but it seems to work fine to raster triangles into using an RGB format?

Finally, the https://learn.microsoft.com/en-us/windows/win32/api/presentation/nn-presentation-ipresentationsurface API also seems to support receiving composition surface HANDLEs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions