Skip to content

Commit 3a78d20

Browse files
committed
Track render graph validation config module
1 parent a567f4d commit 3a78d20

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ mono_crash.*
2121

2222
# Build results
2323
[Dd]ebug/
24+
!crates/renderide/src/config/types/debug/
25+
!crates/renderide/src/config/types/debug/*.rs
2426
[Dd]ebugPublic/
2527
[Rr]elease/
2628
[Rr]eleases/
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//! Render-graph validation policy persisted under `[debug]`.
2+
3+
use serde::{Deserialize, Serialize};
4+
5+
/// Runtime policy for render-graph declaration and execution validation.
6+
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
7+
#[serde(rename_all = "snake_case")]
8+
pub enum RenderGraphValidationMode {
9+
/// Validation is disabled except for invariants already required by graph construction.
10+
Off,
11+
/// Validation diagnostics are logged and exposed but do not stop execution.
12+
#[default]
13+
Warn,
14+
/// Validation diagnostics become build or execute errors.
15+
Strict,
16+
}
17+
18+
impl RenderGraphValidationMode {
19+
/// Every validation mode in renderer-config display order.
20+
pub const ALL: &'static [Self] = &[Self::Off, Self::Warn, Self::Strict];
21+
22+
/// Human-readable label for the renderer config HUD.
23+
pub const fn label(self) -> &'static str {
24+
match self {
25+
Self::Off => "Off",
26+
Self::Warn => "Warn",
27+
Self::Strict => "Strict",
28+
}
29+
}
30+
31+
/// Returns whether this mode should collect diagnostics.
32+
pub const fn enabled(self) -> bool {
33+
!matches!(self, Self::Off)
34+
}
35+
36+
/// Returns whether diagnostics should be treated as errors.
37+
pub const fn is_strict(self) -> bool {
38+
matches!(self, Self::Strict)
39+
}
40+
}

0 commit comments

Comments
 (0)