Bug 1928997: Update tabs icon in Unified Search popup r=desktop-theme-reviewers,daleh...
[gecko.git] / dom / webgpu / mochitest / test_submit_render_empty.html
blob5ebe06ff3a8725931893770230051e3f7db3ede7
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8" />
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" href="/tests/SimpleTest/test.css" />
7 </head>
8 <body>
9 <script>
10 ok(
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],
22 });
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,
29 });
30 const view = texture.createView();
32 const encoder = device.createCommandEncoder();
33 const pass = encoder.beginRenderPass({
34 colorAttachments: [
36 view,
37 clearValue: { r: 0, g: 0, b: 0, a: 0 },
38 loadOp: "clear",
39 storeOp: "store",
42 });
43 pass.executeBundles([bundle]);
44 pass.end();
45 const command_buffer = encoder.finish();
47 device.queue.submit([command_buffer]);
48 ok(command_buffer !== undefined, "command_buffer !== undefined");
51 SimpleTest.waitForExplicitFinish();
52 func()
53 .catch(e => ok(false, "Unhandled exception " + e))
54 .finally(() => SimpleTest.finish());
55 </script>
56 </body>
57 </html>