learn-wgpu icon indicating copy to clipboard operation
learn-wgpu copied to clipboard

web version of tutorial5 appears to repeatedly resize canvas until is big enough to trigger a panic in wgpu

Open mutantbob opened this issue 2 months ago • 2 comments

I copied the tutorial5-textures beginners example and wrapped it in a simple index.html with a 400x400 <canvas id="canvas".

When I load the page in firefox the WindowEvent::Resized appears to be sent to window_event() repeatedly, increasing each time until the wgpu crate gives a validation error. It evidently doesn't like that we got resized to 2383x2383 and wants each dimension to be <= 2048 .

I am currently struggling to find a tool that will let me turn the wasm stack traces into rust function numbers, so I'm not able to investigate if there's an oddity in the wgpu framework, or some other problem. Can anyone else reproduce this problem in firefox?

mutantbob avatar Oct 08 '25 15:10 mutantbob

Yes, I also encountered this problem in both firefox and microsoft edge This can be fixed by replacing (for example) https://github.com/sotrh/learn-wgpu/blob/f241ba62ea88be73a8a7bfd72ed30d43bfb42163/code/beginner/tutorial8-depth/src/lib.rs#L323 with wgpu::Limits::downlevel_webgl2_defaults().using_resolution(adapter.limits());

ValorZard avatar Oct 13 '25 01:10 ValorZard

@ValorZard do you mind creating a PR with that change?

sotrh avatar Oct 25 '25 18:10 sotrh