From 5e7e7e67649d179c7238d917d3dd90f131e56a4b Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 6 Jul 2026 16:31:03 -0400 Subject: [PATCH 1/2] Add frag_depth validation tests. Add validation tests for the `fragment_depth` extension. --- src/webgpu/capability_info.ts | 1 + .../validation/shader_io/builtins.spec.ts | 67 +++++++++++++++++-- 2 files changed, 63 insertions(+), 5 deletions(-) diff --git a/src/webgpu/capability_info.ts b/src/webgpu/capability_info.ts index 99c1dd29c06c..cd8cc26c7c43 100644 --- a/src/webgpu/capability_info.ts +++ b/src/webgpu/capability_info.ts @@ -990,6 +990,7 @@ export const kKnownWGSLLanguageFeatures = [ 'linear_indexing', 'texture_formats_tier1', 'immediate_address_space', + 'fragment_depth', ] as const; export type WGSLLanguageFeature = (typeof kKnownWGSLLanguageFeatures)[number]; diff --git a/src/webgpu/shader/validation/shader_io/builtins.spec.ts b/src/webgpu/shader/validation/shader_io/builtins.spec.ts index 5dff7e70b227..8aa7c0e15060 100644 --- a/src/webgpu/shader/validation/shader_io/builtins.spec.ts +++ b/src/webgpu/shader/validation/shader_io/builtins.spec.ts @@ -437,7 +437,7 @@ g.test('reuse_builtin_name') t.expectCompileResult(true, code); }); -const kTests = { +const kBuiltinTests = { pos: { src: `@builtin(position)`, pass: true, @@ -496,17 +496,17 @@ const kTests = { }, }; -g.test('parse') +g.test('parse_builtin') .desc(`Test that @builtin is parsed correctly.`) - .params(u => u.combine('builtin', keysOf(kTests))) + .params(u => u.combine('builtin', keysOf(kBuiltinTests))) .fn(t => { - const src = kTests[t.params.builtin].src; + const src = kBuiltinTests[t.params.builtin].src; const code = ` @vertex fn main() -> ${src} vec4 { return vec4(.4, .2, .3, .1); }`; - t.expectCompileResult(kTests[t.params.builtin].pass, code); + t.expectCompileResult(kBuiltinTests[t.params.builtin].pass, code); }); g.test('placement') @@ -577,3 +577,60 @@ g.test('placement') t.expectCompileResult(scope === undefined || t.params.attribute[scope], code); }); + +const kFragDepthTests = { + unset: { + src: `@builtin(frag_depth)`, + pass: true, + requires_feature: false, + }, + less: { + src: `@builtin(frag_depth, less)`, + pass: true, + requires_feature: true, + }, + greater: { + src: `@builtin(frag_depth, greater)`, + pass: true, + requires_feature: true, + }, + trailing_comma: { + src: `@builtin(frag_depth, less,)`, + pass: true, + requires_feature: true, + }, + missing_enum: { + src: `@builtin(frag_depth,)`, + pass: true, + requires_feature: false, + }, + invalid_enum: { + src: `@builtin(frag_depth, any)`, + pass: false, + requires_feature: false, + }, + missing_comma: { + src: `@builtin(frag_depth greater)`, + pass: false, + requires_feature: false, + }, +}; + +g.test('parse_frag_depth') + .desc(`Test that @builtin is parsed correctly.`) + .params(u => u.combine('builtin', keysOf(kFragDepthTests))) + .fn(t => { + let data = kFragDepthTests[t.params.builtin]; + + if (data.requires_feature) { + t.skipIfLanguageFeatureNotSupported('fragment_depth'); + } + + const code = ` +@fragment +fn main() -> ${data.src} f32 { + return .5; +}`; + t.expectCompileResult(data.pass, code); + }); + From 0f2bd3d699a44f9d45209ed0a3839d5f0422ee62 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Mon, 6 Jul 2026 16:40:59 -0400 Subject: [PATCH 2/2] cleanup metadata file --- src/webgpu/listing_meta.json | 1 - 1 file changed, 1 deletion(-) diff --git a/src/webgpu/listing_meta.json b/src/webgpu/listing_meta.json index 0bb3da5f00d2..8d2f84c4592e 100644 --- a/src/webgpu/listing_meta.json +++ b/src/webgpu/listing_meta.json @@ -2913,7 +2913,6 @@ "webgpu:shader,validation,shader_io,builtins:duplicates:*": { "subcaseMS": 1.913 }, "webgpu:shader,validation,shader_io,builtins:missing_vertex_position:*": { "subcaseMS": 0.975 }, "webgpu:shader,validation,shader_io,builtins:nesting:*": { "subcaseMS": 2.700 }, - "webgpu:shader,validation,shader_io,builtins:parse:*": { "subcaseMS": 10.114 }, "webgpu:shader,validation,shader_io,builtins:placement:*": { "subcaseMS": 10.371 }, "webgpu:shader,validation,shader_io,builtins:reuse_builtin_name:*": { "subcaseMS": 1.202 }, "webgpu:shader,validation,shader_io,builtins:stage_inout:*": { "subcaseMS": 1.231 },