Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(render): rebase the inventory onto main and test the flag gate
The trace keeps main's v1.48 Hi-Z wording and adds the gated-flag
reject sentence on the timestamp row. last_verified_commit is
83798b4. #395 owns the clear, the sky sample, and the sun. Fog and
god rays stay light_the_world callers. flag_on accepts a bare flag,
=true, and a two-token true, and the SSGI, TAA, and upscale errors
name the uncopied history images.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
  • Loading branch information
cursoragent and lazyxeon committed Oct 21, 2026
commit f72defdaf757b8fd7aa2751e7d49c864433e1893
63 changes: 55 additions & 8 deletions astraweave-render/src/bin/gpu_frame_budget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ const SAMPLES: usize = 120;

fn main() -> anyhow::Result<()> {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("warn")).init();
reject_gated_flags()?;
let args: Vec<String> = std::env::args().skip(1).collect();
reject_gated_flags(&args)?;
let glb = glb_path();
let heavy = scene_is_heavy();
let debug_timestamps = debug_timestamps();
Expand Down Expand Up @@ -775,28 +776,32 @@ fn renderer_limits(limits: &wgpu::Limits) -> [(&'static str, u64); 15] {
]
}

fn flag_on(name: &str) -> bool {
std::env::args().any(|arg| arg == name || arg == format!("{name}=true"))
fn flag_on(args: &[String], name: &str) -> bool {
args.iter().enumerate().any(|(index, arg)| {
arg == name
|| arg == &format!("{name}=true")
|| (arg == name && args.get(index + 1).map(String::as_str) == Some("true"))
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
})
}

/// Scaffolding only. No gated flag draws a frame, so no cell can be filled.
fn reject_gated_flags() -> anyhow::Result<()> {
fn reject_gated_flags(args: &[String]) -> anyhow::Result<()> {
const BLOCKED: &[(&str, &str)] = &[
(
"--atmosphere",
"enabling it skips the HDR and depth clear, so the heavy scene does not land",
),
(
"--ssgi",
"normal and velocity targets are allocated and never written",
"normal and velocity targets are allocated and never written, and ssgi_history is sampled before copy_to_history",
),
(
"--taa",
"normal and velocity targets are allocated and never written",
"normal and velocity targets are allocated and never written, and taa_history is sampled before copy_to_history",
),
(
"--upscale",
"normal and velocity targets are allocated and never written",
"normal and velocity targets are allocated and never written, and upscale_history is sampled before copy_to_history",
),
(
"--dof",
Expand All @@ -809,7 +814,7 @@ fn reject_gated_flags() -> anyhow::Result<()> {
];
let hits: Vec<String> = BLOCKED
.iter()
.filter(|(flag, _)| flag_on(flag))
.filter(|(flag, _)| flag_on(args, flag))
.map(|(flag, why)| format!("{flag} ({why})"))
.collect();
if hits.is_empty() {
Expand Down Expand Up @@ -952,3 +957,45 @@ fn median(values: &mut [f64]) -> f64 {
values[mid]
}
}

#[cfg(test)]
mod gated_flag_tests {
use super::reject_gated_flags;

fn args(parts: &[&str]) -> Vec<String> {
parts.iter().map(|part| (*part).to_string()).collect()
}

fn rejected(parts: &[&str]) -> String {
reject_gated_flags(&args(parts))
.expect_err("gated flag must fail before a frame")
.to_string()
}

#[test]
fn reject_gated_flags_covers_each_form() {
assert!(reject_gated_flags(&args(&["--scene", "heavy"])).is_ok());
for flag in [
"--atmosphere",
"--ssgi",
"--taa",
"--upscale",
"--dof",
"--clouds",
] {
let message = rejected(&[flag]);
assert!(message.contains(flag), "{message}");
}
let equals = rejected(&["--atmosphere=true"]);
assert!(equals.contains("--atmosphere"), "{equals}");
let two_token = rejected(&["--atmosphere", "true"]);
assert!(two_token.contains("--atmosphere"), "{two_token}");
let pair = rejected(&["--atmosphere", "--ssgi"]);
assert!(pair.contains("--atmosphere"), "{pair}");
assert!(pair.contains("--ssgi"), "{pair}");
assert!(pair.contains("ssgi_history"), "{pair}");
assert!(rejected(&["--taa"]).contains("taa_history"));
assert!(rejected(&["--upscale"]).contains("upscale_history"));
assert!(rejected(&["--ssgi"]).contains("copy_to_history"));
}
}
Loading
Loading