Skip to content

Commit

Permalink
timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
perryuwang committed Apr 17, 2024
1 parent 4765dc5 commit 2a3dd68
Showing 1 changed file with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { runRefTest } from './gpu_ref_test.js';
import { assert } from '../../../common/util/util.js';
import { timeout } from '../../../common/util/timeout.js';
import { takeScreenshotDelayed } from '../../../common/util/wpt_reftest_wait.js';

runRefTest(t => {
const device = t.device;
void (async () => {
assert(
typeof navigator !== 'undefined' && navigator.gpu !== undefined,
'No WebGPU implementation found'
);

const adapter = await navigator.gpu.requestAdapter();
assert(adapter !== null);
const device = await adapter.requestDevice();
assert(device !== null);
const presentationFormat = navigator.gpu.getPreferredCanvasFormat();
let deviceLost = false;

Expand Down Expand Up @@ -45,9 +55,11 @@ runRefTest(t => {
if (!deviceLost) {
device.destroy();
deviceLost = true;
timeout(drawAll, 100);
} else {
takeScreenshotDelayed(50);
}
}

drawAll();
requestAnimationFrame(drawAll);
});
})();

0 comments on commit 2a3dd68

Please sign in to comment.