summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/render_pipeline/primitive_state.spec.ts
blob: 9868bdcac10de9ce3a320609e5f22a16e59d45f8 (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
export const description = `
This test dedicatedly tests validation of GPUPrimitiveState of createRenderPipeline.
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { kPrimitiveTopology, kIndexFormat } from '../../../capability_info.js';

import { CreateRenderPipelineValidationTest } from './common.js';

export const g = makeTestGroup(CreateRenderPipelineValidationTest);

g.test('strip_index_format')
  .desc(
    `If primitive.topology is not "line-strip" or "triangle-strip", primitive.stripIndexFormat must be undefined.`
  )
  .params(u =>
    u
      .combine('isAsync', [false, true])
      .combine('topology', [undefined, ...kPrimitiveTopology] as const)
      .combine('stripIndexFormat', [undefined, ...kIndexFormat] as const)
  )
  .fn(async t => {
    const { isAsync, topology, stripIndexFormat } = t.params;

    const descriptor = t.getDescriptor({ primitive: { topology, stripIndexFormat } });

    const _success =
      topology === 'line-strip' || topology === 'triangle-strip' || stripIndexFormat === undefined;
    t.doCreateRenderPipelineTest(isAsync, _success, descriptor);
  });

g.test('unclipped_depth')
  .desc(`If primitive.unclippedDepth is true, features must contain "depth-clip-control".`)
  .params(u => u.combine('isAsync', [false, true]).combine('unclippedDepth', [false, true]))
  .fn(async t => {
    const { isAsync, unclippedDepth } = t.params;

    const descriptor = t.getDescriptor({ primitive: { unclippedDepth } });

    const _success = !unclippedDepth || t.device.features.has('depth-clip-control');
    t.doCreateRenderPipelineTest(isAsync, _success, descriptor);
  });