finish the lint pass: allow what is contractual, fix what is not

This commit is contained in:
2026-09-21 01:38:01 +03:00
parent c46fe82543
commit c746f4916a
6 changed files with 110 additions and 8 deletions
+18 -3
View File
@@ -95,6 +95,13 @@ struct TonemapPipeline {
height: u32,
}
// One D3D11 object per descriptor, in the order the API documents them; the
// length is the API's, not ours, and splitting it would scatter a single
// initialization sequence across helpers that each need half the locals.
#[allow(
clippy::too_many_lines,
reason = "linear D3D11 resource setup: each step needs the previous object in scope"
)]
impl TonemapPipeline {
fn new(device: &ID3D11Device, width: u32, height: u32) -> Result<Self> {
// Vertex shader: fullscreen-triangle pass-through (no vertex buffer).
@@ -303,6 +310,12 @@ impl TonemapPipeline {
/// Run the tonemap shader on `src` (the captured HDR texture) and write
/// the resulting BGRA8 bytes to `out`. One GPU draw + one staging readback.
/// Recreates itself if `src` dimensions differ from the cached RT.
// The draw sequence, the bind state and the readback all have to happen in
// one call on the frame's own context; the length is the sequence.
#[allow(
clippy::too_many_lines,
reason = "the GPU draw and its readback share one context and one mapped buffer"
)]
fn process(
&mut self,
device: &ID3D11Device,
@@ -589,7 +602,7 @@ pub(crate) fn primary_monitor_dims() -> Result<(u32, u32)> {
/// resolves the device name through `GetMonitorInfoW` and queries its current
/// settings with `EnumDisplaySettingsW`. Falls back to [`FALLBACK_REFRESH_HZ`]
/// on any failure.
fn monitor_refresh_rate(monitor: &Monitor) -> u32 {
fn monitor_refresh_rate(monitor: Monitor) -> u32 {
match monitor.refresh_rate() {
Ok(0) => {
tracing::warn!("monitor reported 0 Hz refresh, using fallback");
@@ -607,7 +620,7 @@ fn monitor_refresh_rate(monitor: &Monitor) -> u32 {
/// capture API. WGC delivers frames roughly at the monitor's refresh rate;
/// declaring that rate (instead of a fixed high constant) keeps the raw
/// timestamps close to real time so `fix_intermediate_fps` only nudges.
fn detect_pipe_framerate(monitor: &Monitor) -> u32 {
fn detect_pipe_framerate(monitor: Monitor) -> u32 {
monitor_refresh_rate(monitor)
}
@@ -634,6 +647,7 @@ fn monitor_at_point(x: i32, y: i32) -> Result<Monitor> {
#[allow(
clippy::expect_used,
clippy::unwrap_in_result,
reason = "Windows always has a primary monitor; if enumeration fails there is nothing sensible to capture instead"
)]
pub(crate) fn start(
@@ -672,7 +686,7 @@ pub(crate) fn start(
let frame_counter = Arc::new(std::sync::atomic::AtomicU64::new(0));
let pipe_fps = detect_pipe_framerate(&monitor);
let pipe_fps = detect_pipe_framerate(monitor);
let setup = CaptureSetup {
output_path: output_path.clone(),
@@ -765,6 +779,7 @@ impl CaptureSession {
/// `output` exists, returns Ok without re-running ffmpeg.
#[allow(
clippy::expect_used,
clippy::unwrap_in_result,
reason = "callers rule out the None case that capture_timing returns None for"
)]
pub(crate) fn fix_intermediate_fps(