summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/api/operation/command_buffer/render/state_tracking.spec.ts
blob: fc904066a3769c7cf60dcf1ab046a7e83f2b316b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
export const description = `
Ensure state is set correctly. Tries to stress state caching (setting different states multiple
times in different orders) for setIndexBuffer and setVertexBuffer.
Equivalent tests for setBindGroup and setPipeline are in programmable/state_tracking.spec.ts.
Equivalent tests for viewport/scissor/blend/reference are in render/dynamic_state.spec.ts
`;

import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { GPUTest } from '../../../../gpu_test.js';

class VertexAndIndexStateTrackingTest extends GPUTest {
  GetRenderPipelineForTest(arrayStride: number): GPURenderPipeline {
    return this.device.createRenderPipeline({
      layout: 'auto',
      vertex: {
        module: this.device.createShaderModule({
          code: `
        struct Inputs {
          @location(0) vertexPosition : f32,
          @location(1) vertexColor : vec4<f32>,
        };
        struct Outputs {
          @builtin(position) position : vec4<f32>,
          @location(0) color : vec4<f32>,
        };
        @vertex
        fn main(input : Inputs)-> Outputs {
          var outputs : Outputs;
          outputs.position =
            vec4<f32>(input.vertexPosition, 0.5, 0.0, 1.0);
          outputs.color = input.vertexColor;
          return outputs;
        }`,
        }),
        entryPoint: 'main',
        buffers: [
          {
            arrayStride,
            attributes: [
              {
                format: 'float32',
                offset: 0,
                shaderLocation: 0,
              },
              {
                format: 'unorm8x4',
                offset: 4,
                shaderLocation: 1,
              },
            ],
          },
        ],
      },
      fragment: {
        module: this.device.createShaderModule({
          code: `
        struct Input {
          @location(0) color : vec4<f32>
        };
        @fragment
        fn main(input : Input) -> @location(0) vec4<f32> {
          return input.color;
        }`,
        }),
        entryPoint: 'main',
        targets: [{ format: 'rgba8unorm' }],
      },
      primitive: {
        topology: 'point-list',
      },
    });
  }

  kVertexAttributeSize = 8;
}

export const g = makeTestGroup(VertexAndIndexStateTrackingTest);

