diff options
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/debugMarker.spec.ts')
-rw-r--r-- | dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/debugMarker.spec.ts | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/debugMarker.spec.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/debugMarker.spec.ts new file mode 100644 index 0000000000..2f1f7a2adf --- /dev/null +++ b/dom/webgpu/tests/cts/checkout/src/webgpu/api/validation/debugMarker.spec.ts @@ -0,0 +1,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); + }); |