Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Add "end of main pass post processing" render graph node #6468

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crates/bevy_core_pipeline/src/core_2d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod graph {
pub const MAIN_PASS: &str = "main_pass";
pub const TONEMAPPING: &str = "tonemapping";
pub const UPSCALING: &str = "upscaling";
pub const END_MAIN_PASS_POST_PROCESSING: &str = "end_main_pass_post_processing";
}
}

Expand All @@ -21,7 +22,7 @@ use bevy_ecs::prelude::*;
use bevy_render::{
camera::Camera,
extract_component::ExtractComponentPlugin,
render_graph::{RenderGraph, SlotInfo, SlotType},
render_graph::{EmptyNode, RenderGraph, SlotInfo, SlotType},
render_phase::{
batch_phase_system, sort_phase_system, BatchedPhaseItem, CachedRenderPipelinePhaseItem,
DrawFunctionId, DrawFunctions, EntityPhaseItem, PhaseItem, RenderPhase,
Expand Down Expand Up @@ -63,6 +64,7 @@ impl Plugin for Core2dPlugin {
let mut draw_2d_graph = RenderGraph::default();
draw_2d_graph.add_node(graph::node::MAIN_PASS, pass_node_2d);
draw_2d_graph.add_node(graph::node::TONEMAPPING, tonemapping);
draw_2d_graph.add_node(graph::node::END_MAIN_PASS_POST_PROCESSING, EmptyNode);
draw_2d_graph.add_node(graph::node::UPSCALING, upscaling);
let input_node_id = draw_2d_graph.set_input(vec![SlotInfo::new(
graph::input::VIEW_ENTITY,
Expand Down Expand Up @@ -96,7 +98,16 @@ impl Plugin for Core2dPlugin {
.add_node_edge(graph::node::MAIN_PASS, graph::node::TONEMAPPING)
.unwrap();
draw_2d_graph
.add_node_edge(graph::node::TONEMAPPING, graph::node::UPSCALING)
.add_node_edge(
graph::node::TONEMAPPING,
graph::node::END_MAIN_PASS_POST_PROCESSING,
)
.unwrap();
draw_2d_graph
.add_node_edge(
graph::node::END_MAIN_PASS_POST_PROCESSING,
graph::node::UPSCALING,
)
.unwrap();
graph.add_sub_graph(graph::NAME, draw_2d_graph);
}
Expand Down
15 changes: 13 additions & 2 deletions crates/bevy_core_pipeline/src/core_3d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub mod graph {
pub const MAIN_PASS: &str = "main_pass";
pub const TONEMAPPING: &str = "tonemapping";
pub const UPSCALING: &str = "upscaling";
pub const END_MAIN_PASS_POST_PROCESSING: &str = "end_main_pass_post_processing";
}
}

Expand All @@ -24,7 +25,7 @@ use bevy_render::{
camera::{Camera, ExtractedCamera},
extract_component::ExtractComponentPlugin,
prelude::Msaa,
render_graph::{RenderGraph, SlotInfo, SlotType},
render_graph::{EmptyNode, RenderGraph, SlotInfo, SlotType},
render_phase::{
sort_phase_system, CachedRenderPipelinePhaseItem, DrawFunctionId, DrawFunctions,
EntityPhaseItem, PhaseItem, RenderPhase,
Expand Down Expand Up @@ -73,6 +74,7 @@ impl Plugin for Core3dPlugin {
let mut draw_3d_graph = RenderGraph::default();
draw_3d_graph.add_node(graph::node::MAIN_PASS, pass_node_3d);
draw_3d_graph.add_node(graph::node::TONEMAPPING, tonemapping);
draw_3d_graph.add_node(graph::node::END_MAIN_PASS_POST_PROCESSING, EmptyNode);
draw_3d_graph.add_node(graph::node::UPSCALING, upscaling);
let input_node_id = draw_3d_graph.set_input(vec![SlotInfo::new(
graph::input::VIEW_ENTITY,
Expand Down Expand Up @@ -106,7 +108,16 @@ impl Plugin for Core3dPlugin {
.add_node_edge(graph::node::MAIN_PASS, graph::node::TONEMAPPING)
.unwrap();
draw_3d_graph
.add_node_edge(graph::node::TONEMAPPING, graph::node::UPSCALING)
.add_node_edge(
graph::node::TONEMAPPING,
graph::node::END_MAIN_PASS_POST_PROCESSING,
)
.unwrap();
draw_3d_graph
.add_node_edge(
graph::node::END_MAIN_PASS_POST_PROCESSING,
graph::node::UPSCALING,
)
.unwrap();
graph.add_sub_graph(graph::NAME, draw_3d_graph);
}
Expand Down
12 changes: 12 additions & 0 deletions crates/bevy_core_pipeline/src/fxaa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ impl Plugin for FxaaPlugin {
graph
.add_node_edge(core_3d::graph::node::TONEMAPPING, FXAA_NODE_3D)
.unwrap();
graph
.add_node_edge(
FXAA_NODE_3D,
core_3d::graph::node::END_MAIN_PASS_POST_PROCESSING,
)
.unwrap();
}
{
let fxaa_node = FxaaNode::new(&mut render_app.world);
Expand All @@ -138,6 +144,12 @@ impl Plugin for FxaaPlugin {
graph
.add_node_edge(core_2d::graph::node::TONEMAPPING, FXAA_NODE_2D)
.unwrap();
graph
.add_node_edge(
FXAA_NODE_2D,
core_2d::graph::node::END_MAIN_PASS_POST_PROCESSING,
)
.unwrap();
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ui/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn build_ui_render(app: &mut App) {
.unwrap();
graph_2d
.add_node_edge(
bevy_core_pipeline::core_2d::graph::node::TONEMAPPING,
bevy_core_pipeline::core_2d::graph::node::END_MAIN_PASS_POST_PROCESSING,
draw_ui_graph::node::UI_PASS,
)
.unwrap();
Expand All @@ -143,7 +143,7 @@ pub fn build_ui_render(app: &mut App) {
.unwrap();
graph_3d
.add_node_edge(
bevy_core_pipeline::core_3d::graph::node::TONEMAPPING,
bevy_core_pipeline::core_3d::graph::node::END_MAIN_PASS_POST_PROCESSING,
draw_ui_graph::node::UI_PASS,
)
.unwrap();
Expand Down