Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dimension X value 4294967295 exceeds the limit of 16384 #9389

Closed
valentinegb opened this issue Aug 8, 2023 · 7 comments
Closed

Dimension X value 4294967295 exceeds the limit of 16384 #9389

valentinegb opened this issue Aug 8, 2023 · 7 comments
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-MacOS Specific to the MacOS (Apple) desktop operating system

Comments

@valentinegb
Copy link
Contributor

Bevy version

0.11.0

Relevant system information

cargo 1.73.0-nightly (020651c52 2023-08-02)
macOS 14.0 Beta (23A5301h)

AdapterInfo { name: "Apple M1", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
SystemInfo { os: "MacOS 14.0 ", kernel: "23.0.0", cpu: "Apple M1", core_count: "8", memory: "8.0 GiB" }

What you did

Just spawned a default Camera2dBundle and a Text2dBundle:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
    commands.spawn(Text2dBundle {
        text: Text::from_section("Lorem ipsum", TextStyle::default()),
        ..default()
    });
}

What went wrong

Instead of a window opening with "Lorem ipsum" displayed in the center, the program opened a window, closed the window, crashed, and gave this error:

2023-08-08T21:27:00.288667Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default
thread 'Compute Task Pool (1)' panicked at /Users/valentinebriese/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/direct.rs:3019:5:
wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `main_texture_a`
    Dimension X value 4294967295 exceeds the limit of 16384


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::prepare_view_targets`!
thread 'Compute Task Pool (0)' panicked at /Users/valentinebriese/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.11.0/src/pipelined_rendering.rs:135:45:
called `Result::unwrap()` on an `Err` value: RecvError

Additional information

I found the following proposed workaround in this similar issue (#8950):

use bevy::prelude::*;
use bevy::window::WindowMode;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                mode: WindowMode::BorderlessFullscreen,
                ..default()
            }),
            ..default()
        }))
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn(Camera2dBundle::default());
    commands.spawn(Text2dBundle {
        text: Text::from_section("Lorem ipsum", TextStyle::default()),
        ..default()
    });
}

This code does not cause an error or a crash and the window opens displaying the text as expected. However, I noticed that when the fullscreen window is not on screen, the memory usage of the program jumps up a bit. The highest I observed was 1.75 GB. As soon as the window is back on screen, the memory goes back down to around 500 MB (which still seams a little bit high in my opinion but I've never used Bevy before this so I don't know).

@valentinegb valentinegb added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 8, 2023
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Aug 8, 2023
@maaku
Copy link

maaku commented Sep 26, 2023

This issue still affect Bevy on macOS 14.0, which is now released. I upgraded, only to find that my bevy projects no longer run. For the record, cargo run --example 3d_shapes produces this error when run on a fresh checkout of this repository:

   Compiling bevy v0.12.0-dev (/Users/mark/Development/bevy)
    Finished dev [unoptimized + debuginfo] target(s) in 2.26s
     Running `target/debug/examples/3d_shapes`
2023-09-26T23:45:45.909623Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon Pro 580", vendor: 0, device: 0, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Metal }
2023-09-26T23:45:46.598628Z  INFO bevy_winit::system: Creating new window "App" (0v0)
2023-09-26T23:45:46.642670Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "MacOS 14.0 ", kernel: "23.0.0", cpu: "Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz", core_count: "6", memory: "32.0 GiB" }
2023-09-26 16:45:46.710 3d_shapes[53469:230660] CAMetalLayer ignoring invalid setDrawableSize width=4294967295.000000 height=4294967295.000000
2023-09-26T23:45:46.710769Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (5)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `main_texture_a`
    Dimension X value 4294967295 exceeds the limit of 16384

', /Users/mark/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.0/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::prepare_view_targets`!
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', crates/bevy_render/src/pipelined_rendering.rs:145:45

@mockersf
Copy link
Member

It's a bug in winit: rust-windowing/winit#2876 and it hasn't been released yet.

There is a potential workaround in Bevy: #9905, but the next winit release should happen before the next bevy release...

@mockersf mockersf added O-MacOS Specific to the MacOS (Apple) desktop operating system and removed S-Needs-Investigation This issue requires detective work to figure out what's going wrong labels Sep 27, 2023
@maaku
Copy link

maaku commented Sep 27, 2023

What’s the workaround in the meantime? Development on my app is halted for those who have upgraded. Do I need to fork bevy to use this patched winit, or is there some less invasive way of fixing this?

@mockersf
Copy link
Member

mockersf commented Sep 27, 2023

@maaku could you confirm it works with this patch in you Cargo.toml file

[patch.crates-io]
bevy = { git = "https://github.com/bevyengine/bevy", branch = "v0.11.3" }

@coldwarrl
Copy link

FYI: Had the same issue on macOS 14.0 (stable) and the patch above works fine!

@mockersf
Copy link
Member

this has now been published as Bevy 0.11.3, no need for a patch anymore, just run cargo update

@maaku
Copy link

maaku commented Sep 27, 2023

It works! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-MacOS Specific to the MacOS (Apple) desktop operating system
Projects
None yet
Development

No branches or pull requests

6 participants
@maaku @alice-i-cecile @coldwarrl @mockersf @valentinegb and others