g.test('set_index_buffer_without_changing_buffer')
  .desc(
    `
  Test that setting index buffer states (index format, offset, size) multiple times in different
  orders still keeps the correctness of each draw call.
`
  )
  .fn(async t => {
    // Initialize the index buffer with 5 uint16 indices (0, 1, 2, 3, 4).
    const indexBuffer = t.makeBufferWithContents(
      new Uint16Array([0, 1, 2, 3, 4]),
      GPUBufferUsage.INDEX
    );

    // Initialize the vertex buffer with required vertex attributes (position: f32, color: f32x4)
    // Note that the maximum index in the test is 0x10000.
    const kVertexAttributesCount = 0x10000 + 1;
    const vertexBuffer = t.device.createBuffer({
      usage: GPUBufferUsage.VERTEX,
      size: t.kVertexAttributeSize * kVertexAttributesCount,
      mappedAtCreation: true,
    });
    t.trackForCleanup(vertexBuffer);
    const vertexAttributes = vertexBuffer.getMappedRange();
    const kPositions = [-0.8, -0.4, 0.0, 0.4, 0.8, -0.4];
    const kColors = [
      new Uint8Array([255, 0, 0, 255]),
      new Uint8Array([255, 255, 255, 255]),
      new Uint8Array([0, 0, 255, 255]),
      new Uint8Array([255, 0, 255, 255]),
      new Uint8Array([0, 255, 255, 255]),
      new Uint8Array([0, 255, 0, 255]),
    ];
    // Set vertex attributes at index {0..4} in Uint16.
    // Note that the vertex attribute at index 1 will not be used.
    for (let i = 0; i < kPositions.length - 1; ++i) {
      const baseOffset = t.kVertexAttributeSize * i;
      const vertexPosition = new Float32Array(vertexAttributes, baseOffset, 1);
      vertexPosition[0] = kPositions[i];
      const vertexColor = new Uint8Array(vertexAttributes, baseOffset + 4, 4);
      vertexColor.set(kColors[i]);
    }
    // Set vertex attributes at index 0x10000.
    const lastOffset = t.kVertexAttributeSize * (kVertexAttributesCount - 1);
    const lastVertexPosition = new Float32Array(vertexAttributes, lastOffset, 1);
    lastVertexPosition[0] = kPositions[kPositions.length - 1];
    const lastVertexColor = new Uint8Array(vertexAttributes, lastOffset + 4, 4);
    lastVertexColor.set(kColors[kColors.length - 1]);

    vertexBuffer.unmap();

    const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);

    const outputTexture = t.device.createTexture({
      format: 'rgba8unorm',
      size: [kPositions.length - 1, 1, 1],
      usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
    });

    const encoder = t.device.createCommandEncoder();
    const renderPass = encoder.beginRenderPass({
      colorAttachments: [
        {
          view: outputTexture.createView(),
          clearValue: [0, 0, 0, 1],
          loadOp: 'clear',
          storeOp: 'store',
        },
      ],
    });
    renderPass.setPipeline(renderPipeline);
    renderPass.setVertexBuffer(0, vertexBuffer);

    // 1st draw: indexFormat = 'uint32', offset = 0, size = 4 (index value: 0x10000)
    renderPass.setIndexBuffer(indexBuffer, 'uint32', 0, 4);
    renderPass.drawIndexed(1);

    // 2nd draw: indexFormat = 'uint16', offset = 0, size = 4 (index value: 0)
    renderPass.setIndexBuffer(indexBuffer, 'uint16', 0, 4);
    renderPass.drawIndexed(1);

    // 3rd draw: indexFormat = 'uint16', offset = 4, size = 2 (index value: 2)
    renderPass.setIndexBuffer(indexBuffer, 'uint16', 0, 2);
    renderPass.setIndexBuffer(indexBuffer, 'uint16', 4, 2);
    renderPass.drawIndexed(1);

    // 4th draw: indexformat = 'uint16', offset = 6, size = 4 (index values: 3, 4)
    renderPass.setIndexBuffer(indexBuffer, 'uint16', 6, 2);
    renderPass.setIndexBuffer(indexBuffer, 'uint16', 6, 4);
    renderPass.drawIndexed(2);

    renderPass.end();
    t.queue.submit([encoder.finish()]);

    for (let i = 0; i < kPositions.length - 1; ++i) {
      const expectedColor = i === 1 ? kColors[kPositions.length - 1] : kColors[i];
      t.expectSinglePixelIn2DTexture(
        outputTexture,
        'rgba8unorm',
        { x: i, y: 0 },
        { exp: expectedColor }
      );
    }
  });

g.test('set_vertex_buffer_without_changing_buffer')
  .desc(
    `
  Test that setting vertex buffer states (offset, size) multiple times in different orders still
  keeps the correctness of each draw call.
  - Tries several different sequences of setVertexBuffer+draw commands, each of which draws vertices
    in all 4 output pixels, and check they were drawn correctly.
`
  )
  .fn(async t => {
    const kPositions = [-0.875, -0.625, -0.375, -0.125, 0.125, 0.375, 0.625, 0.875];
    const kColors = [
      new Uint8Array([255, 0, 0, 255]),
      new Uint8Array([0, 255, 0, 255]),
      new Uint8Array([0, 0, 255, 255]),
      new Uint8Array([51, 0, 0, 255]),
      new Uint8Array([0, 51, 0, 255]),
      new Uint8Array([0, 0, 51, 255]),
      new Uint8Array([255, 0, 255, 255]),
      new Uint8Array([255, 255, 0, 255]),
    ];

    // Initialize the vertex buffer with required vertex attributes (position: f32, color: f32x4)
    const kVertexAttributesCount = 8;
    const vertexBuffer = t.device.createBuffer({
      usage: GPUBufferUsage.VERTEX,
      size: t.kVertexAttributeSize * kVertexAttributesCount,
      mappedAtCreation: true,
    });
    t.trackForCleanup(vertexBuffer);
    const vertexAttributes = vertexBuffer.getMappedRange();
    for (let i = 0; i < kPositions.length; ++i) {
      const baseOffset = t.kVertexAttributeSize * i;
      const vertexPosition = new Float32Array(vertexAttributes, baseOffset, 1);
      vertexPosition[0] = kPositions[i];
      const vertexColor = new Uint8Array(vertexAttributes, baseOffset + 4, 4);
      vertexColor.set(kColors[i]);
    }

    vertexBuffer.unmap();

    const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);

    const outputTexture = t.device.createTexture({
      format: 'rgba8unorm',
      size: [kPositions.length, 1, 1],
      usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
    });

    const encoder = t.device.createCommandEncoder();
    const renderPass = encoder.beginRenderPass({
      colorAttachments: [
        {
          view: outputTexture.createView(),
          clearValue: [0, 0, 0, 1],
          loadOp: 'clear',
          storeOp: 'store',
        },
      ],
    });
    renderPass.setPipeline(renderPipeline);

    // Change 'size' in setVertexBuffer()
    renderPass.setVertexBuffer(0, vertexBuffer, 0, t.kVertexAttributeSize);
    renderPass.setVertexBuffer(0, vertexBuffer, 0, t.kVertexAttributeSize * 2);
    renderPass.draw(2);

    // Change 'offset' in setVertexBuffer()
    renderPass.setVertexBuffer(
      0,
      vertexBuffer,
      t.kVertexAttributeSize * 2,
      t.kVertexAttributeSize * 2
    );
    renderPass.draw(2);

    // Change 'size' again in setVertexBuffer()
    renderPass.setVertexBuffer(
      0,
      vertexBuffer,
      t.kVertexAttributeSize * 4,
      t.kVertexAttributeSize * 2
    );
    renderPass.setVertexBuffer(
      0,
      vertexBuffer,
      t.kVertexAttributeSize * 4,
      t.kVertexAttributeSize * 4
    );
    renderPass.draw(4);

    renderPass.end();
    t.queue.submit([encoder.finish()]);

    for (let i = 0; i < kPositions.length; ++i) {
      t.expectSinglePixelIn2DTexture(
        outputTexture,
        'rgba8unorm',
        { x: i, y: 0 },
        { exp: kColors[i] }
      );
    }
  });

