diff --git a/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.html.ts b/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.html.ts
index 834d4ffc17e8..161ae01d63b9 100644
--- a/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.html.ts
+++ b/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.html.ts
@@ -15,42 +15,50 @@ void (async () => {
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
let deviceLost = false;
- function draw(canvasId: string, alphaMode: GPUCanvasAlphaMode, abortAfterDeviceLost: boolean) {
- if (deviceLost && abortAfterDeviceLost) {
- return;
- }
-
+ function draw(
+ canvasId: string,
+ alphaMode: GPUCanvasAlphaMode,
+ {
+ reconfigureAfterLost,
+ drawAfterLost,
+ }: { reconfigureAfterLost: boolean; drawAfterLost: boolean }
+ ) {
const canvas = document.getElementById(canvasId) as HTMLCanvasElement;
const ctx = canvas.getContext('webgpu') as unknown as GPUCanvasContext;
- ctx.configure({
- device,
- format: presentationFormat,
- alphaMode,
- });
+ if (!deviceLost || reconfigureAfterLost) {
+ ctx.configure({ device, format: presentationFormat, alphaMode });
+ }
- const colorAttachment = ctx.getCurrentTexture();
- const colorAttachmentView = colorAttachment.createView();
+ if (!deviceLost || drawAfterLost) {
+ const colorAttachment = ctx.getCurrentTexture();
+ const colorAttachmentView = colorAttachment.createView();
- const encoder = device.createCommandEncoder();
- const pass = encoder.beginRenderPass({
- colorAttachments: [
- {
- view: colorAttachmentView,
- clearValue: { r: 0.4, g: 1.0, b: 0.0, a: 1.0 },
- loadOp: 'clear',
- storeOp: 'store',
- },
- ],
- });
- pass.end();
- device.queue.submit([encoder.finish()]);
+ const encoder = device.createCommandEncoder();
+ const pass = encoder.beginRenderPass({
+ colorAttachments: [
+ {
+ view: colorAttachmentView,
+ clearValue: { r: 0.4, g: 1.0, b: 0.0, a: 1.0 },
+ loadOp: 'clear',
+ storeOp: 'store',
+ },
+ ],
+ });
+ pass.end();
+ device.queue.submit([encoder.finish()]);
+ }
}
function drawAll() {
- draw('cvs0', 'opaque', true);
- draw('cvs1', 'opaque', false);
- draw('cvs2', 'premultiplied', true);
- draw('cvs3', 'premultiplied', false);
+ draw('cvs00', 'opaque', { reconfigureAfterLost: false, drawAfterLost: false });
+ draw('cvs01', 'opaque', { reconfigureAfterLost: false, drawAfterLost: true });
+ draw('cvs02', 'premultiplied', { reconfigureAfterLost: false, drawAfterLost: false });
+ draw('cvs03', 'premultiplied', { reconfigureAfterLost: false, drawAfterLost: true });
+
+ draw('cvs10', 'opaque', { reconfigureAfterLost: true, drawAfterLost: false });
+ draw('cvs11', 'opaque', { reconfigureAfterLost: true, drawAfterLost: true });
+ draw('cvs12', 'premultiplied', { reconfigureAfterLost: true, drawAfterLost: false });
+ draw('cvs13', 'premultiplied', { reconfigureAfterLost: true, drawAfterLost: true });
if (!deviceLost) {
device.destroy();
diff --git a/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.https.html b/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.https.html
index 03ff43580a0e..eee6fad2ebbe 100644
--- a/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.https.html
+++ b/src/webgpu/web_platform/reftests/canvas_display_after_device_lost.https.html
@@ -8,9 +8,14 @@
-
-
-
-
+
+
+
+
+
+
+
+
+