Advance M0 scene and rendering foundations
CI / Format, lint, test, build (push) Waiting to run

This commit is contained in:
Rbanh committed 2026-06-06 03:50:03 -04:00
1 parent 2fa64106c8
commit 2054fa2558
21 files changed
+711 -159

No files matched your search

+28 -7
View File
@@ -51,16 +51,24 @@ pub fn hdr_enabled_profile(profile: &ActiveCameraRenderProfile) -> bool {
}
}
/// True when the camera render target must be HDR for either authored HDR or Solari storage writes.
/// True when the camera render target must be HDR for authored HDR, atmosphere sky, or Solari storage writes.
pub fn hdr_required_for_effective_gi(
profile: &ActiveCameraRenderProfile,
effective_gi: GiPath,
) -> bool {
hdr_required_for_render_stack(hdr_enabled_profile(profile), effective_gi)
hdr_required_for_render_stack(
hdr_enabled_profile(profile),
profile.atmosphere,
effective_gi,
)
}
pub fn hdr_required_for_render_stack(hdr_enabled: bool, effective_gi: GiPath) -> bool {
hdr_enabled || effective_gi == GiPath::SolariDeferred
pub fn hdr_required_for_render_stack(
hdr_enabled: bool,
atmosphere_enabled: bool,
effective_gi: GiPath,
) -> bool {
hdr_enabled || atmosphere_enabled || effective_gi == GiPath::SolariDeferred
}
/// Applies the shared project rendering profile to all [`ProjectRenderCamera`] entities.
@@ -363,9 +371,22 @@ mod tests {
#[test]
fn solari_forces_hdr_render_target() {
assert!(hdr_required_for_render_stack(false, GiPath::SolariDeferred));
assert!(hdr_required_for_render_stack(true, GiPath::Forward));
assert!(!hdr_required_for_render_stack(false, GiPath::Forward));
assert!(hdr_required_for_render_stack(
false,
false,
GiPath::SolariDeferred
));
assert!(hdr_required_for_render_stack(true, false, GiPath::Forward));
assert!(!hdr_required_for_render_stack(
false,
false,
GiPath::Forward
));
}
#[test]
fn atmosphere_forces_hdr_render_target() {
assert!(hdr_required_for_render_stack(false, true, GiPath::Forward));
}
}
@@ -37,7 +37,7 @@ pub fn resolve_viewport_camera_owner(
}
}
/// True when any point or spot light in the world casts shadows (forces Forward GI).
/// True when any point or spot light in the world casts shadows.
pub fn has_local_shadow_lights(points: &Query<&PointLight>, spots: &Query<&SpotLight>) -> bool {
points.iter().any(|l| l.shadows_enabled) || spots.iter().any(|l| l.shadows_enabled)
}
@@ -57,7 +57,7 @@ pub fn world_has_local_shadow_lights(world: &mut World) -> bool {
false
}
/// Effective GI path for the main viewport, including auto-forward for local shadow lights.
/// Effective GI path for the main viewport.
pub fn effective_viewport_gi_path(
requested: GiPath,
caps: &RenderingCapabilities,
@@ -134,6 +134,7 @@ pub fn sync_viewport_camera_stack(
match mode {
ViewportStackApply::Full => {
strip_project_camera_fx(commands, entity);
commands.entity(entity).insert(ProjectRenderCamera);
apply_camera_render_profile(
commands,
@@ -208,7 +209,7 @@ mod tests {
use settings::RenderingCapabilities;
#[test]
fn effective_viewport_gi_forces_forward_when_local_shadow_lights_exist() {
fn effective_viewport_gi_keeps_solari_when_local_shadow_lights_exist() {
let caps = RenderingCapabilities {
rt_supported: true,
..Default::default()
@@ -221,7 +222,7 @@ mod tests {
});
assert_eq!(
effective_viewport_gi_path(GiPath::SolariDeferred, &caps, stats.as_ref(), true),
GiPath::Forward
GiPath::SolariDeferred
);
assert_eq!(
effective_viewport_gi_path(GiPath::SolariDeferred, &caps, stats.as_ref(), false),