g.test('change_pipeline_before_and_after_vertex_buffer')
  .desc(
    `
  Test that changing the pipeline {before,after} the vertex buffers still keeps the correctness of
  each draw call (In D3D12, the vertex buffer stride is part of SetVertexBuffer instead of the
  pipeline.)
`
  )
  .fn(async t => {
    const kPositions = [-0.8, -0.4, 0.0, 0.4, 0.8, 0.9];
    const kColors = [
      new Uint8Array([255, 0, 0, 255]),
      new Uint8Array([255, 255, 255, 255]),
      new Uint8Array([0, 255, 0, 255]),
      new Uint8Array([0, 0, 255, 255]),
      new Uint8Array([255, 0, 255, 255]),
      new Uint8Array([0, 255, 255, 255]),
    ];

    // Initialize the vertex buffer with required vertex attributes (position: f32, color: f32x4)
    const vertexBuffer = t.device.createBuffer({
      usage: GPUBufferUsage.VERTEX,
      size: t.kVertexAttributeSize * kPositions.length,
      mappedAtCreation: true,
    });
    t.trackForCleanup(vertexBuffer);
    // Note that kPositions[1], kColors[1], kPositions[5] and kColors[5] are not used.
    const vertexAttributes = vertexBuffer.getMappedRange();
    for (let i = 0; i < kPositions.length; ++i) {
      const baseOffset = t.kVertexAttributeSize * i;
      const vertexPosition = new Float32Array(vertexAttributes, baseOffset, 1);
      vertexPosition[0] = kPositions[i];
      const vertexColor = new Uint8Array(vertexAttributes, baseOffset + 4, 4);
      vertexColor.set(kColors[i]);
    }
    vertexBuffer.unmap();

    // Create two render pipelines with different vertex attribute strides
    const renderPipeline1 = t.GetRenderPipelineForTest(t.kVertexAttributeSize);
    const renderPipeline2 = t.GetRenderPipelineForTest(t.kVertexAttributeSize * 2);

    const kPointsCount = kPositions.length - 1;
    const outputTexture = t.device.createTexture({
      format: 'rgba8unorm',
      size: [kPointsCount, 1, 1],
      usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
    });

    const encoder = t.device.createCommandEncoder();
    const renderPass = encoder.beginRenderPass({
      colorAttachments: [
        {
          view: outputTexture.createView(),
          clearValue: [0, 0, 0, 1],
          loadOp: 'clear',
          storeOp: 'store',
        },
      ],
    });

    // Update render pipeline before setVertexBuffer. The applied vertex attribute stride should be
    // 2 * kVertexAttributeSize.
    renderPass.setPipeline(renderPipeline1);
    renderPass.setPipeline(renderPipeline2);
    renderPass.setVertexBuffer(0, vertexBuffer);
    renderPass.draw(2);

    // Update render pipeline after setVertexBuffer. The applied vertex attribute stride should be
    // kVertexAttributeSize.
    renderPass.setVertexBuffer(0, vertexBuffer, 3 * t.kVertexAttributeSize);
    renderPass.setPipeline(renderPipeline1);
    renderPass.draw(2);

    renderPass.end();

    t.queue.submit([encoder.finish()]);

    for (let i = 0; i < kPointsCount; ++i) {
      const expectedColor = i === 1 ? new Uint8Array([0, 0, 0, 255]) : kColors[i];
      t.expectSinglePixelIn2DTexture(
        outputTexture,
        'rgba8unorm',
        { x: i, y: 0 },
        { exp: expectedColor }
      );
    }
  });

