Skip to content

Conversation

@RJ
Copy link

@RJ RJ commented Apr 25, 2025

Added a split_screen example, based on dynamic example.

It defaults to QuadSplit with 4 cameras, which works fine and you can toggle between camera layouts with F1.

However, if you change the default to Single it crashes when changing to VerticalSplit:

// TODO with Single as default, crashes when changing to VerticalSplit.
// (and if 2-player vertical split as default, crashes when changing to quad)
#[derive(Resource, Debug, Default, Clone, PartialEq, Eq, Hash, Reflect)]
pub enum CameraLayout {
    /// Single player game
    Single,
    /// 2 player vertical split game
    VerticalSplit,
    /// 4 player split
    #[default]
    QuadSplit,
}
Screenshot 2025-04-25 at 11 21 26

this is a reproduction in example form of #14

2025-04-25T10:24:43.624996Z  INFO split_screen: Toggling camera layout
2025-04-25T10:24:43.625023Z  INFO split_screen: Despawning 1 cameras
2025-04-25T10:24:43.625026Z  INFO split_screen: Spawning cameras for VerticalSplit
2025-04-25T10:24:43.625028Z  INFO split_screen: Spawning 2 cameras
2025-04-25T10:24:43.625114Z  INFO split_screen: Setting camera viewports
2025-04-25T10:24:43.625129Z  INFO split_screen: Setting viewport for camera 1: Viewport { physical_position: UVec2(0, 0), physical_size: UVec2(1280, 1440), depth: 0.0..1.0 }
2025-04-25T10:24:43.625135Z  INFO split_screen: Setting viewport for camera 2: Viewport { physical_position: UVec2(1280, 0), physical_size: UVec2(1280, 1440), depth: 0.0..1.0 }
2025-04-25T10:24:43.630858Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    

thread '' panicked at /Users/rj/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.3/src/backend/wgpu_core.rs:3273:26:
wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_bind_group command
      Dynamic binding offset index 0 with offset 2304 would overrun the buffer bound to BindGroup with 'particle_view_bind_group' label 0 -> binding 0. Buffer size is 1536 bytes, the binding binds bytes 0..752, meaning the maximum the binding can be offset is 784 bytes


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2025-04-25T10:24:43.631200Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    

thread 'Compute Task Pool (0)' panicked at /Users/rj/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.3/src/backend/wgpu_core.rs:3273:26:
wgpu error: Validation Error

Caused by:
  In RenderPass::end
    In a set_bind_group command
      Dynamic binding offset index 0 with offset 1536 would overrun the buffer bound to BindGroup with 'particle_view_bind_group' label 0 -> binding 0. Buffer size is 1536 bytes, the binding binds bytes 0..752, meaning the maximum the binding can be offset is 784 bytes


Encountered a panic in system `bevy_render::renderer::render_system`!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant