mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-14 11:21:40 +00:00
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>
21 lines
760 B
Markdown
21 lines
760 B
Markdown
# 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`.
|