Set the new naga capabilities (#3494)

* remove redundant flag

* set the `MULTISAMPLED_SHADING` downlevel flag for gles and dx11

* set the right naga capabilities

add `Features::SHADER_EARLY_DEPTH_TEST`

* add changelog entry

* remove `@early_depth_test` from water example
This commit is contained in:
Teodor Tanasoaia authored and GitHub committed 2023-02-16 22:43:38 -05:00
1 parent bf38b4b0b1
commit 074d1da831
10 files changed
+34 -7

No files matched your search

+1
View File
@@ -80,6 +80,7 @@ By @teoxoy in [#3436](https://github.com/gfx-rs/wgpu/pull/3436)
- Added `TextureFormatFeatureFlags::MULTISAMPLE_X16`. By @Dinnerbone in [#3454](https://github.com/gfx-rs/wgpu/pull/3454)
- Support stencil-only views and copying to/from combined depth-stencil textures. By @teoxoy in [#3436](https://github.com/gfx-rs/wgpu/pull/3436)
- Added `Features::SHADER_EARLY_DEPTH_TEST`. By @teoxoy in [#3494](https://github.com/gfx-rs/wgpu/pull/3494)
#### WebGPU
Generated
+1 -1
View File
@@ -1515,7 +1515,7 @@ dependencies = [
[[package]]
name = "naga"
version = "0.11.0"
source = "git+https://github.com/gfx-rs/naga?rev=568d7c4c136dada369ef7f59ee8414a263d6c7b2#568d7c4c136dada369ef7f59ee8414a263d6c7b2"
source = "git+https://github.com/gfx-rs/naga?rev=7422ace934b7ed51c1e061eb1d36de8259b5f619#7422ace934b7ed51c1e061eb1d36de8259b5f619"
dependencies = [
"bit-set",
"bitflags",
+1 -1
View File
@@ -42,7 +42,7 @@ version = "0.15"
[workspace.dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "568d7c4c136dada369ef7f59ee8414a263d6c7b2"
rev = "7422ace934b7ed51c1e061eb1d36de8259b5f619"
version = "0.11.0"
[workspace.dependencies]
+1 -1
View File
@@ -70,7 +70,7 @@ thiserror = "1"
[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "568d7c4c136dada369ef7f59ee8414a263d6c7b2"
rev = "7422ace934b7ed51c1e061eb1d36de8259b5f619"
version = "0.11.0"
features = ["clone", "span", "validate"]
+15
View File
@@ -1388,6 +1388,21 @@ impl<A: HalApi> Device<A> {
self.features
.contains(wgt::Features::TEXTURE_FORMAT_16BIT_NORM),
);
caps.set(
Caps::MULTIVIEW,
self.features.contains(wgt::Features::MULTIVIEW),
);
caps.set(
Caps::EARLY_DEPTH_TEST,
self.features
.contains(wgt::Features::SHADER_EARLY_DEPTH_TEST),
);
caps.set(
Caps::MULTISAMPLED_SHADING,
self.downlevel
.flags
.contains(wgt::DownlevelFlags::MULTISAMPLED_SHADING),
);
let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), caps)
.validate(&module)
+2 -2
View File
@@ -119,14 +119,14 @@ android_system_properties = "0.1.1"
[dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "568d7c4c136dada369ef7f59ee8414a263d6c7b2"
rev = "7422ace934b7ed51c1e061eb1d36de8259b5f619"
version = "0.11.0"
features = ["clone"]
# DEV dependencies
[dev-dependencies.naga]
git = "https://github.com/gfx-rs/naga"
rev = "568d7c4c136dada369ef7f59ee8414a263d6c7b2"
rev = "7422ace934b7ed51c1e061eb1d36de8259b5f619"
version = "0.11.0"
features = ["wgsl-in"]
+1 -1
View File
@@ -124,7 +124,6 @@ impl super::Adapter {
}
if feature_level >= FL10_0 {
downlevel |= wgt::DownlevelFlags::INDEPENDENT_BLEND;
downlevel |= wgt::DownlevelFlags::FRAGMENT_STORAGE;
downlevel |= wgt::DownlevelFlags::FRAGMENT_WRITABLE_STORAGE;
downlevel |= wgt::DownlevelFlags::DEPTH_BIAS_CLAMP;
@@ -136,6 +135,7 @@ impl super::Adapter {
if feature_level >= FL10_1 {
downlevel |= wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES;
downlevel |= wgt::DownlevelFlags::MULTISAMPLED_SHADING;
}
if feature_level >= FL11_0 {
+5
View File
@@ -325,6 +325,10 @@ impl super::Adapter {
wgt::DownlevelFlags::FULL_DRAW_INDEX_UINT32,
max_element_index == u32::MAX,
);
downlevel_flags.set(
wgt::DownlevelFlags::MULTISAMPLED_SHADING,
ver >= (3, 2) || extensions.contains("OES_sample_variables"),
);
let mut features = wgt::Features::empty()
| wgt::Features::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
@@ -351,6 +355,7 @@ impl super::Adapter {
wgt::Features::SHADER_PRIMITIVE_INDEX,
ver >= (3, 2) || extensions.contains("OES_geometry_shader"),
);
features.set(wgt::Features::SHADER_EARLY_DEPTH_TEST, ver >= (3, 1));
let gles_bcn_exts = [
"GL_EXT_texture_compression_s3tc_srgb",
"GL_EXT_texture_compression_rgtc",
+7
View File
@@ -681,6 +681,13 @@ bitflags::bitflags! {
///
/// This is a native-only feature.
const SHADER_INT16 = 1 << 42;
/// Allows shaders to use the `early_depth_test` attribute.
///
/// Supported platforms:
/// - GLES 3.1+
///
/// This is a native-only feature.
const SHADER_EARLY_DEPTH_TEST = 1 << 43;
}
}
-1
View File
@@ -37,7 +37,6 @@ fn vs_main(
}
@fragment
@early_depth_test
fn fs_main(
vertex: VertexOutput,
) -> @location(0) vec4<f32> {