From df50028e49e1448b56ce71f7904921a95c15594c Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 24 Feb 2022 00:23:55 -0500 Subject: [PATCH] Fix up some downlevel capabilities --- wgpu-core/src/resource.rs | 2 +- wgpu-hal/src/gles/adapter.rs | 1 - wgpu-types/src/lib.rs | 31 ++++++++++++++++++------------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 95bf121833..f970cd1028 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -309,7 +309,7 @@ pub enum CreateTextureError { InvalidFormatUsages(wgt::TextureUsages, wgt::TextureFormat), #[error("Texture usages {0:?} are not allowed on a texture of dimensions {1:?}")] InvalidDimensionUsages(wgt::TextureUsages, wgt::TextureDimension), - #[error("Texture format {0:?} can't be used")] + #[error("Texture format {0:?} can't be used due to missing features.")] MissingFeatures(wgt::TextureFormat, #[source] MissingFeatures), } diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 5564c83f3c..e599b428df 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -261,7 +261,6 @@ impl super::Adapter { }; let mut downlevel_flags = wgt::DownlevelFlags::empty() - | wgt::DownlevelFlags::DEVICE_LOCAL_IMAGE_COPIES | wgt::DownlevelFlags::NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES | wgt::DownlevelFlags::COMPARISON_SAMPLERS; diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 4a3a3dff1e..b1bb6180a1 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -951,41 +951,46 @@ bitflags::bitflags! { /// [`DownlevelCapabilities::is_webgpu_compliant()`] function. pub struct DownlevelFlags: u32 { /// The device supports compiling and using compute shaders. + /// + /// DX11 on FL10 level hardware, WebGL2, and GLES3.0 devices do not support compute. const COMPUTE_SHADERS = 1 << 0; /// Supports binding storage buffers and textures to fragment shaders. const FRAGMENT_WRITABLE_STORAGE = 1 << 1; /// Supports indirect drawing and dispatching. + /// + /// DX11 on FL10 level hardware, WebGL2, and GLES 3.0 devices do not support indirect. const INDIRECT_EXECUTION = 1 << 2; /// Supports non-zero `base_vertex` parameter to indexed draw calls. const BASE_VERTEX = 1 << 3; /// Supports reading from a depth/stencil buffer while using as a read-only depth/stencil /// attachment. + /// + /// The WebGL2 and GLES backends do not support RODS. const READ_ONLY_DEPTH_STENCIL = 1 << 4; - /// Supports: - /// - copy_image_to_image - /// - copy_buffer_to_image and copy_image_to_buffer with a buffer without a MAP_* usage - const DEVICE_LOCAL_IMAGE_COPIES = 1 << 5; /// Supports textures with mipmaps which have a non power of two size. - const NON_POWER_OF_TWO_MIPMAPPED_TEXTURES = 1 << 6; + const NON_POWER_OF_TWO_MIPMAPPED_TEXTURES = 1 << 5; /// Supports textures that are cube arrays. - const CUBE_ARRAY_TEXTURES = 1 << 7; + const CUBE_ARRAY_TEXTURES = 1 << 6; /// Supports comparison samplers. - const COMPARISON_SAMPLERS = 1 << 8; + const COMPARISON_SAMPLERS = 1 << 7; /// Supports different blend operations per color attachment. - const INDEPENDENT_BLEND = 1 << 9; + const INDEPENDENT_BLEND = 1 << 8; /// Supports storage buffers in vertex shaders. - const VERTEX_STORAGE = 1 << 10; + const VERTEX_STORAGE = 1 << 9; /// Supports samplers with anisotropic filtering. Note this isn't actually required by /// WebGPU, the implementation is allowed to completely ignore aniso clamp. This flag is /// here for native backends so they can comunicate to the user of aniso is enabled. - const ANISOTROPIC_FILTERING = 1 << 11; + /// + /// All backends and all devices support anisotropic filtering. + const ANISOTROPIC_FILTERING = 1 << 10; /// Supports storage buffers in fragment shaders. - const FRAGMENT_STORAGE = 1 << 12; + const FRAGMENT_STORAGE = 1 << 11; + + /// Supports sample-rate shading. + const MULTISAMPLED_SHADING = 1 << 12; - /// Supports sample shading and multisample interpolation. - const MULTISAMPLED_SHADING = 1 << 13; } }