From d11df98de6f69e698af1d3a5d49588eed615d175 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 21 May 2026 11:14:49 -0700 Subject: [PATCH] Restrict GL canvas size to a reasonable value instead of letting Firefox go crazy. --- test/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/index.html b/test/index.html index 451052a..1660fb8 100644 --- a/test/index.html +++ b/test/index.html @@ -28,13 +28,13 @@ SPDX-License-Identifier: GPL-3.0-or-later const glSize = (canvas => { const gl = canvas.getContext('webgl2') - const MAX_VIEWPORT_DIMS = gl.getParameter(gl.MAX_VIEWPORT_DIMS) - canvas.height = MAX_VIEWPORT_DIMS?.[0] ?? 0x1000 - canvas.width = MAX_VIEWPORT_DIMS?.[1] ?? 0x1000 - return gl.drawingBufferHeight < gl.drawingBufferWidth ? gl.drawingBufferHeight : gl.drawingBufferWidth + const MAX_VIEWPORT_DIMS = gl?.getParameter(gl.MAX_VIEWPORT_DIMS) + const size = Math.min(0x2000, ...MAX_VIEWPORT_DIMS) || 0x1000 + canvas.height = canvas.width = size + return gl?.drawingBufferHeight < gl?.drawingBufferWidth ? gl?.drawingBufferHeight : gl?.drawingBufferWidth })(new OffscreenCanvas(0, 0)) - function random (size = 64) { + function random(size = 64) { let hex = '' while (hex.length < size) { hex += crypto.randomUUID().replace(/-.*-/g, '') -- 2.52.0