Skip to content

Commit

Permalink
Skip prepass draw prepare if only the depth prepass is used
Browse files Browse the repository at this point in the history
  • Loading branch information
JMS55 committed Jan 12, 2024
1 parent 3c9b361 commit 92639e3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions crates/bevy_pbr/src/meshlet/material_draw_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub fn prepare_material_meshlet_meshes_main_opaque_pass<M: Material>(
) where
M::Data: PartialEq + Eq + Hash + Clone,
{
let fake_vertex_buffer_layout = &fake_vertex_buffer_layout();

for (
view_entity,
view,
Expand All @@ -68,8 +70,6 @@ pub fn prepare_material_meshlet_meshes_main_opaque_pass<M: Material>(
{
let mut materials = Vec::new();

let fake_vertex_buffer_layout = &fake_vertex_buffer_layout();

let mut view_key =
MeshPipelineKey::from_msaa_samples(1) | MeshPipelineKey::from_hdr(view.hdr);

Expand Down Expand Up @@ -235,15 +235,24 @@ pub fn prepare_material_meshlet_meshes_prepass<M: Material>(
) where
M::Data: PartialEq + Eq + Hash + Clone,
{
let fake_vertex_buffer_layout = &fake_vertex_buffer_layout();

for (
view_entity,
view,
(depth_prepass, normal_prepass, motion_vector_prepass, deferred_prepass),
) in &views
{
let mut materials = Vec::new();
if let (None, Some(_), None, None) = (
normal_prepass,
depth_prepass,
motion_vector_prepass,
deferred_prepass,
) {
continue;
}

let fake_vertex_buffer_layout = &fake_vertex_buffer_layout();
let mut materials = Vec::new();

let mut view_key =
MeshPipelineKey::from_msaa_samples(1) | MeshPipelineKey::from_hdr(view.hdr);
Expand Down

0 comments on commit 92639e3

Please sign in to comment.