fix(web): use adapter limits (Functionality) so /play renders at native res
The 2048 surface limit was never wgpu's or the GPU's — it's downlevel_webgl2_defaults().max_texture_dimension_2d (2048), which WgpuSettingsPriority::WebGL2 forces. Switch to Functionality: on the WebGL2 (Gl) backend Bevy then adopts the adapter's real limits, which are still WebGL2-constrained for features/buffers (shaders stay GLES-compatible) but report the GPU's true max texture dimension (e.g. 16384). The device is requested with exactly what the adapter offers, so creation can't fail, the surface is no longer capped, and large viewports (4K) render with no letterbox and no hardcoded cap. Removes the resize_constraints cap and the play.html max-width/height caps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -7,23 +7,10 @@
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
html, body { height: 100%; background: #000; overflow: hidden; }
|
||||
/* Cap the canvas at WebGL2's 2048 max texture dimension (this mirrors
|
||||
the Window `resize_constraints` in solitaire_web/src/lib.rs — winit
|
||||
applies that constraint as the canvas's own max-width/max-height).
|
||||
On wasm Bevy creates the device with downlevel_webgl2_defaults()
|
||||
whose max_texture_dimension_2d is a fixed 2048, so a larger surface
|
||||
(e.g. a 4K display at 150% scale → a 2560x1440 logical viewport)
|
||||
makes Surface::configure panic. `max-*` directly on the canvas keeps
|
||||
the surface ≤ 2048 regardless of how fit_canvas_to_parent resolves
|
||||
its 100% width; `margin: 0 auto` centres the letterbox horizontally. */
|
||||
#bevy-canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
max-width: 2048px;
|
||||
max-height: 2048px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
/* No size cap: the wgpu device now takes its max_texture_dimension from
|
||||
the adapter (see solitaire_web/src/lib.rs), so the surface can match
|
||||
the full viewport. fit_canvas_to_parent sizes the canvas to 100%. */
|
||||
#bevy-canvas { display: block; width: 100%; height: 100%; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user