Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / dom / webgpu / mochitest / test_queue_write_invalid_device.html
blobd634a19b8393d195f2137f7a9b3713f7f84acb39
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 // Destroy the device, making it invalid.
20 device.destroy();
22 // Creating a buffer on an invalid device will create an invalid
23 // buffer.
24 const buffer = device.createBuffer({
25 size: 16,
26 usage:
27 GPUBufferUsage.COPY_DST |
28 GPUBufferUsage.COPY_SRC |
29 GPUBufferUsage.VERTEX,
30 });
31 const arrayBuf = new ArrayBuffer(16);
32 new Int32Array(arrayBuf).fill(5);
34 // Writing to an invalid buffer should not throw an error.
35 device.queue.writeBuffer(buffer, 0, arrayBuf, 0);
38 SimpleTest.waitForExplicitFinish();
39 func()
40 .catch(e => ok(false, "Unhandled exception " + e))
41 .finally(() => SimpleTest.finish());
42 </script>
43 </body>
44 </html>