From 1c88d9b2ca6e396549990ece4e13cf63c763211d Mon Sep 17 00:00:00 2001
From: Kai Ninomiya <kainino@chromium.org>
Date: Tue, 10 Dec 2024 23:30:21 -0500
Subject: [PATCH] part 1: use indices instead of full data for subcase params

---
 .../attachment_compatibility.spec.ts          | 60 +++++++++----------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts
index b0a4bf226dba..f17d78edf9e7 100644
--- a/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts
+++ b/src/webgpu/api/validation/render_pass/attachment_compatibility.spec.ts
@@ -240,26 +240,25 @@ g.test('render_pass_and_bundle,color_sparse')
       // introduce attachmentCount to make it easier to split the test
       .combine('attachmentCount', kColorAttachmentCounts)
       .beginSubcases()
-      .combine('passAttachments', kColorAttachments)
-      .combine('bundleAttachments', kColorAttachments)
-      .filter(
-        p =>
-          p.attachmentCount === p.passAttachments.length &&
-          p.attachmentCount === p.bundleAttachments.length
+      // Indices into kColorAttachments
+      .expand('iPass', p =>
+        range(kColorAttachments.length, i => i).filter(
+          i => kColorAttachments[i].length === p.attachmentCount
+        )
+      )
+      .expand('iBundle', p =>
+        range(kColorAttachments.length, i => i).filter(
+          i => kColorAttachments[i].length === p.attachmentCount
+        )
       )
   )
   .fn(t => {
-    const { passAttachments, bundleAttachments } = t.params;
+    const passAttachments = kColorAttachments[t.params.iPass];
+    const bundleAttachments = kColorAttachments[t.params.iBundle];
 
     const { maxColorAttachments } = t.device.limits;
-    t.skipIf(
-      passAttachments.length > maxColorAttachments,
-      `num passAttachments: ${passAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
-    );
-    t.skipIf(
-      bundleAttachments.length > maxColorAttachments,
-      `num bundleAttachments: ${bundleAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
-    );
+    t.skipIf(passAttachments.length > maxColorAttachments);
+    t.skipIf(bundleAttachments.length > maxColorAttachments);
 
     const colorFormats = bundleAttachments.map(i => (i ? 'rgba8uint' : null));
     const bundleEncoder = t.device.createRenderBundleEncoder({
@@ -445,25 +444,26 @@ Test that each of color attachments in render passes or bundles match that of th
       // introduce attachmentCount to make it easier to split the test
       .combine('attachmentCount', kColorAttachmentCounts)
       .beginSubcases()
-      .combine('encoderAttachments', kColorAttachments)
-      .combine('pipelineAttachments', kColorAttachments)
-      .filter(
-        p =>
-          p.attachmentCount === p.encoderAttachments.length &&
-          p.attachmentCount === p.pipelineAttachments.length
+      // Indices into kColorAttachments
+      .expand('iEncoder', p =>
+        range(kColorAttachments.length, i => i).filter(
+          i => kColorAttachments[i].length === p.attachmentCount
+        )
+      )
+      .expand('iPipeline', p =>
+        range(kColorAttachments.length, i => i).filter(
+          i => kColorAttachments[i].length === p.attachmentCount
+        )
       )
   )
   .fn(t => {
-    const { encoderType, encoderAttachments, pipelineAttachments } = t.params;
+    const { encoderType } = t.params;
+    const encoderAttachments = kColorAttachments[t.params.iEncoder];
+    const pipelineAttachments = kColorAttachments[t.params.iPipeline];
+
     const { maxColorAttachments } = t.device.limits;
-    t.skipIf(
-      encoderAttachments.length > maxColorAttachments,
-      `num encoderAttachments: ${encoderAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
-    );
-    t.skipIf(
-      pipelineAttachments.length > maxColorAttachments,
-      `num pipelineAttachments: ${pipelineAttachments.length} > maxColorAttachments for device: ${maxColorAttachments}`
-    );
+    t.skipIf(encoderAttachments.length > maxColorAttachments);
+    t.skipIf(pipelineAttachments.length > maxColorAttachments);
 
     const colorTargets = pipelineAttachments.map(i =>
       i ? ({ format: 'rgba8uint', writeMask: 0 } as GPUColorTargetState) : null