Skip to content

Commit 8fcd343

Browse files
committed
Test pass but not encoder ended in encoder_open_state
1 parent c948211 commit 8fcd343

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/webgpu/api/validation/encoding/encoder_open_state.spec.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,13 @@ g.test('render_pass_commands')
274274
`
275275
Test that functions of GPURenderPassEncoder generate a validation error if the encoder or the
276276
pass is already finished.
277-
278-
- TODO: Consider testing: nothing before command, end before command, end+finish before command.
279277
`
280278
)
281279
.params(u =>
282280
u
283281
.combine('command', kRenderPassEncoderCommands)
284282
.beginSubcases()
285-
.combine('finishBeforeCommand', [false, true])
283+
.combine('finishBeforeCommand', ['no', 'pass', 'encoder'])
286284
)
287285
.fn(t => {
288286
const { command, finishBeforeCommand } = t.params;
@@ -305,8 +303,10 @@ g.test('render_pass_commands')
305303

306304
const bindGroup = t.createBindGroupForTest();
307305

308-
if (finishBeforeCommand) {
306+
if (finishBeforeCommand !== 'no') {
309307
renderPass.end();
308+
}
309+
if (finishBeforeCommand === 'encoder') {
310310
encoder.finish();
311311
}
312312

@@ -404,23 +404,25 @@ g.test('render_pass_commands')
404404
break;
405405
case 'pushDebugGroup':
406406
{
407-
encoder.pushDebugGroup('group');
407+
renderPass.pushDebugGroup('group');
408408
}
409409
break;
410410
case 'popDebugGroup':
411411
{
412-
encoder.popDebugGroup();
412+
renderPass.popDebugGroup();
413413
}
414414
break;
415415
case 'insertDebugMarker':
416416
{
417-
encoder.insertDebugMarker('marker');
417+
renderPass.insertDebugMarker('marker');
418418
}
419419
break;
420420
default:
421421
unreachable();
422422
}
423-
}, finishBeforeCommand);
423+
}, finishBeforeCommand !== 'no');
424+
// TODO(https://github.com/gpuweb/gpuweb/issues/5207): resolve whether this
425+
// is correct or should be changed to `finishBeforeCommand === 'encoder'`.
424426
});
425427

426428
g.test('render_bundle_commands')
@@ -524,15 +526,13 @@ g.test('compute_pass_commands')
524526
`
525527
Test that functions of GPUComputePassEncoder generate a validation error if the encoder or the
526528
pass is already finished.
527-
528-
- TODO: Consider testing: nothing before command, end before command, end+finish before command.
529529
`
530530
)
531531
.params(u =>
532532
u
533533
.combine('command', kComputePassEncoderCommands)
534534
.beginSubcases()
535-
.combine('finishBeforeCommand', [false, true])
535+
.combine('finishBeforeCommand', ['no', 'pass', 'encoder'])
536536
)
537537
.fn(t => {
538538
const { command, finishBeforeCommand } = t.params;
@@ -549,8 +549,10 @@ g.test('compute_pass_commands')
549549

550550
const bindGroup = t.createBindGroupForTest();
551551

552-
if (finishBeforeCommand) {
552+
if (finishBeforeCommand !== 'no') {
553553
computePass.end();
554+
}
555+
if (finishBeforeCommand === 'encoder') {
554556
encoder.finish();
555557
}
556558

@@ -594,5 +596,7 @@ g.test('compute_pass_commands')
594596
default:
595597
unreachable();
596598
}
597-
}, finishBeforeCommand);
599+
}, finishBeforeCommand !== 'no');
600+
// TODO(https://github.com/gpuweb/gpuweb/issues/5207): resolve whether this
601+
// is correct or should be changed to `finishBeforeCommand === 'encoder'`.
598602
});

src/webgpu/api/validation/encoding/encoder_state.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ g.test('pass_end_invalid_order')
8181

8282
const passes = [firstPass, secondPass];
8383
for (const index of endPasses) {
84+
// TODO(https://github.com/gpuweb/gpuweb/issues/5207): should a validation error
85+
// be raised here if `!firstPassEnd && endPasses = [1, 0]`?
8486
passes[index].end();
8587
}
8688

@@ -275,7 +277,7 @@ g.test('pass_begin_invalid_encoder')
275277
const querySet = t.trackForCleanup(
276278
t.device.createQuerySet({
277279
type: 'timestamp',
278-
count: 1,
280+
count: 2,
279281
})
280282
);
281283

@@ -291,7 +293,7 @@ g.test('pass_begin_invalid_encoder')
291293
const mismatchedQuerySet = t.trackForCleanup(
292294
t.mismatchedDevice.createQuerySet({
293295
type: 'timestamp',
294-
count: 1,
296+
count: 2,
295297
})
296298
);
297299

0 commit comments

Comments
 (0)