Auto: Reuse SBS parsing and fix stale preview cache failures

Integrate main's read limits and preserve the font, evaluator, converter,
and measured preview repairs. Complete the scoped type, comment, and
spacing cleanup.

Reuse one validated XML document for library layout and graph reads.
Associate cache maintenance completion with its submitted revision so
old failures cannot consume new settings or clear requests.
This commit is contained in:
chasse20 committed 2026-11-14 22:52:26 +00:00
commit 1a7225c8c2
158 files changed
+2536 -788

No files matched your search

+8 -4
View File
@@ -8,19 +8,22 @@ use std::sync::Arc;
fn pixel(value: Value, gray: bool, format: materialcraft_core::OutputFormat) -> Result<[f32; 4], String> {
let values = super::value_type::floats(&value)?;
let integer = matches!(format, materialcraft_core::OutputFormat::U8 | materialcraft_core::OutputFormat::U16 | materialcraft_core::OutputFormat::Inherit);
// Integer texture storage converts NaN to black and saturates infinities.
// Rejecting those values before storage breaks zero-softness masks.
// Integer texture storage converts NaN to black and saturates infinities
// Rejecting those values before storage breaks zero-softness masks
if !integer && values.iter().take(super::value_type::dimensions(&value)).any(|value| !value.is_finite()) {
return Err("pixel function produced a non-finite output".into());
}
Ok(if gray {
let intensity = if super::value_type::dimensions(&value) == 4 {
// RGBA results on a grayscale processor use equal RGB weights.
// Preserve the fused accumulation order at floating-point outputs.
// RGBA results on a grayscale processor use equal RGB weights
// Preserve the fused accumulation order at floating-point outputs
values[2].mul_add(1.0 / 3.0, values[0].mul_add(1.0 / 3.0, values[1] * (1.0 / 3.0)))
} else {
values[0]
};
[intensity, 0.0, 0.0, 0.0]
} else {
match super::value_type::dimensions(&value) {
@@ -55,6 +58,7 @@ pub(crate) fn pixel_processor(context: &CookContext) -> CookResult {
let result = pixel(program.evaluate_pixel(&evaluation, state)?, gray, context.format)?;
target.copy_from_slice(result.get(..channels).ok_or("invalid output channels")?);
}
Ok(())
})?;
Ok(vec![Image { w: width, h: height, kind, integer_sampling: false, data: Arc::new(data) }])