explain the remaining float conversions at their use sites

This commit is contained in:
2026-09-21 01:23:45 +03:00
parent d297ec4271
commit 4d3d889f27
3 changed files with 29 additions and 4 deletions
+12
View File
@@ -345,6 +345,12 @@ impl TonemapPipeline {
let vb = [Some(self.vertex_buffer.clone())];
let strides = [16u32];
let offsets = [0u32];
// Capture dimensions are at most 4K (well under f32's 2^24 exact-integer
// limit), so the cast is lossless for every value this can hold.
#[allow(
clippy::cast_precision_loss,
reason = "capture width/height are bounded by MAX_ENCODE_WIDTH (3840), exactly representable in f32"
)]
let viewport = [D3D11_VIEWPORT {
TopLeftX: 0.0,
TopLeftY: 0.0,
@@ -858,6 +864,12 @@ fn capture_timing(frame_count: u64, elapsed_secs: f64, pipe_fps: u32) -> Option<
if frame_count == 0 || elapsed_secs <= 0.0 {
return None;
}
// A frame count high enough to lose f64 precision would be ~2^53 frames,
// which is centuries of capture; f64 handles this ratio exactly enough.
#[allow(
clippy::cast_precision_loss,
reason = "frame counts that could lose f64 precision are unreachable in a recording session"
)]
let actual_fps = frame_count as f64 / elapsed_secs;
Some((actual_fps, f64::from(pipe_fps) / actual_fps))
}