Use global clear color for camera driver node. (#15688)
When no cameras are configured, the `ClearColor` resource has no effect on the default window. Fixes https://discord.com/channels/691052431525675048/866787577687310356/1292601838075379796  
This commit is contained in:
parent
4357539e06
commit
037464800e
@ -1,5 +1,5 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
camera::{ExtractedCamera, NormalizedRenderTarget, SortedCameras},
|
camera::{ClearColor, ExtractedCamera, NormalizedRenderTarget, SortedCameras},
|
||||||
render_graph::{Node, NodeRunError, RenderGraphContext},
|
render_graph::{Node, NodeRunError, RenderGraphContext},
|
||||||
renderer::RenderContext,
|
renderer::RenderContext,
|
||||||
view::ExtractedWindows,
|
view::ExtractedWindows,
|
||||||
@ -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()`
|
// 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).
|
// 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() {
|
for (id, window) in world.resource::<ExtractedWindows>().iter() {
|
||||||
@ -72,7 +74,7 @@ impl Node for CameraDriverNode {
|
|||||||
view: swap_chain_texture,
|
view: swap_chain_texture,
|
||||||
resolve_target: None,
|
resolve_target: None,
|
||||||
ops: Operations {
|
ops: Operations {
|
||||||
load: LoadOp::Clear(wgpu::Color::BLACK),
|
load: LoadOp::Clear(clear_color_global.to_linear().into()),
|
||||||
store: StoreOp::Store,
|
store: StoreOp::Store,
|
||||||
},
|
},
|
||||||
})],
|
})],
|
||||||
|
Loading…
Reference in New Issue
Block a user