From 96933a948e2a356ad2e7375a8c1104f8b02c5a13 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Thu, 22 Sep 2022 12:12:10 +0800 Subject: [PATCH 1/2] gl: add `Rgba16Float` format support for color attachments --- wgpu-hal/src/gles/adapter.rs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 92aaf1bb13..12bfc1e25b 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -773,21 +773,29 @@ impl crate::Adapter for super::Adapter { &self, surface: &super::Surface, ) -> Option { + let mut formats = if surface.supports_srgb() { + vec![ + wgt::TextureFormat::Rgba8UnormSrgb, + #[cfg(not(target_arch = "wasm32"))] + wgt::TextureFormat::Bgra8UnormSrgb, + ] + } else { + vec![ + wgt::TextureFormat::Rgba8Unorm, + #[cfg(not(target_arch = "wasm32"))] + wgt::TextureFormat::Bgra8Unorm, + ] + }; + if self + .shared + .private_caps + .contains(super::PrivateCapabilities::COLOR_BUFFER_HALF_FLOAT) + { + formats.push(wgt::TextureFormat::Rgba16Float) + } if surface.presentable { Some(crate::SurfaceCapabilities { - formats: if surface.supports_srgb() { - vec![ - wgt::TextureFormat::Rgba8UnormSrgb, - #[cfg(not(target_arch = "wasm32"))] - wgt::TextureFormat::Bgra8UnormSrgb, - ] - } else { - vec![ - wgt::TextureFormat::Rgba8Unorm, - #[cfg(not(target_arch = "wasm32"))] - wgt::TextureFormat::Bgra8Unorm, - ] - }, + formats, present_modes: vec![wgt::PresentMode::Fifo], //TODO composite_alpha_modes: vec![wgt::CompositeAlphaMode::Opaque], //TODO swap_chain_sizes: 2..=2, From 8b68d4510bfcbabbb09a790d037bd5462f72497f Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 5 Oct 2022 17:13:25 -0400 Subject: [PATCH 2/2] Changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fd4e5348e..2db1a26843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,7 +101,7 @@ SurfaceConfiguration { and `VUID-StandaloneSpirv-Flat-04744`. By @jimblandy in [#3008](https://github.com/gfx-rs/wgpu/pull/3008) -#### Gles +#### GLES - Report vendor id for Mesa and Apple GPUs. By @i509VCB [#3036](https://github.com/gfx-rs/wgpu/pull/3036) - Report Apple M2 gpu as integrated. By @i509VCB [#3036](https://github.com/gfx-rs/wgpu/pull/3036) @@ -127,6 +127,9 @@ SurfaceConfiguration { - Use the use effective api version for determining device features instead of wrongly assuming `VkPhysicalDeviceProperties.apiVersion` is the actual version of the device. By @i509VCB in [#3011](https://github.com/gfx-rs/wgpu/pull/3011) +#### GLES +- Add `Rgba16Float` format support for color attachments. By @jinleili in [#3045](https://github.com/gfx-rs/wgpu/pull/3045) + ### Performance - Made `StagingBelt::write_buffer()` check more thoroughly for reusable memory; by @kpreid in [#2906](https://github.com/gfx-rs/wgpu/pull/2906)