Open smessmer opened 1 year ago
I did some digging on this back in April, here is what I found https://github.com/rust-windowing/winit/issues/2524#issuecomment-1518987014 I took another look today and was able to fix this on my Pixel device for Vanadium and Brave with Bevy 0.11 by doing a couple of things.
For my use-case I am filling the whole page with my canvas.
.add_plugins(DefaultPlugins.build().set(WindowPlugin {
primary_window: Some(Window {
fit_canvas_to_parent: true,
..default()
}),
..default()
}))
This combined with the devicePixelRatio
of 2.65 was causing the wgpu texture to be too big.
To fix it I add this meta tag to the html head
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
I'm not sure if the winit change was actually required because I hadn't tried the meta tag until today.
side-note: for some reason the body has a margin side by default so in my css I also add
body {
margin: 0;
}
@jroddev I'm trying this to no success, is this still working for you using latest tagged bevy? or main branch?
@miketwenty1 I actually can no longer reproduce the problem with my example projects and my device. Tested with Bevy 10, 11, and 12.
I thought maybe it was patched on the device, but Chromium is still reporting window.devicePixelRatio
as 2.625.
I'm on bevy main branch right now. but this was still an issue for me on 10, 11, and 12. the specific device is a pixel 6 pro with a pixel ratio of 3.5.
I'm not sure, sorry. I tried again and cannot reproduce with or without my line anymore. It could be that the resulting resolution is now supported in wgpu (snuck through in a patch version?) or by my device, but then yours is still over the limit.
Which browser are you using? and is it the stock Android OS that came with the device? From my original testing Chromium based browsers had the issue but Firefox worked (Firefox devicePixelRatio was 1)
Just checking that the meta
tag was added to the head
and not the body
in your index.html file?
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
</head>
<body>
</body>
</html>
It's not a great solution, but if you just need to get something running you could shrink the size of the canvas on the page enough that it fits within the texture limit. I did this originally by putting a header and some extra buttons on the page until the render surface was small enough. More details on this linked comment.
Bevy version
0.9.1
[Optional] Relevant system information
What you did
Caused by: In Device::create_texture note: label =
view_depth_texture
Dimension Y value 5038 exceeds the limit of 4096', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:2403:5