Skip to content

Directional lights crash MacOS Monterey on WASM #8481

Open
@Azorlogh

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behaviorO-WebSpecific to web (WASM) buildsP-CrashA sudden unexpected crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions