bevy_infinite_grid icon indicating copy to clipboard operation
bevy_infinite_grid copied to clipboard

Metal render pass error

Open highway900 opened this issue 1 year ago • 1 comments

I have setup a simple example of using infinite grid and the scene renders briefly then crashes. Here is the initialisation of the camera and grid during the menu stage, I am using PanOrbitCamera if that is of any consequence. The example ran from this repo works no problem, this led me to believe that it could be an ordering issue? but I am just guessing at this stage.

    commands
        .spawn(InfiniteGridBundle {
            grid: InfiniteGrid {
                ..Default::default()
            },
            ..Default::default()
        })
        .insert(GridShadowCamera);
    commands
        .spawn((
            Camera3dBundle {
                transform: Transform::from_xyz(0.0, 4.37, 14.77),
                ..Default::default()
            },
            PanOrbitCamera::default(),
        ))
        .insert(GameCamera);
Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 8, Metal)>`
    In a set_pipeline command
      note: render pipeline = `grid-render-pipeline-shadowless`
    Render pipeline targets are incompatible with render pass
    Incompatible sample count: the renderpass expected 1 but was given 4

highway900 avatar May 26 '23 02:05 highway900

Always the way, write an issue then find a solution. I just found this issue https://github.com/bevyengine/bevy/issues/3254 and tried enabling MSAA and it fixed the problem. Not very obvious though.

In my case MSAA was explicitly off using .insert_resource(MSAA::off) removing this code fixed the issue. Not sure if this is metal specific, happy to provide a PR for the README wrt to this.

highway900 avatar May 26 '23 02:05 highway900