Skip to content

Commit

Permalink
bevy_pbr2: Remove depth prepass
Browse files Browse the repository at this point in the history
many_cubes_pipelined performance takes a big hit from doing a depth prepass.
  • Loading branch information
superdump committed Nov 12, 2021
1 parent edfba1e commit 9174409
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 908 deletions.
10 changes: 5 additions & 5 deletions pipelined/bevy_core_pipeline/src/main_pass_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ impl Node for MainPass3dNode {
}],
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
view: &depth.view,
// NOTE: The opaque pass loads the depth prepass and does not store
// NOTE: The opaque main pass clears and writes to the depth buffer.
depth_ops: Some(Operations {
load: LoadOp::Load,
store: false,
load: LoadOp::Clear(0.0),
store: true,
}),
stencil_ops: None,
}),
Expand Down Expand Up @@ -127,10 +127,10 @@ impl Node for MainPass3dNode {
}],
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
view: &depth.view,
// NOTE: The alpha mask pass loads the depth prepass and does not store
// NOTE: The alpha mask pass loads the depth buffer and possibly overwrites it
depth_ops: Some(Operations {
load: LoadOp::Load,
store: false,
store: true,
}),
stencil_ops: None,
}),
Expand Down
6 changes: 0 additions & 6 deletions pipelined/bevy_pbr2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ use bevy_transform::TransformSystem;

pub mod draw_3d_graph {
pub mod node {
pub const DEPTH_PREPASS: &str = "depth_prepass";
pub const SHADOW_PASS: &str = "shadow_pass";
}
}

pub const DEPTH_PREPASS_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 18081189618302456913);
pub const PBR_SHADER_HANDLE: HandleUntyped =
HandleUntyped::weak_from_u64(Shader::TYPE_UUID, 4805239651767701046);
pub const SHADOW_SHADER_HANDLE: HandleUntyped =
Expand All @@ -45,8 +42,6 @@ pub struct PbrPlugin;
impl Plugin for PbrPlugin {
fn build(&self, app: &mut App) {
let mut shaders = app.world.get_resource_mut::<Assets<Shader>>().unwrap();
let depth_prepass_shader = Shader::from_wgsl(include_str!("render/depth_prepass.wgsl"));
shaders.set_untracked(DEPTH_PREPASS_SHADER_HANDLE, depth_prepass_shader);
let pbr_shader = Shader::from_wgsl(include_str!("render/pbr.wgsl"));
shaders.set_untracked(PBR_SHADER_HANDLE, pbr_shader);
let shadow_shader = Shader::from_wgsl(include_str!("render/depth.wgsl"));
Expand Down Expand Up @@ -146,6 +141,5 @@ impl Plugin for PbrPlugin {
)
.unwrap();
}
app.add_plugin(DepthPrepassPlugin);
}
}
Loading

0 comments on commit 9174409

Please sign in to comment.