mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
7f0b8f3e340a92b707c8f045dc68e8fad77fadeb
693: Expose get_swap_chain_preferred_format r=kvark a=manugildev Fixes #691 This functionality was committed in gfx-rs/wgpu@6f1d614 but never exposed to `wgpu-rs`. Problem: Examples made use of `wgpu::TextureFormat::Bgra8UnormSrgb` but that's unreliable and according to the [API](https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getswapchainpreferredformat) this method is the way of properly obtaining an optimal texture format for the `SwapChain` based on the platform. - [x] Expose `get_swap_chain_preferred_format()` on Device - [x] Use `TextureFormat::Bgra8Unorm` for [web.rs](https://github.com/gfx-rs/wgpu-rs/blob/e00ef5d5842a1fcfb46bb531789b1c340bdee3ab/src/backend/web.rs#L970) - [x] Update [framework.rs](https://github.com/gfx-rs/wgpu-rs/blob/e00ef5d5842a1fcfb46bb531789b1c340bdee3ab/examples/framework.rs#L227) and examples to call this new method Co-authored-by: Manuel Gil <manugildev@gmail.com>
Languages
Rust
78.5%
WGSL
13%
GLSL
3.1%
Metal
2.8%
HLSL
2.3%
Other
0.2%