Format the tree the way the gate asks for it
`cargo fmt --check` is a required step and had drifted across 45 files. Most of it arrived this week: several operations were written in parallel worktrees and merged by hand, and a hand-merge resolves conflicts without ever running the formatter over the result. No behaviour changes — this is `cargo fmt --all` and nothing else, kept as its own commit so the next reader can skip it wholesale rather than search it for one that matters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,9 @@
|
||||
//! least to perceived sharpness. Scaling all three about a virtual reference
|
||||
//! would soften the image even when the correction is right.
|
||||
|
||||
use crate::descriptor::{Attribute, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId, Scale, Unit};
|
||||
use crate::descriptor::{
|
||||
Attribute, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId, Scale, Unit,
|
||||
};
|
||||
use crate::lens::Warp;
|
||||
use crate::operation::{Helper, Uniform};
|
||||
|
||||
|
||||
@@ -764,9 +764,11 @@ mod tests {
|
||||
};
|
||||
assert_eq!(gate_of(0.0), 0.0);
|
||||
assert!((gate_of(1.0) - 0.25).abs() < 1e-6);
|
||||
assert!(chain_at(&sharpening(50.0, 1.0), RenderScale::full((512, 512))).passes[0]
|
||||
.source
|
||||
.contains("gate > 0.0"));
|
||||
assert!(
|
||||
chain_at(&sharpening(50.0, 1.0), RenderScale::full((512, 512))).passes[0]
|
||||
.source
|
||||
.contains("gate > 0.0")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -783,7 +785,11 @@ mod tests {
|
||||
for scale in scales {
|
||||
for pass in chain_at(&sharpening(75.0, 1.0), scale).passes {
|
||||
assert_eq!(pass.uniforms.len() % 4, 0, "{}", pass.label);
|
||||
assert!(pass.uniforms.iter().all(|v| v.is_finite()), "{}", pass.label);
|
||||
assert!(
|
||||
pass.uniforms.iter().all(|v| v.is_finite()),
|
||||
"{}",
|
||||
pass.label
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -805,10 +811,38 @@ mod tests {
|
||||
// word be safe in one stage and not in the other, which is the sort of
|
||||
// difference nobody discovers until a shader fails to compile.
|
||||
const RESERVED: &[&str] = &[
|
||||
"target", "sample", "filter", "texture", "buffer", "binding", "const", "enum", "mat",
|
||||
"vec", "ptr", "ref", "shared", "static", "typedef", "union", "unless", "handle",
|
||||
"layout", "packed", "premerge", "regardless", "active", "do", "input", "output",
|
||||
"private", "resource", "restrict", "self", "std", "where",
|
||||
"target",
|
||||
"sample",
|
||||
"filter",
|
||||
"texture",
|
||||
"buffer",
|
||||
"binding",
|
||||
"const",
|
||||
"enum",
|
||||
"mat",
|
||||
"vec",
|
||||
"ptr",
|
||||
"ref",
|
||||
"shared",
|
||||
"static",
|
||||
"typedef",
|
||||
"union",
|
||||
"unless",
|
||||
"handle",
|
||||
"layout",
|
||||
"packed",
|
||||
"premerge",
|
||||
"regardless",
|
||||
"active",
|
||||
"do",
|
||||
"input",
|
||||
"output",
|
||||
"private",
|
||||
"resource",
|
||||
"restrict",
|
||||
"self",
|
||||
"std",
|
||||
"where",
|
||||
];
|
||||
|
||||
for pass in chain_at(&sharpening(100.0, 2.0), RenderScale::full((512, 512))).passes {
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
//! adjusted, each one's share depends on what the other is set to, so turning
|
||||
//! up one colour's saturation quietly weakened its neighbour's hue shift.
|
||||
|
||||
use crate::descriptor::{Attribute, Facet, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId};
|
||||
use crate::descriptor::{
|
||||
Attribute, Facet, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId,
|
||||
};
|
||||
use crate::operation::{Helper, Operation, Uniform};
|
||||
use crate::ops::helpers;
|
||||
|
||||
|
||||
@@ -121,12 +121,7 @@ impl Channel {
|
||||
/// Master first because it runs first — see the module documentation for
|
||||
/// why that is the composition order — and because a list showing the
|
||||
/// grade before the tone would be describing a different operation.
|
||||
pub const ALL: [Channel; 4] = [
|
||||
Channel::Master,
|
||||
Channel::Red,
|
||||
Channel::Green,
|
||||
Channel::Blue,
|
||||
];
|
||||
pub const ALL: [Channel; 4] = [Channel::Master, Channel::Red, Channel::Green, Channel::Blue];
|
||||
|
||||
/// Position in [`Self::ALL`], and so in every array keyed by channel.
|
||||
pub const fn index(self) -> usize {
|
||||
@@ -771,7 +766,10 @@ impl Operation for ToneCurve {
|
||||
// declared from, so a call and its uniform block cannot disagree
|
||||
// about a name.
|
||||
let args = UNIFORM_NAMES[channel.index()].join(", ");
|
||||
let _ = writeln!(body, "c.{component} = channel_curve(c.{component}, {args});");
|
||||
let _ = writeln!(
|
||||
body,
|
||||
"c.{component} = channel_curve(c.{component}, {args});"
|
||||
);
|
||||
}
|
||||
|
||||
// Whichever curves ran, the result has to be a colour: the spline's
|
||||
@@ -1345,7 +1343,9 @@ mod tests {
|
||||
|
||||
let body = c.wgsl_body();
|
||||
let master = body.find("apply_tone_gain").expect("the master curve runs");
|
||||
let red = body.find("c.r = channel_curve").expect("the red curve runs");
|
||||
let red = body
|
||||
.find("c.r = channel_curve")
|
||||
.expect("the red curve runs");
|
||||
assert!(master < red, "the master curve must run first:\n{body}");
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
//! profile is a "make the horizon straight" task, which one term does well.
|
||||
//! The full triple is reachable by loading a profile.
|
||||
|
||||
use crate::descriptor::{Attribute, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId, Scale, Unit};
|
||||
use crate::descriptor::{
|
||||
Attribute, LocalizedKey, OpDescriptor, OpId, ParamDescriptor, ParamId, Scale, Unit,
|
||||
};
|
||||
use crate::lens::Warp;
|
||||
use crate::operation::{Helper, Uniform};
|
||||
|
||||
|
||||
@@ -619,7 +619,10 @@ mod tests {
|
||||
let scale = RenderScale::full((2000, 1500));
|
||||
let only_clarity = composed(50.0, 0.0, scale);
|
||||
assert_eq!(only_clarity.len(), 2, "one operation, two passes");
|
||||
assert!(only_clarity.passes.iter().all(|p| p.label.starts_with("clarity/")));
|
||||
assert!(only_clarity
|
||||
.passes
|
||||
.iter()
|
||||
.all(|p| p.label.starts_with("clarity/")));
|
||||
|
||||
let both = composed(50.0, 50.0, scale);
|
||||
assert_eq!(both.len(), 4);
|
||||
@@ -701,7 +704,10 @@ mod tests {
|
||||
// acutance family's unit.
|
||||
let proxy = RenderScale::new((2000, 1500), (6000, 4500));
|
||||
let clarity = Clarity::with_amount(60.0);
|
||||
assert_eq!(clarity.kernel(proxy), clarity.kernel(RenderScale::full((2000, 1500))));
|
||||
assert_eq!(
|
||||
clarity.kernel(proxy),
|
||||
clarity.kernel(RenderScale::full((2000, 1500)))
|
||||
);
|
||||
assert!(
|
||||
proxy.source_pixels(96.0) < 40.0,
|
||||
"the same length in the other unit would have collapsed"
|
||||
@@ -786,7 +792,9 @@ mod tests {
|
||||
// slider can produce is `gain * threshold` stops however violent the
|
||||
// edge — a bound that holds by construction rather than by tuning.
|
||||
let combine = &Clarity::with_amount(100.0).passes(RenderScale::full((2000, 1500)))[1];
|
||||
assert!(combine.wgsl.contains("threshold * tanh(detail / threshold)"));
|
||||
assert!(combine
|
||||
.wgsl
|
||||
.contains("threshold * tanh(detail / threshold)"));
|
||||
|
||||
let bound = |u: &[Uniform]| {
|
||||
let get = |n| u.iter().find(|x| x.name == n).unwrap().value;
|
||||
@@ -819,7 +827,10 @@ mod tests {
|
||||
|
||||
// And texture does not carry the helpers it would need for one, so its
|
||||
// shader says what it does rather than merely not calling it.
|
||||
assert!(Texture::new().helpers().iter().any(|h| h.name == "log_luma"));
|
||||
assert!(Texture::new()
|
||||
.helpers()
|
||||
.iter()
|
||||
.any(|h| h.name == "log_luma"));
|
||||
assert!(!Texture::new()
|
||||
.helpers()
|
||||
.iter()
|
||||
|
||||
@@ -820,7 +820,13 @@ mod tests {
|
||||
// Everything else about the two must match, or one axis is filtered
|
||||
// harder than the other and a round blotch comes out oval.
|
||||
assert_eq!(passes[0].radius, passes[1].radius);
|
||||
for name in ["radius", "inv_spatial", "guide_k", "chroma_k", "noise_floor"] {
|
||||
for name in [
|
||||
"radius",
|
||||
"inv_spatial",
|
||||
"guide_k",
|
||||
"chroma_k",
|
||||
"noise_floor",
|
||||
] {
|
||||
let of = |p: &DetailPass| {
|
||||
p.uniforms
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user