From 7b5d69e164a29a2308089a5d7521eb23c576cee3 Mon Sep 17 00:00:00 2001 From: funman300 Date: Tue, 23 Jun 2026 17:44:46 -0700 Subject: [PATCH] fix(web): clamp /play canvas to GPU MAX_TEXTURE_SIZE to stop wgpu panic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rhys hit a fatal wgpu validation panic loading /play on a 1440p display: Surface::configure ... Requested was (2560, 1440), maximum extent for either dimension is 2048 The earlier scale_factor_override(1.0) fix only neutralised HiDPI (CSS×DPR); it didn't help when the *logical* viewport itself exceeds 2048. `fit_canvas_to_ parent` sizes the wgpu surface to the canvas's parent, so a 2560-wide viewport configures a 2560-wide surface — past WebGL2's 2048 per-dimension limit on laptop/integrated GPUs, and the panic kills the WASM thread on the first frame. Wrap the canvas in #bevy-wrap and, before init, clamp that element's max- width/height to the device's actual gl.MAX_TEXTURE_SIZE (falling back to the 2048 WebGL2 floor). fit_canvas_to_parent then never produces a surface larger than the GPU allows. Only devices at the 2048 floor letterbox (centered); GPUs that report 4096/8192 still fill the viewport. Co-Authored-By: Claude Opus 4.8 (1M context) --- solitaire_server/web/play.html | 37 ++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/solitaire_server/web/play.html b/solitaire_server/web/play.html index 9b0ca6f..44bbb1c 100644 --- a/solitaire_server/web/play.html +++ b/solitaire_server/web/play.html @@ -7,11 +7,44 @@ - +
+