Emit floats an f32 can hold, and drop the format! that formats nothing
CI runs cargo fmt --check and clippy -D warnings, and this branch had never been through either. Both would have failed it. The bulk was the generated colour tables: eight significant figures where an f32 carries about 7.2, so the eighth is noise that rounds away at compile time and clippy's excessive_precision says so 109 times over. Fixed in the generator rather than only in the file, so it stays fixed -- and the file is trimmed in place rather than re-derived, because regenerating it needs a colour-science stack that has nothing to do with the defect. The format! in the composer is mine too, from extracting the rendering tail: the braces in it were escaped because the text used to live inside a larger template, and once extracted the escapes are noise and the call formats nothing. Also here, and clearly not mine: an unused import and a shadowed binding in dr-gpu, and an unused import in a test. They are pre-existing -- clippy has been failing on master before this branch existed, on lints like is_multiple_of that arrived with a toolchain rather than with anyone's code. Fixed because CI cannot go green around them, and called out because a merge commit is a bad place to quietly edit someone else's crate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -112,11 +112,11 @@ mod tests {
|
||||
stock: "test_stock".into(),
|
||||
print: None,
|
||||
tables: crate::ops::FilmTables {
|
||||
exposure_matrix: [[5.0, 0.5, 0.2], [0.1, 5.0, 0.3], [0.2, 0.5, 4.0]],
|
||||
curves: vec![[0.5, 0.5, 0.5]; crate::ops::film_sim::CURVE_SAMPLES],
|
||||
curve_log_min: -3.0,
|
||||
curve_log_max: 4.0,
|
||||
lut: vec![[0.5, 0.5, 0.5]; 32 * 32 * 32],
|
||||
exposure_matrix: [[5.0, 0.5, 0.2], [0.1, 5.0, 0.3], [0.2, 0.5, 4.0]],
|
||||
curves: vec![[0.5, 0.5, 0.5]; crate::ops::film_sim::CURVE_SAMPLES],
|
||||
curve_log_min: -3.0,
|
||||
curve_log_max: 4.0,
|
||||
lut: vec![[0.5, 0.5, 0.5]; 32 * 32 * 32],
|
||||
density_max: 3.0,
|
||||
lut_size: 32,
|
||||
},
|
||||
|
||||
@@ -707,8 +707,7 @@ pub fn compose_full(
|
||||
" // The camera profile's base curve and the conversion out of camera\n // space are both absent: an operation declaring `Operation::renders`\n // has done both, and doing them again would render the picture twice.\n"
|
||||
.to_string()
|
||||
} else {
|
||||
format!(
|
||||
" // ==== camera profile: the base curve (FR-DEV-3e) ====
|
||||
" // ==== camera profile: the base curve (FR-DEV-3e) ====
|
||||
//
|
||||
// Marked with `====` and not the `----` an operation block carries: this
|
||||
// is not one, and the difference is what several tests count on to tell
|
||||
@@ -740,7 +739,7 @@ pub fn compose_full(
|
||||
// It is off for a JPEG and any other already-rendered source, which must
|
||||
// not be rendered twice, and for a body the profile database declines to
|
||||
// offer any curve for at all.
|
||||
if (u.base_curve_last.z > 0.5) {{
|
||||
if (u.base_curve_last.z > 0.5) {
|
||||
c = vec3<f32>(
|
||||
curve_eval(
|
||||
u.base_curve_x.x, u.base_curve_y.x, u.base_curve_x.y, u.base_curve_y.y,
|
||||
@@ -758,7 +757,7 @@ pub fn compose_full(
|
||||
u.base_curve_last.x, u.base_curve_last.y, c.b,
|
||||
),
|
||||
);
|
||||
}}
|
||||
}
|
||||
|
||||
// Camera space -> linear sRGB. Applied after the adjustments so white
|
||||
// balance and exposure act on sensor-native values, which is where they
|
||||
@@ -770,7 +769,8 @@ pub fn compose_full(
|
||||
dot(u.cam_to_srgb_1.rgb, c),
|
||||
dot(u.cam_to_srgb_2.rgb, c),
|
||||
);
|
||||
")
|
||||
"
|
||||
.to_string()
|
||||
};
|
||||
|
||||
let source = format!(
|
||||
|
||||
@@ -201,14 +201,32 @@ impl Operation for FilmSim {
|
||||
let mut out = Vec::with_capacity(MATRIX_FIELDS.len() + 5);
|
||||
for (l, row) in m.iter().enumerate() {
|
||||
for (c, v) in row.iter().enumerate() {
|
||||
out.push(Uniform { name: MATRIX_FIELDS[l][c], value: *v });
|
||||
out.push(Uniform {
|
||||
name: MATRIX_FIELDS[l][c],
|
||||
value: *v,
|
||||
});
|
||||
}
|
||||
}
|
||||
out.push(Uniform { name: "log_min", value: t.curve_log_min });
|
||||
out.push(Uniform { name: "log_max", value: t.curve_log_max });
|
||||
out.push(Uniform { name: "density_max", value: t.density_max });
|
||||
out.push(Uniform { name: "lut_size", value: t.lut_size as f32 });
|
||||
out.push(Uniform { name: "print_exposure", value: self.print_exposure });
|
||||
out.push(Uniform {
|
||||
name: "log_min",
|
||||
value: t.curve_log_min,
|
||||
});
|
||||
out.push(Uniform {
|
||||
name: "log_max",
|
||||
value: t.curve_log_max,
|
||||
});
|
||||
out.push(Uniform {
|
||||
name: "density_max",
|
||||
value: t.density_max,
|
||||
});
|
||||
out.push(Uniform {
|
||||
name: "lut_size",
|
||||
value: t.lut_size as f32,
|
||||
});
|
||||
out.push(Uniform {
|
||||
name: "print_exposure",
|
||||
value: self.print_exposure,
|
||||
});
|
||||
out
|
||||
}
|
||||
|
||||
|
||||
@@ -1667,7 +1667,10 @@ mod tests {
|
||||
// stock's default paper, or "show me the negative" would be
|
||||
// unrepresentable.
|
||||
let mut v = version_of(&edited());
|
||||
v.film = Some(FilmRef { stock: "kodak_portra_400".into(), print: None });
|
||||
v.film = Some(FilmRef {
|
||||
stock: "kodak_portra_400".into(),
|
||||
print: None,
|
||||
});
|
||||
let mut side = Sidecar::default();
|
||||
side.versions.insert(v.uuid.clone(), v);
|
||||
|
||||
@@ -1708,7 +1711,11 @@ mod tests {
|
||||
let text = "drsc 1\n\n[version u1]\nname = Default\nrevision = 1\nmodified = 0\n\
|
||||
film = ilford_hp5_plus\n";
|
||||
let side = Sidecar::parse(text).expect("parses");
|
||||
assert!(side.to_text().contains("film = ilford_hp5_plus"), "{}", side.to_text());
|
||||
assert!(
|
||||
side.to_text().contains("film = ilford_hp5_plus"),
|
||||
"{}",
|
||||
side.to_text()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1730,7 +1737,10 @@ mod tests {
|
||||
local.revision = 2;
|
||||
|
||||
let mut remote = base.clone();
|
||||
remote.film = Some(FilmRef { stock: "kodak_kodachrome_64".into(), print: None });
|
||||
remote.film = Some(FilmRef {
|
||||
stock: "kodak_kodachrome_64".into(),
|
||||
print: None,
|
||||
});
|
||||
remote.revision = 9;
|
||||
|
||||
local.merge(&remote, Some(&base));
|
||||
@@ -1750,7 +1760,10 @@ mod tests {
|
||||
// there "unset" and "set to zero" are indistinguishable; here the
|
||||
// revision says which happened.
|
||||
let mut base = version_of(&edited());
|
||||
base.film = Some(FilmRef { stock: "kodak_portra_400".into(), print: None });
|
||||
base.film = Some(FilmRef {
|
||||
stock: "kodak_portra_400".into(),
|
||||
print: None,
|
||||
});
|
||||
base.revision = 1;
|
||||
|
||||
let mut local = base.clone();
|
||||
|
||||
Reference in New Issue
Block a user