From fd2cedb5a2a9946960947feecde392bce3d3ac62 Mon Sep 17 00:00:00 2001 From: Kai Ninomiya Date: Tue, 8 Sep 2026 23:01:30 -0700 Subject: [PATCH] Add a test that requires all known WGSL language features to be supported --- .../shader/validation/parse/requires.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/webgpu/shader/validation/parse/requires.spec.ts b/src/webgpu/shader/validation/parse/requires.spec.ts index 0b1bc210056f..bcd3e617e078 100644 --- a/src/webgpu/shader/validation/parse/requires.spec.ts +++ b/src/webgpu/shader/validation/parse/requires.spec.ts @@ -2,6 +2,7 @@ export const description = `Parser validation tests for requires`; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { keysOf } from '../../../../common/util/data_tables.js'; +import { assert } from '../../../../common/util/util.js'; import { kKnownWGSLLanguageFeatures } from '../../../capability_info.js'; import { ShaderValidationTest } from '../shader_validation_test.js'; @@ -96,3 +97,17 @@ g.test('wgsl_matches_api') const code = `requires ${t.params.feature};`; t.expectCompileResult(t.hasLanguageFeature(t.params.feature), code); }); + +g.test('have_all_language_features') + .desc( + `The spec technically requires support for all WGSL language features listed in the spec. + This test enforces that. It should be the ONLY test that fails when a new feature is + unavailable - others should skip themselves.` + ) + .params(u => u.combine('feature', kKnownWGSLLanguageFeatures)) + .fn(t => { + // First check that the API exposes the feature. + assert(t.hasLanguageFeature(t.params.feature)); + // If it does, then also check that WGSL allows it. + t.expectCompileResult(true, `requires ${t.params.feature};`); + });