4 <meta charset=
"utf-8" />
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css" />
11 SpecialPowers
.getBoolPref("dom.webgpu.enabled"),
12 "Pref should be enabled."
15 const func
= async
function () {
16 const adapter
= await navigator
.gpu
.requestAdapter();
17 const device
= await adapter
.requestDevice();
19 const swapChainFormat
= "rgba8unorm";
20 const bundleEncoder
= device
.createRenderBundleEncoder({
21 colorFormats
: [swapChainFormat
],
23 const bundle
= bundleEncoder
.finish({});
25 const texture
= device
.createTexture({
26 size
: { width
: 100, height
: 100, depth
: 1 },
27 format
: swapChainFormat
,
28 usage
: GPUTextureUsage
.RENDER_ATTACHMENT
,
30 const view
= texture
.createView();
32 const encoder
= device
.createCommandEncoder();
33 const pass
= encoder
.beginRenderPass({
37 clearValue
: { r
: 0, g
: 0, b
: 0, a
: 0 },
43 pass
.executeBundles([bundle
]);
45 const command_buffer
= encoder
.finish();
47 device
.queue
.submit([command_buffer
]);
48 ok(command_buffer
!== undefined, "command_buffer !== undefined");
51 SimpleTest
.waitForExplicitFinish();
53 .catch(e
=> ok(false, "Unhandled exception " + e
))
54 .finally(() => SimpleTest
.finish());