Skip to content

Commit 7958177

Browse files
authored
Fix wireframe and examples with mesh pipeline set (#23147)
# Objective - #22443 broke wireframe and some examples ## Solution - Fix them by having the systems run after `MeshPipelineSet` - Also add a migration guide ## Testing - run the examples modified or anything using wireframe
1 parent 6804424 commit 7958177

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

crates/bevy_pbr/src/wireframe.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::{
22
render::{PreprocessBindGroups, PreprocessPipelines},
3-
DrawMesh, MeshPipeline, MeshPipelineKey, RenderLightmaps, RenderMeshInstanceFlags,
4-
RenderMeshInstances, SetMeshBindGroup, SetMeshViewBindGroup, SetMeshViewBindingArrayBindGroup,
5-
ViewKeyCache,
3+
DrawMesh, MeshPipeline, MeshPipelineKey, MeshPipelineSet, RenderLightmaps,
4+
RenderMeshInstanceFlags, RenderMeshInstances, SetMeshBindGroup, SetMeshViewBindGroup,
5+
SetMeshViewBindingArrayBindGroup, ViewKeyCache,
66
};
77
use bevy_app::{App, Plugin, PostUpdate, Startup, Update};
88
use bevy_asset::{
@@ -149,7 +149,10 @@ impl Plugin for WireframePlugin {
149149
.init_resource::<WireframeWideBindGroups>()
150150
.init_resource::<SpecializedMeshPipelines<Wireframe3dPipeline>>()
151151
.init_resource::<PendingWireframeQueues>()
152-
.add_systems(RenderStartup, init_wireframe_3d_pipeline)
152+
.add_systems(
153+
RenderStartup,
154+
init_wireframe_3d_pipeline.after(MeshPipelineSet),
155+
)
153156
.add_systems(
154157
Core3d,
155158
wireframe_3d

examples/shader_advanced/custom_render_phase.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::ops::Range;
1515
use bevy::camera::Viewport;
1616
use bevy::core_pipeline::core_3d::TransparentSortingInfo3d;
1717
use bevy::math::Affine3Ext;
18-
use bevy::pbr::{SetMeshViewEmptyBindGroup, ViewKeyCache};
18+
use bevy::pbr::{MeshPipelineSet, SetMeshViewEmptyBindGroup, ViewKeyCache};
1919
use bevy::{
2020
camera::MainPassResolutionOverride,
2121
core_pipeline::{core_3d::main_opaque_pass_3d, schedule::Core3d, Core3dSystems},
@@ -131,7 +131,7 @@ impl Plugin for MeshStencilPhasePlugin {
131131
.add_render_command::<Stencil3d, DrawMesh3dStencil>()
132132
.init_resource::<ViewSortedRenderPhases<Stencil3d>>()
133133
.init_resource::<PendingCustomMeshQueues>()
134-
.add_systems(RenderStartup, init_stencil_pipeline)
134+
.add_systems(RenderStartup, init_stencil_pipeline.after(MeshPipelineSet))
135135
.add_systems(ExtractSchedule, extract_camera_phases)
136136
.add_systems(
137137
Render,

examples/shader_advanced/custom_shader_instancing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! It's generally recommended to try the built-in instancing before going with this approach.
99
1010
use bevy::core_pipeline::core_3d::TransparentSortingInfo3d;
11-
use bevy::pbr::{SetMeshViewBindingArrayBindGroup, ViewKeyCache};
11+
use bevy::pbr::{MeshPipelineSet, SetMeshViewBindingArrayBindGroup, ViewKeyCache};
1212
use bevy::{
1313
camera::visibility::NoFrustumCulling,
1414
core_pipeline::core_3d::Transparent3d,
@@ -107,7 +107,7 @@ impl Plugin for CustomMaterialPlugin {
107107
app.sub_app_mut(RenderApp)
108108
.add_render_command::<Transparent3d, DrawCustom>()
109109
.init_resource::<SpecializedMeshPipelines<CustomPipeline>>()
110-
.add_systems(RenderStartup, init_custom_pipeline)
110+
.add_systems(RenderStartup, init_custom_pipeline.after(MeshPipelineSet))
111111
.add_systems(
112112
Render,
113113
(

examples/shader_advanced/specialized_mesh_pipeline.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ use bevy::{
1414
math::{vec3, vec4},
1515
mesh::{Indices, MeshVertexBufferLayoutRef, PrimitiveTopology},
1616
pbr::{
17-
DrawMesh, MeshPipeline, MeshPipelineKey, MeshPipelineViewLayoutKey, RenderMeshInstances,
18-
SetMeshBindGroup, SetMeshViewBindGroup, SetMeshViewEmptyBindGroup, ViewKeyCache,
17+
DrawMesh, MeshPipeline, MeshPipelineKey, MeshPipelineSet, MeshPipelineViewLayoutKey,
18+
RenderMeshInstances, SetMeshBindGroup, SetMeshViewBindGroup, SetMeshViewEmptyBindGroup,
19+
ViewKeyCache,
1920
},
2021
prelude::*,
2122
render::{
@@ -115,7 +116,10 @@ impl Plugin for CustomRenderedMeshPipelinePlugin {
115116
.init_resource::<PendingCustomMeshQueues>()
116117
// We need to use a custom draw command so we need to register it
117118
.add_render_command::<Opaque3d, DrawSpecializedPipelineCommands>()
118-
.add_systems(RenderStartup, init_custom_mesh_pipeline)
119+
.add_systems(
120+
RenderStartup,
121+
init_custom_mesh_pipeline.after(MeshPipelineSet),
122+
)
119123
.add_systems(
120124
Render,
121125
queue_custom_mesh_pipeline.in_set(RenderSystems::Queue),
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Resources `MeshPipelineViewLayouts`, `MeshPipeline` and `RenderDebugOverlayPipeline` are now created in `RenderStartup` systems
3+
pull_requests: [22443]
4+
---
5+
6+
Systems using the `MeshPipelineViewLayouts`, `MeshPipeline` and `RenderDebugOverlayPipeline` resources in the `RenderStartup` schedule now need to be run after the `MeshPipelineSet` system set.

0 commit comments

Comments
 (0)