Skip to content

Commit

Permalink
rebase + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtkuehnert committed Jan 4, 2023
1 parent 9f3a083 commit 0ee2d18
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 0 additions & 2 deletions crates/bevy_core_pipeline/src/core_2d/main_pass_2d_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use bevy_render::{
renderer::RenderContext,
view::{ExtractedView, ViewTarget},
};
#[cfg(feature = "trace")]
use bevy_utils::tracing::info_span;

pub struct MainPass2dNode {
query: QueryState<
Expand Down
5 changes: 1 addition & 4 deletions crates/bevy_core_pipeline/src/core_3d/main_pass_3d_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ use crate::{
core_3d::{AlphaMask3d, Camera3d, Opaque3d, Transparent3d},
};
use bevy_ecs::prelude::*;
use bevy_render::render_phase::TrackedRenderPass;
use bevy_render::{
camera::ExtractedCamera,
render_graph::{Node, NodeRunError, RenderGraphContext, SlotInfo, SlotType},
render_phase::RenderPhase,
render_phase::{RenderPhase, TrackedRenderPass},
render_resource::{LoadOp, Operations},
renderer::RenderContext,
view::{ExtractedView, ViewDepthTexture, ViewTarget},
};
#[cfg(feature = "trace")]
use bevy_utils::tracing::info_span;

pub struct MainPass3dNode {
query: QueryState<
Expand Down
25 changes: 14 additions & 11 deletions crates/bevy_render/src/render_phase/draw_state.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::renderer::RenderContext;
use crate::view::{ViewDepthTexture, ViewTarget};
use crate::{
camera::Viewport,
prelude::Color,
Expand All @@ -8,16 +6,19 @@ use crate::{
BindGroup, BindGroupId, Buffer, BufferId, BufferSlice, RenderPipeline, RenderPipelineId,
ShaderStages,
},
renderer::RenderContext,
view::{ViewDepthTexture, ViewTarget},
};
use bevy_ecs::prelude::{Entity, World};
#[cfg(feature = "trace")]
use bevy_utils::tracing::info_span;
use bevy_utils::tracing::trace;
use std::ops::Range;
use wgpu::{
IndexFormat, Operations, RenderPass, RenderPassDepthStencilAttachment, RenderPassDescriptor,
};

// #[cfg(feature = "trace")]
// use bevy_utils::tracing::info_span;

/// Tracks the current [`TrackedRenderPass`] state to ensure draw calls are valid.
#[derive(Debug, Default)]
pub struct DrawState {
Expand Down Expand Up @@ -115,6 +116,7 @@ impl<'a> TrackedRenderPass<'a> {
}
}

#[allow(clippy::too_many_arguments)]
pub fn create_for_camera(
render_context: &'a mut RenderContext,
label: &'static str,
Expand All @@ -125,22 +127,21 @@ impl<'a> TrackedRenderPass<'a> {
depth_ops: Option<Operations<f32>>,
viewport: &Option<Viewport>,
) -> Self {
#[cfg(feature = "trace")]
let _pass_span = info_span!(label).entered();
// Todo: info_span has to use a const label
// #[cfg(feature = "trace")]
// let _pass_span = info_span!(label).entered();

// Todo: makes this configurable
let stencil_ops = None;

let color_attachments = &[Some(view_target.get_color_attachment(color_ops))];

let depth_stencil_attachment = match view_depth {
None => None,
Some(view_depth) => Some(RenderPassDepthStencilAttachment {
let depth_stencil_attachment =
view_depth.map(|view_depth| RenderPassDepthStencilAttachment {
view: &view_depth.view,
depth_ops,
stencil_ops,
}),
};
});

let pass_descriptor = RenderPassDescriptor {
label: Some(label),
Expand All @@ -167,6 +168,8 @@ impl<'a> TrackedRenderPass<'a> {
let draw_functions = world.resource::<DrawFunctions<I>>();
let mut draw_functions = draw_functions.write();

draw_functions.prepare(world);

for item in &render_phase.items {
let draw_function = draw_functions.get_mut(item.draw_function()).unwrap();
draw_function.draw(world, self, item);
Expand Down

0 comments on commit 0ee2d18

Please sign in to comment.