<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./webgpu-helpers.js"></script>
</head>
<h1>Canvas2D WebGPU Transfer: transferToGPUTexture-texture-readback</h1>
<p>transferToGPUTexture() texture retains the contents of the canvas, and
readback works.</p>
<canvas id="c" width="50" height="50"></canvas>
<script>
promise_test(() => {
return with_webgpu((adapter, adapterInfo, device) => {
return test_transferToGPUTexture_texture_readback(
device,
document.getElementById('c'));
});
},
'transferToGPUTexture() texture retains the contents of the canvas, ' +
'and readback works.'
);
promise_test(() => {
return with_webgpu((adapter, adapterInfo, device) => {
return test_transferToGPUTexture_texture_readback(
device,
new OffscreenCanvas(50, 50));
});
},
'transferToGPUTexture() texture retains the contents of the offscreen ' +
'canvas, and readback works.'
);
</script>