summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/encoding/cmds/debug.spec.ts
blob: c8a3bdbbe45b46e83683b79d595a11de1134d34a (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
export const description = `
API validation test for debug groups and markers

Test Coverage:
  - For each encoder type (GPUCommandEncoder, GPUComputeEncoder, GPURenderPassEncoder,
  GPURenderBundleEncoder):
    - Test that all pushDebugGroup must have a corresponding popDebugGroup
      - Push and pop counts of 0, 1, and 2 will be used.
      - An error must be generated for non matching counts.
    - Test calling pushDebugGroup with empty and non-empty strings.
    - Test inserting a debug marker with empty and non-empty strings.
`;

import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { kEncoderTypes } from '../../../../util/command_buffer_maker.js';
import { ValidationTest } from '../../validation_test.js';

export const g = makeTestGroup(ValidationTest);

g.test('debug_group_balanced')
  .params(u =>
    u
      .combine('encoderType', kEncoderTypes)
      .beginSubcases()
      .combine('pushCount', [0, 1, 2])
      .combine('popCount', [0, 1, 2])
  )
  .fn(t => {
    const { encoder, validateFinishAndSubmit } = t.createEncoder(t.params.encoderType);
    for (let i = 0; i < t.params.pushCount; ++i) {
      encoder.pushDebugGroup(`${i}`);
    }
    for (let i = 0; i < t.params.popCount; ++i) {
      encoder.popDebugGroup();
    }
    validateFinishAndSubmit(t.params.pushCount === t.params.popCount, true);
  });

g.test('debug_group')
  .params(u =>
    u //
      .combine('encoderType', kEncoderTypes)
      .beginSubcases()
      .combine('label', ['', 'group'])
  )
  .fn(t => {
    const { encoder, validateFinishAndSubmit } = t.createEncoder(t.params.encoderType);
    encoder.pushDebugGroup(t.params.label);
    encoder.popDebugGroup();
    validateFinishAndSubmit(true, true);
  });

g.test('debug_marker')
  .params(u =>
    u //
      .combine('encoderType', kEncoderTypes)
      .beginSubcases()
      .combine('label', ['', 'marker'])
  )
  .fn(t => {
    const { encoder, validateFinishAndSubmit } = t.createEncoder(t.params.encoderType);
    encoder.insertDebugMarker(t.params.label);
    validateFinishAndSubmit(true, true);
  });