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();
18 const buffer
= device
.createBuffer({
21 GPUBufferUsage
.COPY_DST
|
22 GPUBufferUsage
.COPY_SRC
|
23 GPUBufferUsage
.VERTEX
,
25 const arrayBuf
= new ArrayBuffer(16);
26 new Int32Array(arrayBuf
).fill(5);
27 device
.queue
.writeBuffer(buffer
, 0, arrayBuf
, 0);
28 const texture
= device
.createTexture({
32 usage
: GPUTextureUsage
.COPY_DST
| GPUTextureUsage
.COPY_SRC
,
34 device
.queue
.writeTexture(
40 // this isn't a process check, we need to read back the contents and verify the writes happened
41 ok(device
!== undefined, "");
44 SimpleTest
.waitForExplicitFinish();
46 .catch(e
=> ok(false, "Unhandled exception " + e
))
47 .finally(() => SimpleTest
.finish());