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

Directional lights crash MacOS Monterey on WASM #8481

Open
Azorlogh opened this issue Apr 24, 2023 · 4 comments
Open

Directional lights crash MacOS Monterey on WASM #8481

Azorlogh opened this issue Apr 24, 2023 · 4 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds P-Crash A sudden unexpected crash

Comments

@Azorlogh
Copy link
Contributor

Bevy version

  • Bevy 0.10.1
  • Master at the time of writing (commit 9a3225d)

Relevant system information

  • MacOS Monterey (does not happen on Ventura)
  • WASM in Firefox, Chromium browsers, and Safari

Adapters: (happens with both)

AdapterInfo { name: "ANGLE (Intel Inc., Intel Iris Pro OpenGL Engine, OpenGL 4.1)", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }
AdapterInfo { name: “Intel 945GM", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: ““, driver_info: "", backend: Gl }

What you did

  • Added a camera with an arbitrary orientation
  • Added a directional light with an arbitrary orientation

Minimal Example:

use bevy::prelude::*;

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

fn setup(
   mut commands: Commands,
   mut meshes: ResMut<Assets<Mesh>>,
   mut materials: ResMut<Assets<StandardMaterial>>,
) {
   let sun_dir = Vec3::new(0.6, -0.5, 1.0).normalize();
   let quat = Quat::from_rotation_arc(Vec3::Z, sun_dir);
   commands.spawn(DirectionalLightBundle {
      directional_light: DirectionalLight {
            illuminance: 10000.0,
            ..default()
      },
      transform: Transform::from_rotation(quat),
      ..default()
   });

   // cube
   commands.spawn(PbrBundle {
      mesh: meshes.add(Mesh::from(shape::Cube { size: 2.0 })),
      material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
      transform: Transform::default(),
      ..default()
   });

   // camera
   let mut camera = Camera3dBundle::default();
   camera.transform = Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y);
   commands.spawn(camera);
}

What went wrong

  • The whole browser crashes

Additional information

  • It is dependent on the orientation of both the camera and the directional light.
    I was not able to precisely determine the correlation, it does not seem to be something simple like "whether or not the camera looks in the same direction"
  • The crash happens right after submitting the work to the GPU, so I think it's a driver crash
@Azorlogh Azorlogh added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Apr 24, 2023
@james7132 james7132 added A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash and removed S-Needs-Triage This issue needs to be labelled labels Apr 24, 2023
@mockersf
Copy link
Member

Does it happens on all browsers?

Apple fixed something on the latest Safari update (16.4, with Ventura 13.3), so it's expected to fail on Monterey, but I didn't have issues at the time with other browsers

@mockersf mockersf added the O-Web Specific to web (WASM) builds label Apr 25, 2023
@Azorlogh
Copy link
Contributor Author

Here's the details of everything I tested so far:

  • A real MacOS Monterey machine (From a colleague)
    • Firefox, Chrome hang and crash after a while
    • Safari crashes the entire system
  • Browserstack (What I used since I don't own a mac)
    • Firefox, Chrome hang & crash
    • Safari:
      • If using "WebGL via Metal"
        • It does not crash
        • But the cube doesn't appear
        • And a message shows in the console (1)
      • If not using "WebGL via Metal": It crashes

(1) Browserstack Safari with WebGL via Metal: Browserstack_safari_error

@mockersf
Copy link
Member

Is it all on intel macs? Or do you also have access to macs with apple silicon?

@Azorlogh
Copy link
Contributor Author

We tried on an Apple M1 Pro and it worked without issues.
On Browserstack's Ventura mac it works too, but I'm not sure what hardware it runs on.

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 C-Bug An unexpected or incorrect behavior O-Web Specific to web (WASM) builds P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

3 participants