g.test('set_vertex_buffer_but_not_used_in_draw')
  .desc(
    `
  Test that drawing after having set vertex buffer slots not used by the pipeline works correctly.
  - In the test there are 2 draw calls in the render pass. The first draw call uses 2 vertex buffers
    (position and color), and the second draw call only uses 1 vertex buffer (for color, the vertex
    position is defined as constant values in the vertex shader). The test verifies if both of these
    two draw calls work correctly.
  `
  )
  .fn(async t => {
    const kPositions = new Float32Array([-0.75, -0.25]);
    const kColors = new Uint8Array([255, 0, 0, 255, 0, 255, 0, 255]);

    // Initialize the vertex buffers with required vertex attributes (position: f32, color: f32x4)
    const kAttributeStride = 4;
    const positionBuffer = t.makeBufferWithContents(kPositions, GPUBufferUsage.VERTEX);
    const colorBuffer = t.makeBufferWithContents(kColors, GPUBufferUsage.VERTEX);

    const fragmentState: GPUFragmentState = {
      module: t.device.createShaderModule({
        code: `
      struct Input {
        @location(0) color : vec4<f32>
      };
      @fragment
      fn main(input : Input) -> @location(0) vec4<f32> {
        return input.color;
      }`,
      }),
      entryPoint: 'main',
      targets: [{ format: 'rgba8unorm' }],
    };

    // Create renderPipeline1 that uses both positionBuffer and colorBuffer.
    const renderPipeline1 = t.device.createRenderPipeline({
      layout: 'auto',
      vertex: {
        module: t.device.createShaderModule({
          code: `
        struct Inputs {
          @location(0) vertexColor : vec4<f32>,
          @location(1) vertexPosition : f32,
        };
        struct Outputs {
          @builtin(position) position : vec4<f32>,
          @location(0) color : vec4<f32>,
        };
        @vertex
        fn main(input : Inputs)-> Outputs {
          var outputs : Outputs;
          outputs.position =
            vec4<f32>(input.vertexPosition, 0.5, 0.0, 1.0);
          outputs.color = input.vertexColor;
          return outputs;
        }`,
        }),
        entryPoint: 'main',
        buffers: [
          {
            arrayStride: kAttributeStride,
            attributes: [
              {
                format: 'unorm8x4',
                offset: 0,
                shaderLocation: 0,
              },
            ],
          },
          {
            arrayStride: kAttributeStride,
            attributes: [
              {
                format: 'float32',
                offset: 0,
                shaderLocation: 1,
              },
            ],
          },
        ],
      },
      fragment: fragmentState,
      primitive: {
        topology: 'point-list',
      },
    });

    const renderPipeline2 = t.device.createRenderPipeline({
      layout: 'auto',
      vertex: {
        module: t.device.createShaderModule({
          code: `
        struct Inputs {
          @builtin(vertex_index) vertexIndex : u32,
          @location(0) vertexColor : vec4<f32>,
        };
        struct Outputs {
          @builtin(position) position : vec4<f32>,
          @location(0) color : vec4<f32>,
        };
        @vertex
        fn main(input : Inputs)-> Outputs {
          var kPositions = array<f32, 2> (0.25, 0.75);
          var outputs : Outputs;
          outputs.position =
              vec4(kPositions[input.vertexIndex], 0.5, 0.0, 1.0);
          outputs.color = input.vertexColor;
          return outputs;
        }`,
        }),
        entryPoint: 'main',
        buffers: [
          {
            arrayStride: kAttributeStride,
            attributes: [
              {
                format: 'unorm8x4',
                offset: 0,
                shaderLocation: 0,
              },
            ],
          },
        ],
      },
      fragment: fragmentState,
      primitive: {
        topology: 'point-list',
      },
    });

    const kPointsCount = 4;
    const outputTexture = t.device.createTexture({
      format: 'rgba8unorm',
      size: [kPointsCount, 1, 1],
      usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
    });

    const encoder = t.device.createCommandEncoder();
    const renderPass = encoder.beginRenderPass({
      colorAttachments: [
        {
          view: outputTexture.createView(),
          clearValue: [0, 0, 0, 1],
          loadOp: 'clear',
          storeOp: 'store',
        },
      ],
    });

    renderPass.setVertexBuffer(0, colorBuffer);
    renderPass.setVertexBuffer(1, positionBuffer);
    renderPass.setPipeline(renderPipeline1);
    renderPass.draw(2);

    renderPass.setPipeline(renderPipeline2);
    renderPass.draw(2);

    renderPass.end();

    t.queue.submit([encoder.finish()]);

    const kExpectedColors = [
      kColors.subarray(0, 4),
      kColors.subarray(4),
      kColors.subarray(0, 4),
      kColors.subarray(4),
    ];

    for (let i = 0; i < kPointsCount; ++i) {
      t.expectSinglePixelIn2DTexture(
        outputTexture,
        'rgba8unorm',
        { x: i, y: 0 },
        { exp: kExpectedColors[i] }
      );
    }
  });

