From 047379ccdaf8ebbf72447ead1f06c80f51e83c4f Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Jul 2026 12:35:46 +0200 Subject: [PATCH 1/4] Gate `@interpolate(linear)` behind a capability instead of failing at pipeline creation `@interpolate(linear)` maps to `noperspective` in GLSL, which does not exist in GLSL ES. naga's GLSL backend therefore rejected it, but only at pipeline creation, deep in the backend, with `The selected version doesn't support Features(NOPERSPECTIVE_QUALIFIER)`: no shader label, no source span, no hint that WebGL2 was the constraint. Add `naga::valid::Capabilities::LINEAR_INTERPOLATION` and the corresponding `wgpu_types::DownlevelFlags::LINEAR_INTERPOLATION`, so that `Device::create_shader_module` rejects such shaders up front with a label and a span, like every other backend-unexpressible construct. The GLES backend clears the downlevel flag whenever the shading language version is ES. Also include the GLSL version in the backend's `MissingFeatures` error, so that the remaining paths through it are actionable too. Fixes #9971 Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 5 ++ naga/src/back/glsl/features.rs | 9 ++- naga/src/back/glsl/mod.rs | 8 ++- naga/src/back/hlsl/mod.rs | 1 + naga/src/back/msl/mod.rs | 1 + naga/src/back/spv/mod.rs | 1 + naga/src/valid/interface.rs | 9 ++- naga/src/valid/mod.rs | 8 +++ naga/tests/in/wgsl/interpolate.toml | 1 + naga/tests/in/wgsl/interpolate_compat.toml | 2 + naga/tests/naga/validation.rs | 46 ++++++++++++++ naga/tests/naga/wgsl_errors.rs | 30 +++++++++ tests/tests/wgpu-gpu/linear_interpolation.rs | 64 ++++++++++++++++++++ tests/tests/wgpu-gpu/main.rs | 2 + wgpu-hal/src/gles/adapter.rs | 7 +++ wgpu-naga-bridge/src/lib.rs | 4 ++ wgpu-types/src/limits.rs | 7 +++ 17 files changed, 199 insertions(+), 6 deletions(-) create mode 100644 tests/tests/wgpu-gpu/linear_interpolation.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 703aa838628..c9c362f2ce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,9 +70,13 @@ Bottom level categories: - `TextureFormat::is_srgb()` has been renamed to `TextureFormat::has_srgb_suffix()` to clarify its function. By @kpreid in [#9758](https://github.com/gfx-rs/wgpu/pull/9758). - Remove the never-constructed `CreateBlasError::InvalidAabbStride` variant. `create_blas` takes no stride, so it could never be produced; AABB stride is validated at build time as `BuildAccelerationStructureError::InvalidAabbStride`. By @mstampfli in [#9935](https://github.com/gfx-rs/wgpu/pull/9935). +- Added `DownlevelFlags::LINEAR_INTERPOLATION`, indicating that the adapter supports `@interpolate(linear)`. It is absent on GLES/WebGL2, since GLSL ES has no `noperspective` qualifier. By @emilk in [#9972](https://github.com/gfx-rs/wgpu/pull/9972). + #### naga - `naga::valid::ValidationError` is now always returned boxed, to avoid `clippy::large_result_err` warning. By @beicause in [#9612](https://github.com/gfx-rs/wgpu/pull/9612) +- Added `naga::valid::Capabilities::LINEAR_INTERPOLATION`, which is now required in order to use `@interpolate(linear)`. By @emilk in [#9972](https://github.com/gfx-rs/wgpu/pull/9972). +- The GLSL backend's `MissingFeatures` error now names the GLSL version that lacks the features, e.g. `GLSL 300 es doesn't support the required feature(s): NOPERSPECTIVE_QUALIFIER`. By @emilk in [#9972](https://github.com/gfx-rs/wgpu/pull/9972). ### Bug Fixes @@ -103,6 +107,7 @@ Bottom level categories: #### GLES +- `@interpolate(linear)` is now rejected by `Device::create_shader_module` on adapters that lack `DownlevelFlags::LINEAR_INTERPOLATION` (GLES/WebGL2), with a shader label and a source span. Previously such a shader validated fine and then failed at pipeline creation with `The selected version doesn't support Features(NOPERSPECTIVE_QUALIFIER)`. By @emilk in [#9972](https://github.com/gfx-rs/wgpu/pull/9972). - Fixed signed integer `%` (and `%=`) returning the wrong result for negative operands in the GLSL (OpenGL/GLES) backend, e.g. `-1 % 768` yielding `255` instead of `-1`. GLSL's `%` is undefined when either operand is negative, so signed remainder is now lowered as `a - b * (a / b)`, matching the SPIR-V, HLSL, and Metal backends. By @mstampfli in [#9687](https://github.com/gfx-rs/wgpu/pull/9687). #### WebGPU diff --git a/naga/src/back/glsl/features.rs b/naga/src/back/glsl/features.rs index 366405c579f..68a864a1e3c 100644 --- a/naga/src/back/glsl/features.rs +++ b/naga/src/back/glsl/features.rs @@ -62,6 +62,13 @@ bitflags::bitflags! { } } +impl core::fmt::Display for Features { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + // `Debug` would print this as `Features(A | B)`; we only want `A | B`. + bitflags::parser::to_writer(self, f) + } +} + /// Helper structure used to store the required [`Features`] needed to output a /// [`Module`](crate::Module) /// @@ -144,7 +151,7 @@ impl FeaturesManager { if missing.is_empty() { Ok(()) } else { - Err(Error::MissingFeatures(missing)) + Err(Error::MissingFeatures(missing, version)) } } diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs index 7ef406cce25..3091eed1610 100644 --- a/naga/src/back/glsl/mod.rs +++ b/naga/src/back/glsl/mod.rs @@ -416,9 +416,9 @@ pub enum Error { FmtError(#[from] FmtError), /// The specified [`Version`] doesn't have all required [`Features`]. /// - /// Contains the missing [`Features`]. - #[error("The selected version doesn't support {0:?}")] - MissingFeatures(Features), + /// Contains the missing [`Features`], and the version that lacks them. + #[error("GLSL {1} doesn't support the required feature(s): {0}")] + MissingFeatures(Features, Version), /// [`AddressSpace::Immediate`](crate::AddressSpace::Immediate) was used more than /// once in the entry point, which isn't supported. #[error("Multiple immediates aren't supported")] @@ -506,4 +506,6 @@ pub fn supported_capabilities() -> valid::Capabilities { | Caps::MEMORY_DECORATION_COHERENT | Caps::MEMORY_DECORATION_VOLATILE | Caps::STORAGE_TEXTURE_16BIT_NORM_FORMATS + // `noperspective` only exists in desktop GLSL; `check_availability` rejects it on ES. + | Caps::LINEAR_INTERPOLATION } diff --git a/naga/src/back/hlsl/mod.rs b/naga/src/back/hlsl/mod.rs index 3222c24a192..ad8a5611eab 100644 --- a/naga/src/back/hlsl/mod.rs +++ b/naga/src/back/hlsl/mod.rs @@ -830,4 +830,5 @@ pub fn supported_capabilities() -> crate::valid::Capabilities { // No DRAW_INDEX // No MEMORY_DECORATION_VOLATILE | Caps::MEMORY_DECORATION_COHERENT + | Caps::LINEAR_INTERPOLATION } diff --git a/naga/src/back/msl/mod.rs b/naga/src/back/msl/mod.rs index 45a3a8ac4ac..c16bc637df6 100644 --- a/naga/src/back/msl/mod.rs +++ b/naga/src/back/msl/mod.rs @@ -875,6 +875,7 @@ pub fn supported_capabilities() -> crate::valid::Capabilities { // No DRAW_INDEX // No MEMORY_DECORATION_VOLATILE | Caps::MEMORY_DECORATION_COHERENT + | Caps::LINEAR_INTERPOLATION } #[test] diff --git a/naga/src/back/spv/mod.rs b/naga/src/back/spv/mod.rs index c5c817fcdeb..64e1bb1d596 100644 --- a/naga/src/back/spv/mod.rs +++ b/naga/src/back/spv/mod.rs @@ -1226,4 +1226,5 @@ pub fn supported_capabilities() -> crate::valid::Capabilities { | Caps::DRAW_INDEX | Caps::MEMORY_DECORATION_COHERENT | Caps::MEMORY_DECORATION_VOLATILE + | Caps::LINEAR_INTERPOLATION } diff --git a/naga/src/valid/interface.rs b/naga/src/valid/interface.rs index 14aede93d82..db6167befeb 100644 --- a/naga/src/valid/interface.rs +++ b/naga/src/valid/interface.rs @@ -785,12 +785,17 @@ impl VaryingContext<'_> { // qualifiers, so we won't complain about that here. let _ = sampling; - let required = match sampling { + let mut required = match sampling { Some(crate::Sampling::Sample) => Capabilities::MULTISAMPLED_SHADING, _ => Capabilities::empty(), }; + if interpolation == Some(crate::Interpolation::Linear) { + required |= Capabilities::LINEAR_INTERPOLATION; + } if !self.capabilities.contains(required) { - return Err(VaryingError::UnsupportedCapability(required)); + return Err(VaryingError::UnsupportedCapability( + required - self.capabilities, + )); } if interpolation != Some(crate::Interpolation::PerVertex) { diff --git a/naga/src/valid/mod.rs b/naga/src/valid/mod.rs index 0d7863e537a..9dab12755e9 100644 --- a/naga/src/valid/mod.rs +++ b/naga/src/valid/mod.rs @@ -218,6 +218,14 @@ bitflags::bitflags! { const MEMORY_DECORATION_VOLATILE = 1 << 42; /// Support for 16-bit integer types. const SHADER_INT16 = 1 << 43; + /// Support for [`Interpolation::Linear`] (`@interpolate(linear)` in WGSL). + /// + /// This is core WebGPU, but GLSL ES (and thus WebGL2) has no + /// `noperspective` qualifier, so the GLES backend can only offer it on + /// desktop GL. + /// + /// [`Interpolation::Linear`]: crate::Interpolation::Linear + const LINEAR_INTERPOLATION = 1 << 44; } } diff --git a/naga/tests/in/wgsl/interpolate.toml b/naga/tests/in/wgsl/interpolate.toml index bb9f6973887..bc3be9c4e54 100644 --- a/naga/tests/in/wgsl/interpolate.toml +++ b/naga/tests/in/wgsl/interpolate.toml @@ -1,4 +1,5 @@ targets = "SPIRV | METAL | HLSL | WGSL" +capabilities = "LINEAR_INTERPOLATION" [glsl] version.Desktop = 400 diff --git a/naga/tests/in/wgsl/interpolate_compat.toml b/naga/tests/in/wgsl/interpolate_compat.toml index 57f942c8464..0587c82aa11 100644 --- a/naga/tests/in/wgsl/interpolate_compat.toml +++ b/naga/tests/in/wgsl/interpolate_compat.toml @@ -1,3 +1,5 @@ +capabilities = "LINEAR_INTERPOLATION" + [glsl] version.Desktop = 400 writer_flags = "" diff --git a/naga/tests/naga/validation.rs b/naga/tests/naga/validation.rs index bb22b70adcc..aef889b2761 100644 --- a/naga/tests/naga/validation.rs +++ b/naga/tests/naga/validation.rs @@ -538,6 +538,52 @@ fn no_flat_first_in_glsl() { )); } +#[test] +fn no_linear_interpolation_in_glsl_es() { + use dummy_interpolation_shader::DummyInterpolationShader; + + let DummyInterpolationShader { + source: _, + module, + interpolate_attr, + entry_point, + } = DummyInterpolationShader::new(naga::Interpolation::Linear, None); + + let mut validator = naga::valid::Validator::new(Default::default(), valid::Capabilities::all()); + let module_info = validator.validate(&module).unwrap(); + + let options = naga::back::glsl::Options { + version: naga::back::glsl::Version::Embedded { + version: 300, + is_webgl: true, + }, + ..Default::default() + }; + let pipeline_options = naga::back::glsl::PipelineOptions { + shader_stage: naga::ShaderStage::Fragment, + entry_point: entry_point.to_owned(), + multiview: None, + }; + let err = naga::back::glsl::Writer::new( + String::new(), + &module, + &module_info, + &options, + &pipeline_options, + Default::default(), + ) + .err() + .unwrap_or_else(|| { + panic!("`{interpolate_attr}` should fail backend validation on GLSL ES"); + }); + + // The message must name the version and the feature, so that it is actionable. + assert_eq!( + err.to_string(), + "GLSL 300 es doesn't support the required feature(s): NOPERSPECTIVE_QUALIFIER" + ); +} + mod dummy_interpolation_shader { pub struct DummyInterpolationShader { pub source: String, diff --git a/naga/tests/naga/wgsl_errors.rs b/naga/tests/naga/wgsl_errors.rs index 0e75454a166..60f20c62c4e 100644 --- a/naga/tests/naga/wgsl_errors.rs +++ b/naga/tests/naga/wgsl_errors.rs @@ -1288,6 +1288,36 @@ fn per_vertex_capability() { } } +#[test] +fn linear_interpolation_capability() { + // Regression test for https://github.com/gfx-rs/wgpu/issues/9971: `@interpolate(linear)` + // has no GLSL ES equivalent, so it must be rejected during validation rather than + // silently passing and then failing in the GLSL backend at pipeline creation. + let source = r#" + @fragment + fn fs_main(@location(0) @interpolate(linear) v: f32) -> @location(0) vec4 { + return vec4(v, 0.0, 0.0, 1.0); + } + "#; + + check_one_validation! { + source, + Err(naga::valid::ValidationError::EntryPoint { + stage: naga::ShaderStage::Fragment, + source: valid::EntryPointError::Argument( + 0, + valid::VaryingError::UnsupportedCapability(Capabilities::LINEAR_INTERPOLATION), + ), + .. + }) + } + + no_validation_error( + source, + Capabilities::default() | Capabilities::LINEAR_INTERPOLATION, + ); +} + #[test] fn multiple_enables_valid() { check_success( diff --git a/tests/tests/wgpu-gpu/linear_interpolation.rs b/tests/tests/wgpu-gpu/linear_interpolation.rs new file mode 100644 index 00000000000..dc9603a02c1 --- /dev/null +++ b/tests/tests/wgpu-gpu/linear_interpolation.rs @@ -0,0 +1,64 @@ +use wgpu_test::{ + apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, +}; + +pub fn all_tests(vec: &mut Vec) { + vec.push(LINEAR_INTERPOLATION_GATED); +} + +const SHADER_SRC: &str = " +@vertex +fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { + var out: VertexOutput; + out.pos = vec4f(f32(vertex_index), 0.0, 0.0, 1.0); + out.v = 1.0; + return out; +} + +struct VertexOutput { + @builtin(position) pos: vec4f, + @location(0) @interpolate(linear) v: f32, +} + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4f { + return vec4f(in.v); +} +"; + +/// `@interpolate(linear)` has no GLSL ES equivalent, so on adapters without +/// [`wgpu::DownlevelFlags::LINEAR_INTERPOLATION`] it must be rejected up front by +/// `create_shader_module`, instead of failing later during pipeline creation with an +/// internal naga bitflag name. +/// +/// Regression test for . +fn linear_interpolation_gated(ctx: TestingContext) { + let supported = ctx + .adapter + .get_downlevel_capabilities() + .flags + .contains(wgpu::DownlevelFlags::LINEAR_INTERPOLATION); + + let create = || { + ctx.device + .create_shader_module(wgpu::ShaderModuleDescriptor { + label: Some("linear-interpolation"), + source: wgpu::ShaderSource::Wgsl(SHADER_SRC.into()), + }) + }; + + if supported { + create(); + } else { + fail(&ctx.device, create, Some("LINEAR_INTERPOLATION")); + } +} + +#[apply(gpu_test!)] +static LINEAR_INTERPOLATION_GATED: GpuTestConfiguration = GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .downlevel_flags(wgpu::DownlevelFlags::empty()) + .limits(wgpu::Limits::downlevel_webgl2_defaults()), + ) + .run_sync(linear_interpolation_gated); diff --git a/tests/tests/wgpu-gpu/main.rs b/tests/tests/wgpu-gpu/main.rs index a9e6a35472e..67830cc5fe2 100644 --- a/tests/tests/wgpu-gpu/main.rs +++ b/tests/tests/wgpu-gpu/main.rs @@ -41,6 +41,7 @@ mod image_atomics; mod immediates; mod instance; mod life_cycle; +mod linear_interpolation; mod mem_leaks; mod mesh_shader; mod multiview; @@ -117,6 +118,7 @@ fn all_tests() -> Vec { image_atomics::all_tests(&mut tests); instance::all_tests(&mut tests); life_cycle::all_tests(&mut tests); + linear_interpolation::all_tests(&mut tests); mem_leaks::all_tests(&mut tests); mesh_shader::all_tests(&mut tests); multiview::all_tests(&mut tests); diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 2b5f3f58f2b..a052fee885c 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -439,6 +439,13 @@ impl super::Adapter { wgt::DownlevelFlags::MULTISAMPLED_SHADING, supported((3, 2), (4, 0)) || extensions.contains("OES_sample_variables"), ); + // GLSL ES has no `noperspective` qualifier, so `@interpolate(linear)` is only + // expressible on desktop GLSL (where we require at least 330, well past the 130 + // that introduced `noperspective`). + downlevel_flags.set( + wgt::DownlevelFlags::LINEAR_INTERPOLATION, + !shading_language_version.is_es(), + ); let query_buffers = extensions.contains("GL_ARB_query_buffer_object") || extensions.contains("GL_AMD_query_buffer_object"); if query_buffers { diff --git a/wgpu-naga-bridge/src/lib.rs b/wgpu-naga-bridge/src/lib.rs index d2e265bca4c..1791f152f90 100644 --- a/wgpu-naga-bridge/src/lib.rs +++ b/wgpu-naga-bridge/src/lib.rs @@ -183,6 +183,10 @@ pub fn features_to_naga_capabilities( Caps::RAY_TRACING_PIPELINE, features.intersects(wgt::Features::EXPERIMENTAL_RAY_TRACING_PIPELINES), ); + caps.set( + Caps::LINEAR_INTERPOLATION, + downlevel.contains(wgt::DownlevelFlags::LINEAR_INTERPOLATION), + ); caps } diff --git a/wgpu-types/src/limits.rs b/wgpu-types/src/limits.rs index f911f2c5d35..fbcf767a98f 100644 --- a/wgpu-types/src/limits.rs +++ b/wgpu-types/src/limits.rs @@ -1236,6 +1236,13 @@ bitflags::bitflags! { /// /// See . const TEXTURE_COMPRESSION = 1 << 25; + + /// Supports `@interpolate(linear)` (a.k.a. `noperspective`) on shader inter-stage + /// variables. + /// + /// GLSL ES has no `noperspective` qualifier, so the GLES backend only supports this + /// on desktop OpenGL, not on GLES/WebGL2. + const LINEAR_INTERPOLATION = 1 << 26; } } From f9d61d4edcc427eb81858f5dcbb802597d8db74e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Jul 2026 14:22:37 +0200 Subject: [PATCH 2/4] rm comment --- naga/src/back/glsl/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/naga/src/back/glsl/mod.rs b/naga/src/back/glsl/mod.rs index 3091eed1610..41f301fa53d 100644 --- a/naga/src/back/glsl/mod.rs +++ b/naga/src/back/glsl/mod.rs @@ -506,6 +506,5 @@ pub fn supported_capabilities() -> valid::Capabilities { | Caps::MEMORY_DECORATION_COHERENT | Caps::MEMORY_DECORATION_VOLATILE | Caps::STORAGE_TEXTURE_16BIT_NORM_FORMATS - // `noperspective` only exists in desktop GLSL; `check_availability` rejects it on ES. | Caps::LINEAR_INTERPOLATION } From e32b579332ba0b74e3f81c19f4522c86d7516bdd Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Jul 2026 14:27:33 +0200 Subject: [PATCH 3/4] Set `DownlevelFlags::LINEAR_INTERPOLATION` on Vulkan, and fix snapshot capabilities The Vulkan backend builds its downlevel flags from an explicit allowlist rather than from `DownlevelCapabilities::default()`, so the new flag was missing there. That made every Vulkan adapter non-WebGPU-compliant, and thus invisible to `InstanceFlags::STRICT_WEBGPU_COMPLIANCE`, which broke the CTS jobs with `requestAdapter returned null`. The `interpolate` snapshots also need `MULTISAMPLED_SHADING` (they use `@interpolate(*, sample)`), which was previously supplied by `Capabilities::default()` and got dropped when the tests started specifying capabilities explicitly. Co-Authored-By: Claude Opus 5 (1M context) --- naga/tests/in/wgsl/interpolate.toml | 2 +- naga/tests/in/wgsl/interpolate_compat.toml | 2 +- wgpu-hal/src/vulkan/adapter.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/naga/tests/in/wgsl/interpolate.toml b/naga/tests/in/wgsl/interpolate.toml index bc3be9c4e54..1f4b8b6df78 100644 --- a/naga/tests/in/wgsl/interpolate.toml +++ b/naga/tests/in/wgsl/interpolate.toml @@ -1,5 +1,5 @@ targets = "SPIRV | METAL | HLSL | WGSL" -capabilities = "LINEAR_INTERPOLATION" +capabilities = "MULTISAMPLED_SHADING | LINEAR_INTERPOLATION" [glsl] version.Desktop = 400 diff --git a/naga/tests/in/wgsl/interpolate_compat.toml b/naga/tests/in/wgsl/interpolate_compat.toml index 0587c82aa11..e0e255b83c1 100644 --- a/naga/tests/in/wgsl/interpolate_compat.toml +++ b/naga/tests/in/wgsl/interpolate_compat.toml @@ -1,4 +1,4 @@ -capabilities = "LINEAR_INTERPOLATION" +capabilities = "MULTISAMPLED_SHADING | LINEAR_INTERPOLATION" [glsl] version.Desktop = 400 diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index f7ea44abe7f..8a0900529b1 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -696,7 +696,8 @@ impl PhysicalDeviceFeatures { | Df::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES | Df::NONBLOCKING_QUERY_RESOLVE | Df::SHADER_F16_IN_F32 - | Df::MSL2_1; + | Df::MSL2_1 + | Df::LINEAR_INTERPOLATION; dl_flags.set( Df::SURFACE_VIEW_FORMATS, From 3e68644fc4e787685a0b0c5fbda566c8b9600d5b Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Jul 2026 14:44:48 +0200 Subject: [PATCH 4/4] Drop the redundant gpu test for linear interpolation The naga test already covers the validation gate, and the gpu test could not catch a backend failing to advertise the downlevel flag: it asserted only that shader-module creation agrees with the flag, so an adapter that wrongly omits the flag makes it take the expect-failure branch and pass. Co-Authored-By: Claude Opus 5 (1M context) --- tests/tests/wgpu-gpu/linear_interpolation.rs | 64 -------------------- tests/tests/wgpu-gpu/main.rs | 2 - 2 files changed, 66 deletions(-) delete mode 100644 tests/tests/wgpu-gpu/linear_interpolation.rs diff --git a/tests/tests/wgpu-gpu/linear_interpolation.rs b/tests/tests/wgpu-gpu/linear_interpolation.rs deleted file mode 100644 index dc9603a02c1..00000000000 --- a/tests/tests/wgpu-gpu/linear_interpolation.rs +++ /dev/null @@ -1,64 +0,0 @@ -use wgpu_test::{ - apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, -}; - -pub fn all_tests(vec: &mut Vec) { - vec.push(LINEAR_INTERPOLATION_GATED); -} - -const SHADER_SRC: &str = " -@vertex -fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput { - var out: VertexOutput; - out.pos = vec4f(f32(vertex_index), 0.0, 0.0, 1.0); - out.v = 1.0; - return out; -} - -struct VertexOutput { - @builtin(position) pos: vec4f, - @location(0) @interpolate(linear) v: f32, -} - -@fragment -fn fs_main(in: VertexOutput) -> @location(0) vec4f { - return vec4f(in.v); -} -"; - -/// `@interpolate(linear)` has no GLSL ES equivalent, so on adapters without -/// [`wgpu::DownlevelFlags::LINEAR_INTERPOLATION`] it must be rejected up front by -/// `create_shader_module`, instead of failing later during pipeline creation with an -/// internal naga bitflag name. -/// -/// Regression test for . -fn linear_interpolation_gated(ctx: TestingContext) { - let supported = ctx - .adapter - .get_downlevel_capabilities() - .flags - .contains(wgpu::DownlevelFlags::LINEAR_INTERPOLATION); - - let create = || { - ctx.device - .create_shader_module(wgpu::ShaderModuleDescriptor { - label: Some("linear-interpolation"), - source: wgpu::ShaderSource::Wgsl(SHADER_SRC.into()), - }) - }; - - if supported { - create(); - } else { - fail(&ctx.device, create, Some("LINEAR_INTERPOLATION")); - } -} - -#[apply(gpu_test!)] -static LINEAR_INTERPOLATION_GATED: GpuTestConfiguration = GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .downlevel_flags(wgpu::DownlevelFlags::empty()) - .limits(wgpu::Limits::downlevel_webgl2_defaults()), - ) - .run_sync(linear_interpolation_gated); diff --git a/tests/tests/wgpu-gpu/main.rs b/tests/tests/wgpu-gpu/main.rs index 67830cc5fe2..a9e6a35472e 100644 --- a/tests/tests/wgpu-gpu/main.rs +++ b/tests/tests/wgpu-gpu/main.rs @@ -41,7 +41,6 @@ mod image_atomics; mod immediates; mod instance; mod life_cycle; -mod linear_interpolation; mod mem_leaks; mod mesh_shader; mod multiview; @@ -118,7 +117,6 @@ fn all_tests() -> Vec { image_atomics::all_tests(&mut tests); instance::all_tests(&mut tests); life_cycle::all_tests(&mut tests); - linear_interpolation::all_tests(&mut tests); mem_leaks::all_tests(&mut tests); mesh_shader::all_tests(&mut tests); multiview::all_tests(&mut tests);