diff --git a/CHANGELOG.md b/CHANGELOG.md index 86c23ab80..bdee3da9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -101,6 +101,7 @@ Additionally `Surface::get_default_config` now returns an Option and returns Non - Surfaces support now `TextureFormat::Rgba8Unorm` and (non-web only) `TextureFormat::Bgra8Unorm`. By @Wumpf in [#3070](https://github.com/gfx-rs/wgpu/pull/3070) - Support alpha to coverage. By @Wumpf in [#3156](https://github.com/gfx-rs/wgpu/pull/3156) +- Support filtering f32 textures. By @expenses in [#3261](https://github.com/gfx-rs/wgpu/pull/3261) #### WebGPU diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 399655feb..a61d4fabe 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -421,6 +421,10 @@ impl super::Adapter { super::PrivateCapabilities::COLOR_BUFFER_FLOAT, color_buffer_float, ); + private_caps.set( + super::PrivateCapabilities::TEXTURE_FLOAT_LINEAR, + extensions.contains("OES_texture_float_linear"), + ); let max_texture_size = unsafe { gl.get_parameter_i32(glow::MAX_TEXTURE_SIZE) } as u32; let max_texture_3d_size = unsafe { gl.get_parameter_i32(glow::MAX_3D_TEXTURE_SIZE) } as u32; @@ -730,6 +734,9 @@ impl crate::Adapter for super::Adapter { | Tfc::MULTISAMPLE_RESOLVE, ); + let texture_float_linear = + private_caps_fn(super::PrivateCapabilities::TEXTURE_FLOAT_LINEAR, filterable); + match format { Tf::R8Unorm => filterable_renderable, Tf::R8Snorm => filterable, @@ -746,7 +753,7 @@ impl crate::Adapter for super::Adapter { Tf::Rg8Sint => renderable, Tf::R32Uint => renderable | storage, Tf::R32Sint => renderable | storage, - Tf::R32Float => unfilterable | storage | float_renderable, + Tf::R32Float => unfilterable | storage | float_renderable | texture_float_linear, Tf::Rg16Uint => renderable, Tf::Rg16Sint => renderable, Tf::Rg16Unorm => empty, @@ -761,7 +768,7 @@ impl crate::Adapter for super::Adapter { Tf::Rg11b10Float => filterable | float_renderable, Tf::Rg32Uint => renderable, Tf::Rg32Sint => renderable, - Tf::Rg32Float => unfilterable | float_renderable, + Tf::Rg32Float => unfilterable | float_renderable | texture_float_linear, Tf::Rgba16Uint => renderable | storage, Tf::Rgba16Sint => renderable | storage, Tf::Rgba16Unorm => empty, @@ -769,7 +776,7 @@ impl crate::Adapter for super::Adapter { Tf::Rgba16Float => filterable | storage | half_float_renderable, Tf::Rgba32Uint => renderable | storage, Tf::Rgba32Sint => renderable | storage, - Tf::Rgba32Float => unfilterable | storage | float_renderable, + Tf::Rgba32Float => unfilterable | storage | float_renderable | texture_float_linear, //Tf::Stencil8 | Tf::Depth16Unorm | Tf::Depth32Float diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index bad5c08b9..e57b05a97 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -148,6 +148,8 @@ bitflags::bitflags! { const COLOR_BUFFER_HALF_FLOAT = 1 << 8; /// Supports `f11/f10` and `f32` color buffers const COLOR_BUFFER_FLOAT = 1 << 9; + /// Supports linear flitering `f32` textures. + const TEXTURE_FLOAT_LINEAR = 1 << 10; } }