g.test('set_index_buffer_before_non_indexed_draw')
  .desc(
    `
  Test that setting / not setting the index buffer does not impact a non-indexed draw.
  `
  )
  .fn(async t => {
    const kPositions = [-0.75, -0.25, 0.25, 0.75];
    const kColors = [
      new Uint8Array([255, 0, 0, 255]),
      new Uint8Array([0, 255, 0, 255]),
      new Uint8Array([0, 0, 255, 255]),
      new Uint8Array([255, 0, 255, 255]),
    ];

    // Initialize the vertex buffer with required vertex attributes (position: f32, color: f32x4)
    const vertexBuffer = t.device.createBuffer({
      usage: GPUBufferUsage.VERTEX,
      size: t.kVertexAttributeSize * kPositions.length,
      mappedAtCreation: true,
    });
    t.trackForCleanup(vertexBuffer);
    const vertexAttributes = vertexBuffer.getMappedRange();
    for (let i = 0; i < kPositions.length; ++i) {
      const baseOffset = t.kVertexAttributeSize * i;
      const vertexPosition = new Float32Array(vertexAttributes, baseOffset, 1);
      vertexPosition[0] = kPositions[i];
      const vertexColor = new Uint8Array(vertexAttributes, baseOffset + 4, 4);
      vertexColor.set(kColors[i]);
    }
    vertexBuffer.unmap();

    // Initialize the index buffer with 2 uint16 indices (2, 3).
    const indexBuffer = t.makeBufferWithContents(new Uint16Array([2, 3]), GPUBufferUsage.INDEX);

    const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);

    const kPointsCount = 4;
    const outputTexture = t.device.createTexture({
      format: 'rgba8unorm',
      size: [kPointsCount, 1, 1],
      usage: GPUTextureUsage.COPY_SRC | GPUTextureUsage.RENDER_ATTACHMENT,
    });

    const encoder = t.device.createCommandEncoder();
    const renderPass = encoder.beginRenderPass({
      colorAttachments: [
        {
          view: outputTexture.createView(),
          clearValue: [0, 0, 0, 1],
          loadOp: 'clear',
          storeOp: 'store',
        },
      ],
    });

    // The first draw call is an indexed one (the third and fourth color are involved)
    renderPass.setVertexBuffer(0, vertexBuffer);
    renderPass.setIndexBuffer(indexBuffer, 'uint16');
    renderPass.setPipeline(renderPipeline);
    renderPass.drawIndexed(2);

    // The second draw call is a non-indexed one (the first and second color are involved)
    renderPass.draw(2);

    renderPass.end();

    t.queue.submit([encoder.finish()]);

    for (let i = 0; i < kPointsCount; ++i) {
      t.expectSinglePixelIn2DTexture(
        outputTexture,
        'rgba8unorm',
        { x: i, y: 0 },
        { exp: kColors[i] }
      );
    }
  });