Skip to content

make bevy_pbr optional in bevy_gizmos_render again#23136

Open
ChristopherBiscardi wants to merge 4 commits intobevyengine:mainfrom
ChristopherBiscardi:gizmos-pbr
Open

make bevy_pbr optional in bevy_gizmos_render again#23136
ChristopherBiscardi wants to merge 4 commits intobevyengine:mainfrom
ChristopherBiscardi:gizmos-pbr

Conversation

@ChristopherBiscardi
Copy link
Contributor

Objective

https://github.com/bevyengine/bevy/pull/22443/changes#diff-0425515a2f1ec5b53401db2850b549c2d6634bc1c3e2ae9698d0ccfb172f2387R36 introduced a hard dependency on bevy_pbr to bevy_render_gizmos, which is marked as optional and will not compile if the optional dep is not enabled:

error[E0432]: unresolved import `bevy_pbr`
  --> /Users/chris/github/bevyengine/bevy-clean/crates/bevy_gizmos_render/src/lib.rs:36:5
   |
36 | use bevy_pbr::MeshPipelineSet;
   |     ^^^^^^^^ use of unresolved module or unlinked crate `bevy_pbr`
   |

Solution

hide it behind the same bevy_pbr flags as the other bevy_pbr code

Testing

Use bevy_gizmos_render as a path dependency in a freshly cargo new'd project.

@ChristopherBiscardi ChristopherBiscardi added A-Gizmos Visual editor and debug gizmos S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Trivial Nice and easy! A great choice to get started with Bevy labels Feb 24, 2026
@Zeophlite Zeophlite added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 24, 2026
Copy link
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch but also yuck, this shouldnt hard or soft dep on pbr at all. not sure it can be untangled until Charlotte's work lands though

@alice-i-cecile alice-i-cecile added this to the 0.19 milestone Feb 24, 2026
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only be cfg gating the ordering, not the addition of the system.

You can use configure_sets to do this nicely.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged C-Bug An unexpected or incorrect behavior and removed S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Feb 24, 2026
@ChristopherBiscardi
Copy link
Contributor Author

@alice-i-cecile Upon further inspection of the functionality added in the original PR, the only reason I can see that this would need to be ordered is if it accessed MeshPipelineViewLayouts, which it does not do. So I have removed the cfg gating and the bevy_pbr usage that was added in the PR.

@Zeophlite Was there another reason this system was ordered against MeshPipelineSet that I'm missing?

fn init_line_gizmo_uniform_bind_group_layout(mut commands: Commands) {
    let line_layout = BindGroupLayoutDescriptor::new(
        "LineGizmoUniform layout",
        &BindGroupLayoutEntries::single(
            ShaderStages::VERTEX,
            uniform_buffer::<LineGizmoUniform>(true),
        ),
    );

    commands.insert_resource(LineGizmoUniformBindgroupLayout {
        layout: line_layout,
    });
}

@ChristopherBiscardi
Copy link
Contributor Author

The system that needed ordering was init_line_gizmo_pipelines (a different system from the original mentioned in the PR), which accesses Res<MeshPipeline>, which is set up as part of MeshPipelineSet. That ordering can happen in the pipeline_3d where the entire module is already gated by bevy_pbr.

@ChristopherBiscardi ChristopherBiscardi added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Gizmos Visual editor and debug gizmos C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants