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 // Destroy the device, making it invalid.
22 // Creating a buffer on an invalid device will create an invalid
24 const buffer
= device
.createBuffer({
27 GPUBufferUsage
.COPY_DST
|
28 GPUBufferUsage
.COPY_SRC
|
29 GPUBufferUsage
.VERTEX
,
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();
40 .catch(e
=> ok(false, "Unhandled exception " + e
))
41 .finally(() => SimpleTest
.finish());