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
|
export const description = `
Test validation of pushDebugGroup, popDebugGroup, and insertDebugMarker.
`;
import { makeTestGroup } from '../../../common/framework/test_group.js';
import { ValidationTest } from './validation_test.js';
class F extends ValidationTest {
beginRenderPass(commandEncoder: GPUCommandEncoder): GPURenderPassEncoder {
const attachmentTexture = this.device.createTexture({
format: 'rgba8unorm',
size: { width: 16, height: 16, depthOrArrayLayers: 1 },
usage: GPUTextureUsage.RENDER_ATTACHMENT,
});
this.trackForCleanup(attachmentTexture);
return commandEncoder.beginRenderPass({
colorAttachments: [
{
view: attachmentTexture.createView(),
clearValue: { r: 1.0, g: 0.0, b: 0.0, a: 1.0 },
loadOp: 'clear',
storeOp: 'store',
},
],
});
}
}
export const g = makeTestGroup(F);
g.test('push_pop_call_count_unbalance,command_encoder')
.desc(
`
Test that a validation error is generated if {push,pop} debug group call count is not paired.
`
)
.paramsSubcasesOnly(u =>
u //
.combine('pushCount', [1, 2, 3])
.combine('popCount', [1, 2, 3])
)
.fn(async t => {
const { pushCount, popCount } = t.params;
const encoder = t.device.createCommandEncoder();
for (let i = 0; i < pushCount; ++i) {
encoder.pushDebugGroup('EventStart');
}
encoder.insertDebugMarker('Marker');
for (let i = 0; i < popCount; ++i) {
encoder.popDebugGroup();
}
t.expectValidationError(() => {
encoder.finish();
}, pushCount !== popCount);
});
g.test('push_pop_call_count_unbalance,render_compute_pass')
.desc(
`
Test that a validation error is generated if {push,pop} debug group call count is not paired in
ComputePassEncoder and RenderPassEncoder.
`
)
.params(u =>
u //
.combine('passType', ['compute', 'render'])
.beginSubcases()
.combine('pushCount', [1, 2, 3])
.combine('popCount', [1, 2, 3])
)
.fn(async t => {
const { passType, pushCount, popCount } = t.params;
const encoder = t.device.createCommandEncoder();
const pass = passType === 'compute' ? encoder.beginComputePass() : t.beginRenderPass(encoder);
for (let i = 0; i < pushCount; ++i) {
pass.pushDebugGroup('EventStart');
}
pass.insertDebugMarker('Marker');
for (let i = 0; i < popCount; ++i) {
pass.popDebugGroup();
}
t.expectValidationError(() => {
pass.end();
encoder.finish();
}, pushCount !== popCount);
});
|