Skip to content

Commit 6fcbc57

Browse files
committed
Test pass but not encoder ended in encoder_open_state
1 parent c948211 commit 6fcbc57

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

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

Lines changed: 14 additions & 10 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

@@ -420,7 +420,9 @@ g.test('render_pass_commands')
420420
default:
421421
unreachable();
422422
}
423-
}, finishBeforeCommand);
423+
}, finishBeforeCommand === 'encoder');
424+
// TODO(https://github.com/gpuweb/gpuweb/issues/5207): resolve whether this
425+
// is correct or should be changed to `finishBeforeCommand !== 'no'`.
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 === 'encoder');
600+
// TODO(https://github.com/gpuweb/gpuweb/issues/5207): resolve whether this
601+
// is correct or should be changed to `finishBeforeCommand !== 'no'`.
598602
});

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ g.test('pass_begin_invalid_encoder')
275275
const querySet = t.trackForCleanup(
276276
t.device.createQuerySet({
277277
type: 'timestamp',
278-
count: 1,
278+
count: 2,
279279
})
280280
);
281281

@@ -291,7 +291,7 @@ g.test('pass_begin_invalid_encoder')
291291
const mismatchedQuerySet = t.trackForCleanup(
292292
t.mismatchedDevice.createQuerySet({
293293
type: 'timestamp',
294-
count: 1,
294+
count: 2,
295295
})
296296
);
297297

0 commit comments

Comments
 (0)