Support OES_texture_float_linear in webgl (#3261)

closes https://github.com/gfx-rs/wgpu/issues/3215
This commit is contained in:
Ashley authored and GitHub committed 2022-12-05 12:58:06 -05:00
1 parent 9cc0ff1cd5
commit 6147c91818
3 files changed
+13 -3

No files matched your search

+1
View File
@@ -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
+10 -3
View File
@@ -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<super::Api> 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<super::Api> 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<super::Api> 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<super::Api> 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
+2
View File
@@ -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;
}
}