From 1f393f9daaa4d1196a41e3b85cc6417c38c6b480 Mon Sep 17 00:00:00 2001
From: Greggman <github@greggman.com>
Date: Mon, 8 Jul 2024 07:20:01 -0700
Subject: [PATCH] compat: fix more flat either issues (#3837)

---
 .../decl/context_dependent_resolution.spec.ts | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/webgpu/shader/validation/decl/context_dependent_resolution.spec.ts b/src/webgpu/shader/validation/decl/context_dependent_resolution.spec.ts
index b6bdfc4fecab..bb69a2524888 100644
--- a/src/webgpu/shader/validation/decl/context_dependent_resolution.spec.ts
+++ b/src/webgpu/shader/validation/decl/context_dependent_resolution.spec.ts
@@ -28,7 +28,7 @@ const kAttributeCases = {
   // diagnostic is a keyword
   group: `@group(0) @binding(0) var s : sampler;`,
   id: `@id(1) override x : i32;`,
-  interpolate: `@fragment fn main(@location(0) @interpolate(flat) x : i32) { }`,
+  interpolate: `@fragment fn main(@location(0) @interpolate(flat, either) x : i32) { }`,
   invariant: `@fragment fn main(@builtin(position) @invariant pos : vec4f) { }`,
   location: `@fragment fn main(@location(0) x : f32) { }`,
   must_use: `@must_use fn foo() -> u32 { return 0; }`,
@@ -102,6 +102,17 @@ g.test('builtin_value_names')
       .beginSubcases()
       .combine('decl', ['override', 'const', 'var<private>'] as const)
   )
+  .beforeAllSubcases(t => {
+    const wgsl = kBuiltinCases[t.params.case];
+    t.skipIf(
+      t.isCompatibility && wgsl.includes('sample_mask'),
+      'sample_mask is not supported in compatibility mode'
+    );
+    t.skipIf(
+      t.isCompatibility && wgsl.includes('sample_index'),
+      'sample_index is not supported in compatibility mode'
+    );
+  })
   .fn(t => {
     const code = `
     ${t.params.decl} ${t.params.case} : u32 = 0;
@@ -325,6 +336,12 @@ g.test('interpolation_sampling_names')
       .beginSubcases()
       .combine('decl', ['override', 'const', 'var<private>'] as const)
   )
+  .beforeAllSubcases(t => {
+    t.skipIf(
+      t.isCompatibility && t.params.case === 'sample',
+      'compatibility mode does not support sample sampling'
+    );
+  })
   .fn(t => {
     const code = `
     ${t.params.decl} ${t.params.case} : u32 = 0;
@@ -347,6 +364,12 @@ g.test('interpolation_flat_names')
       .beginSubcases()
       .combine('decl', ['override', 'const', 'var<private>'] as const)
   )
+  .beforeAllSubcases(t => {
+    t.skipIf(
+      t.isCompatibility && t.params.case === 'first',
+      'compatibility mode does not support first sampling'
+    );
+  })
   .fn(t => {
     const code = `
     ${t.params.decl} ${t.params.case} : u32 = 0;