Skip to content

Commit

Permalink
gl: add Rgba16Float format support for color attachments (#3045)
Browse files Browse the repository at this point in the history
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
  • Loading branch information
jinleili and cwfitzgerald committed Oct 5, 2022
1 parent 4992de5 commit b13bb46
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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)

Expand All @@ -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
Expand Down
34 changes: 21 additions & 13 deletions wgpu-hal/src/gles/adapter.rs
Expand Up @@ -785,21 +785,29 @@ impl crate::Adapter<super::Api> for super::Adapter {
&self,
surface: &super::Surface,
) -> Option<crate::SurfaceCapabilities> {
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,
Expand Down

0 comments on commit b13bb46

Please sign in to comment.