Skip to content

Commit

Permalink
Use global clear color for camera driver node. (#15688)
Browse files Browse the repository at this point in the history
  • Loading branch information
tychedelia authored Oct 7, 2024
1 parent 4357539 commit 0374648
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bevy_render/src/camera/camera_driver_node.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
camera::{ExtractedCamera, NormalizedRenderTarget, SortedCameras},
camera::{ClearColor, ExtractedCamera, NormalizedRenderTarget, SortedCameras},
render_graph::{Node, NodeRunError, RenderGraphContext},
renderer::RenderContext,
view::ExtractedWindows,
Expand Down Expand Up @@ -53,6 +53,8 @@ impl Node for CameraDriverNode {
}
}

let clear_color_global = world.resource::<ClearColor>();

// wgpu (and some backends) require doing work for swap chains if you call `get_current_texture()` and `present()`
// This ensures that Bevy doesn't crash, even when there are no cameras (and therefore no work submitted).
for (id, window) in world.resource::<ExtractedWindows>().iter() {
Expand All @@ -72,7 +74,7 @@ impl Node for CameraDriverNode {
view: swap_chain_texture,
resolve_target: None,
ops: Operations {
load: LoadOp::Clear(wgpu::Color::BLACK),
load: LoadOp::Clear(clear_color_global.to_linear().into()),
store: StoreOp::Store,
},
})],
Expand Down

0 comments on commit 0374648

Please sign in to comment.