Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the new naga capabilities #3494

Merged
merged 5 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
15 changes: 15 additions & 0 deletions wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx11/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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+
teoxoy marked this conversation as resolved.
Show resolved Hide resolved
///
/// This is a native-only feature.
const SHADER_EARLY_DEPTH_TEST = 1 << 43;
}
}

Expand Down
1 change: 0 additions & 1 deletion wgpu/examples/water/terrain.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ fn vs_main(
}

@fragment
@early_depth_test
fn fs_main(
vertex: VertexOutput,
) -> @location(0) vec4<f32> {
Expand Down