Skip to content

Commit

Permalink
Add 'render_pass_and_bundle,device_mismatch' test to attachment_compa…
Browse files Browse the repository at this point in the history
…tibility.spec.ts

This PR adds a test to ensure that render passes cannot be called with
bundles created from another device.

Issue: #912
  • Loading branch information
Gyuyoung committed Sep 22, 2022
1 parent 2a4dfd9 commit f0951f7
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,31 @@ g.test('render_pass_and_bundle,sample_count')
validateFinishAndSubmit(renderSampleCount === bundleSampleCount, true);
});

g.test('render_pass_and_bundle,device_mismatch')
.desc('Test that render passes cannot be called with bundles created from another device.')
.paramsSubcasesOnly(u => u.combine('mismatched', [true, false]))
.beforeAllSubcases(t => {
t.selectMismatchedDeviceOrSkipTestCase(undefined);
})
.fn(t => {
const { mismatched } = t.params;
const device = mismatched ? t.mismatchedDevice : t.device;

const format = 'r16float';
const bundleEncoder = device.createRenderBundleEncoder({
colorFormats: [format],
});
const bundle = bundleEncoder.finish();

const { encoder, validateFinishAndSubmit } = t.createEncoder('non-pass');
const pass = encoder.beginRenderPass({
colorAttachments: [t.createColorAttachment(format)],
});
pass.executeBundles([bundle]);
pass.end();
validateFinishAndSubmit(!mismatched, true);
});

g.test('render_pass_or_bundle_and_pipeline,color_format')
.desc(
`
Expand Down

0 comments on commit f0951f7

Please sign in to comment.