gl: add Rgba16Float format support for color attachments (#3045)

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
This commit is contained in:
Jinlei Li 2022-10-06 05:31:22 +08:00 committed by GitHub
parent 4992de5938
commit b13bb468cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 14 deletions

View File

@ -104,7 +104,7 @@ SurfaceConfiguration {
- Fix bug where the Vulkan backend would panic when using a supported window and display handle but the
dependent extensions are not available by @i509VCB in [#3054](https://github.com/gfx-rs/wgpu/pull/3054).
#### 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)
@ -131,6 +131,7 @@ SurfaceConfiguration {
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)
- `TEXTURE_COMPRESSION_ASTC_HDR` feature detection by @jinleili in [#3042](https://github.com/gfx-rs/wgpu/pull/3042)
### Performance

View File

@ -785,9 +785,7 @@ impl crate::Adapter<super::Api> for super::Adapter {
&self,
surface: &super::Surface,
) -> Option<crate::SurfaceCapabilities> {
if surface.presentable {
Some(crate::SurfaceCapabilities {
formats: if surface.supports_srgb() {
let mut formats = if surface.supports_srgb() {
vec![
wgt::TextureFormat::Rgba8UnormSrgb,
#[cfg(not(target_arch = "wasm32"))]
@ -799,7 +797,17 @@ impl crate::Adapter<super::Api> for super::Adapter {
#[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,
present_modes: vec![wgt::PresentMode::Fifo], //TODO
composite_alpha_modes: vec![wgt::CompositeAlphaMode::Opaque], //TODO
swap_chain_sizes: 2..=2,