Skip to content

Commit

Permalink
Track hdr on ExtractedCamera in order to properly determine when to t…
Browse files Browse the repository at this point in the history
…rigger MSAA writeback.
  • Loading branch information
tychedelia committed May 21, 2024
1 parent 8bdaffc commit 19b3d4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/bevy_render/src/camera/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ pub struct ExtractedCamera {
pub clear_color: ClearColorConfig,
pub sorted_camera_index_for_target: usize,
pub exposure: f32,
pub hdr: bool,
}

pub fn extract_cameras(
Expand Down Expand Up @@ -902,6 +903,7 @@ pub fn extract_cameras(
exposure: exposure
.map(|e| e.exposure())
.unwrap_or_else(|| Exposure::default().exposure()),
hdr: camera.hdr,
},
ExtractedView {
projection: camera.projection_matrix(),
Expand Down Expand Up @@ -953,6 +955,7 @@ pub struct SortedCamera {
pub entity: Entity,
pub order: isize,
pub target: Option<NormalizedRenderTarget>,
pub hdr: bool,
}

pub fn sort_cameras(
Expand All @@ -965,6 +968,7 @@ pub fn sort_cameras(
entity,
order: camera.order,
target: camera.target.clone(),
hdr: camera.hdr,
});
}
// sort by order and ensure within an order, RenderTargets of the same type are packed together
Expand All @@ -985,7 +989,7 @@ pub fn sort_cameras(
}
}
if let Some(target) = &sorted_camera.target {
let count = target_counts.entry(target.clone()).or_insert(0usize);
let count = target_counts.entry((target.clone(), sorted_camera.hdr)).or_insert(0usize);
let (_, mut camera) = cameras.get_mut(sorted_camera.entity).unwrap();
camera.sorted_camera_index_for_target = *count;
*count += 1;
Expand Down

0 comments on commit 19b3d4c

Please sign in to comment.