Skip to content

Commit 6147c91

Browse files
authored
Support OES_texture_float_linear in webgl (#3261)
closes #3215
1 parent 9cc0ff1 commit 6147c91

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Additionally `Surface::get_default_config` now returns an Option and returns Non
101101

102102
- Surfaces support now `TextureFormat::Rgba8Unorm` and (non-web only) `TextureFormat::Bgra8Unorm`. By @Wumpf in [#3070](https://github.com/gfx-rs/wgpu/pull/3070)
103103
- Support alpha to coverage. By @Wumpf in [#3156](https://github.com/gfx-rs/wgpu/pull/3156)
104+
- Support filtering f32 textures. By @expenses in [#3261](https://github.com/gfx-rs/wgpu/pull/3261)
104105

105106
#### WebGPU
106107

wgpu-hal/src/gles/adapter.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ impl super::Adapter {
421421
super::PrivateCapabilities::COLOR_BUFFER_FLOAT,
422422
color_buffer_float,
423423
);
424+
private_caps.set(
425+
super::PrivateCapabilities::TEXTURE_FLOAT_LINEAR,
426+
extensions.contains("OES_texture_float_linear"),
427+
);
424428

425429
let max_texture_size = unsafe { gl.get_parameter_i32(glow::MAX_TEXTURE_SIZE) } as u32;
426430
let max_texture_3d_size = unsafe { gl.get_parameter_i32(glow::MAX_3D_TEXTURE_SIZE) } as u32;
@@ -730,6 +734,9 @@ impl crate::Adapter<super::Api> for super::Adapter {
730734
| Tfc::MULTISAMPLE_RESOLVE,
731735
);
732736

737+
let texture_float_linear =
738+
private_caps_fn(super::PrivateCapabilities::TEXTURE_FLOAT_LINEAR, filterable);
739+
733740
match format {
734741
Tf::R8Unorm => filterable_renderable,
735742
Tf::R8Snorm => filterable,
@@ -746,7 +753,7 @@ impl crate::Adapter<super::Api> for super::Adapter {
746753
Tf::Rg8Sint => renderable,
747754
Tf::R32Uint => renderable | storage,
748755
Tf::R32Sint => renderable | storage,
749-
Tf::R32Float => unfilterable | storage | float_renderable,
756+
Tf::R32Float => unfilterable | storage | float_renderable | texture_float_linear,
750757
Tf::Rg16Uint => renderable,
751758
Tf::Rg16Sint => renderable,
752759
Tf::Rg16Unorm => empty,
@@ -761,15 +768,15 @@ impl crate::Adapter<super::Api> for super::Adapter {
761768
Tf::Rg11b10Float => filterable | float_renderable,
762769
Tf::Rg32Uint => renderable,
763770
Tf::Rg32Sint => renderable,
764-
Tf::Rg32Float => unfilterable | float_renderable,
771+
Tf::Rg32Float => unfilterable | float_renderable | texture_float_linear,
765772
Tf::Rgba16Uint => renderable | storage,
766773
Tf::Rgba16Sint => renderable | storage,
767774
Tf::Rgba16Unorm => empty,
768775
Tf::Rgba16Snorm => empty,
769776
Tf::Rgba16Float => filterable | storage | half_float_renderable,
770777
Tf::Rgba32Uint => renderable | storage,
771778
Tf::Rgba32Sint => renderable | storage,
772-
Tf::Rgba32Float => unfilterable | storage | float_renderable,
779+
Tf::Rgba32Float => unfilterable | storage | float_renderable | texture_float_linear,
773780
//Tf::Stencil8 |
774781
Tf::Depth16Unorm
775782
| Tf::Depth32Float

wgpu-hal/src/gles/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ bitflags::bitflags! {
148148
const COLOR_BUFFER_HALF_FLOAT = 1 << 8;
149149
/// Supports `f11/f10` and `f32` color buffers
150150
const COLOR_BUFFER_FLOAT = 1 << 9;
151+
/// Supports linear flitering `f32` textures.
152+
const TEXTURE_FLOAT_LINEAR = 1 << 10;
151153
}
152154
}
153155

0 commit comments

Comments
 (0)