Skip to content

Commit 9174409

Browse files
committed
bevy_pbr2: Remove depth prepass
many_cubes_pipelined performance takes a big hit from doing a depth prepass.
1 parent edfba1e commit 9174409

File tree

6 files changed

+18
-908
lines changed

6 files changed

+18
-908
lines changed

pipelined/bevy_core_pipeline/src/main_pass_3d.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ impl Node for MainPass3dNode {
8181
}],
8282
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
8383
view: &depth.view,
84-
// NOTE: The opaque pass loads the depth prepass and does not store
84+
// NOTE: The opaque main pass clears and writes to the depth buffer.
8585
depth_ops: Some(Operations {
86-
load: LoadOp::Load,
87-
store: false,
86+
load: LoadOp::Clear(0.0),
87+
store: true,
8888
}),
8989
stencil_ops: None,
9090
}),
@@ -127,10 +127,10 @@ impl Node for MainPass3dNode {
127127
}],
128128
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
129129
view: &depth.view,
130-
// NOTE: The alpha mask pass loads the depth prepass and does not store
130+
// NOTE: The alpha mask pass loads the depth buffer and possibly overwrites it
131131
depth_ops: Some(Operations {
132132
load: LoadOp::Load,
133-
store: false,
133+
store: true,
134134
}),
135135
stencil_ops: None,
136136
}),

pipelined/bevy_pbr2/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ use bevy_transform::TransformSystem;
2727

2828
pub mod draw_3d_graph {
2929
pub mod node {
30-
pub const DEPTH_PREPASS: &str = "depth_prepass";
3130
pub const SHADOW_PASS: &str = "shadow_pass";
3231
}
3332
}
3433

35-
pub const DEPTH_PREPASS_SHADER_HANDLE: HandleUntyped =
36-
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 18081189618302456913);
3734
pub const PBR_SHADER_HANDLE: HandleUntyped =
3835
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 4805239651767701046);
3936
pub const SHADOW_SHADER_HANDLE: HandleUntyped =
@@ -45,8 +42,6 @@ pub struct PbrPlugin;
4542
impl Plugin for PbrPlugin {
4643
fn build(&self, app: &mut App) {
4744
let mut shaders = app.world.get_resource_mut::<Assets<Shader>>().unwrap();
48-
let depth_prepass_shader = Shader::from_wgsl(include_str!("render/depth_prepass.wgsl"));
49-
shaders.set_untracked(DEPTH_PREPASS_SHADER_HANDLE, depth_prepass_shader);
5045
let pbr_shader = Shader::from_wgsl(include_str!("render/pbr.wgsl"));
5146
shaders.set_untracked(PBR_SHADER_HANDLE, pbr_shader);
5247
let shadow_shader = Shader::from_wgsl(include_str!("render/depth.wgsl"));
@@ -146,6 +141,5 @@ impl Plugin for PbrPlugin {
146141
)
147142
.unwrap();
148143
}
149-
app.add_plugin(DepthPrepassPlugin);
150144
}
151145
}

0 commit comments

Comments
 (0)