dawn-cmake/docs/dawn/features/surface_capabilities.md
Le Hoang Quyen 335573116c Add Device::GetSupportedSurfaceUsage() method.
This method will return supported usage flags that can be used to create
a swap chain.

Bug: dawn:1760
Change-Id: I7699c2c4ef7142c6bd06e72239d6e4f9112f15a3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127440
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
2023-04-20 20:42:05 +00:00

760 B

Surface Capabilities

The surface-capabilities feature allows querying a surface's capabilities and creating a swap chain with additional usage flags.

Additional functionality:

  • Adds wgpu::Device::GetSupportedSurfaceUsage(wgpu::Surface) method for querying the surface's supported usage flags. One or the combination of these flags can be used to create a swap chain.

Example Usage:

wgpu::TextureUsage supportedUsage = device.GetSupportedSurfaceUsage(surface);

wgpu::SwapChainDescriptor desc = {};
// set usage flags.
desc.usage = supportedUsage;

device.CreateSwapChain(surface, &desc);

Notes:

  • If this feature is not enabled, only wgpu::TextureUsage::RenderAttachment flag is allowed to be used in wgpu::SwapChainDescriptor::usage.