mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-08 20:28:42 +02:00
addresses 1600364 Differential Revision: https://phabricator.services.mozilla.com/D56603 --HG-- extra : moz-landing-system : lando
34 lines
893 B
HTML
34 lines
893 B
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta charset='utf-8'>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
|
</head>
|
|
<body>
|
|
<script>
|
|
|
|
ok(SpecialPowers.getBoolPref('dom.webgpu.enabled'), 'Pref should be enabled.');
|
|
|
|
const func = async function() {
|
|
const adapter = await navigator.gpu.requestAdapter();
|
|
const device = await adapter.requestDevice();
|
|
const [buffer, mapping] = await device.createBufferMapped({
|
|
size: 4,
|
|
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_SRC, //TODO: remove the dummy usage
|
|
});
|
|
new Float32Array(mapping).set([1.0]);
|
|
buffer.unmap();
|
|
const data = await buffer.mapReadAsync();
|
|
const value = new Float32Array(data)[0];
|
|
buffer.unmap();
|
|
ok(value == 1.0, 'value == 1.0');
|
|
};
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
func().finally(() => SimpleTest.finish());
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|