Skip to content

Clippy: main is clean again with -D warnings, with and without --all-features (3 lints) - #841

Open
MamaLeVrai wants to merge 2 commits into
fxceless:mainfrom
MamaLeVrai:clippy-clean
Open

MamaLeVrai wants to merge 2 commits into
fxceless:mainfrom
MamaLeVrai:clippy-clean

Conversation

@MamaLeVrai

@MamaLeVrai MamaLeVrai commented Nov 25, 2026 •

Copy link
Copy Markdown

On main (0b0074e), cargo clippy --workspace --all-targets --locked -- -D warnings fails in victory-gpu on this machine (Windows 11, RX 6950 XT, Rust 1.98.1), with and without --all-features. Four lints (three of them were already there when I opened this; shadow.rs got the fourth since), none changing behaviour:

  • placed_filler_twins (resource.rs) is read only by the diagnostics memory report (copystat.rs, which is built with the diagnostics feature only), so it was dead code without that feature: it is compiled with the feature now (#[cfg(all(windows, feature = "diagnostics"))]).
  • Rig::depth_written (indirect.rs) is kept next to depth_tested but never read: renamed _depth_written, as the struct's other kept fields (_kept, _target_heaps) are.
  • The scissor census in draw.rs sorts with sort_unstable_by_key(|r| Reverse(r.1)) instead of sort_unstable_by(|a, b| b.1.cmp(&a.1)).
  • shadow.rs (the own-view write census): n % 16384 == 0 is n.is_multiple_of(16384).

Checks: cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features: clean. cargo test --workspace --locked: the crates before victory-gpu pass; in victory-gpu the library's tests pass apart from the intermittent failures that main has (the budget test, see #849; the crash of the test binary, see #850). The title was not run.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

Copilot AI balanced review requested due to automatic review settings November 25, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

GromX0 pushed a commit to GromX0/victory-fork that referenced this pull request Nov 25, 2026
Without the structure builder the nodes the title's ray-traced passes
read are not a scene. With the switch each image_bvh*_intersect_ray
returns 0xFFFFFFFF (no child), so traversals end in a miss: shadow rays
see nothing in the way. Off by default; the switch is in the shader
cache fingerprint. Recipe from Xeltax/VIcky 3fb7f967 (after LooperSalty,
VIctory fxceless#841), written for this branch's software node test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MamaLeVrai and others added 2 commits November 25, 2026 13:52
…hout --all-features

Three lints, none changing behaviour:
- placed_filler_twins is read only by the diagnostics memory report: compiled with the feature
  that reads it (it was dead code without it);
- Rig::depth_written (indirect.rs) is kept next to depth_tested but never read: _depth_written, as
  the struct's other kept fields are named;
- the scissor census sorts with sort_unstable_by_key and Reverse.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The fourth lint of the newest main (n % 16384 == 0 in the own-view write census); same value.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
…not once an unmap

cafeoh measured this on an RTX 2080 Ti: loading a save ran `evict_placed_in`
~5,000 times a second and it took ~975 ms of every second, on the same
thread that was doing the unmapping -- so the load stalled and the save
never loaded. In the whole load it let go of 59 host copies, so nearly
every one of those walks found nothing, and skipping just that call made
the load work.

The walk was the cost, and it was in the wrong place. `title_memory_remapped`
now only records the range: a lock, a merge over at most KEPT_RANGES ranges,
no read of the texture table, whatever the table's size. `let_go_idle` --
which already walks every texture once a frame, on the thread that submits
-- asks whether a placed texture's source was among those ranges and lets
its host copy go without waiting out the idle time.

What a host copy needs to go is unchanged: nothing else may hold it (no
list not yet reset, no descriptor slot), which is why this cannot make a
texture be read from the wrong memory; the source no longer existing only
adds a reason to let it go, never a reason to keep it. The idle path is
untouched, so a texture nothing unmapped still waits its IDLE_MS and
IDLE_FRAMES.

Ranges are merged as they arrive -- overlapping, touching, and bridging
ranges become one -- so five thousand unmaps a second do not become five
thousand ranges. Past KEPT_RANGES the sweep is told to treat every placed
texture as due, which is sound for the same reason.

Tests: merge in every arrival order, the cap and the "same range grown is
not a new range" case, and which textures a set of ranges makes due.
Probe: store ranges without merging -> both range tests red with the
unsorted, unmerged list -> restored byte-identical (sha256 531418328c0f49c7).
`cargo test -p victory-gpu --lib -- --test-threads=1`: 148 passed, 0 failed,
3 ignored. Clippy: only the two pre-existing (fxceless#841).

Not tested: in game, on any card. This is cafeoh's report explained, not
their report re-run.
HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
…n more places

fxceless#166 taught `victory-gpu` to read boolean switches through a parser: unset,
empty, 0, false, no and off are off. That fixed eight call sites and left the
class open. Nineteen reads had the shape, not eight, and
`std::env::var_os(..).is_some()` asks "was this set", which is not the
question any of them asks.

What was still wrong, and what it cost:

- `victory-shader` read `VICTORY_SHADER_CENSUS`, `VICTORY_WAVE_WHY`,
  `VICTORY_DESC_WHY`, `VICTORY_MESH_OUTPUT_STRICT` and `VICTORY_STRICT_JOINS`
  that way: setting any of them to 0 turned it on.
- `crates/victory-shader/src/emit/host.rs` read `VICTORY_D3D12_DEBUG` the old
  way -- the same variable fxceless#166 fixed in the GPU crate. Two readers of one
  switch disagreeing: `VICTORY_D3D12_DEBUG=0` turned the debug layer off on
  the device and left it on in the shader emitter, and the debug layer costs
  hundreds of milliseconds a frame.
- `victory-hle` read `VICTORY_AUDIO_CAPTURE` that way.

The shader crate deliberately does not depend on `victory-gpu`, so it carries
its own twelve-line parser in `victory_shader::env` with the same rule, and a
test that pins the two to the same answers. `victory-hle` already depends on
`victory-gpu`, so it uses `victory_gpu::env_flag` rather than growing a third
copy.

The parser test fxceless#166 shipped could not have caught any of this: it exercises
`parse_env_flag` and says nothing about whether a call site uses it -- a guard
that inspects only itself. So `xtask` now refuses the shape anywhere in the
tree, by name or by file: `var_os(..)` immediately tested with `.is_some()`.
It scans text rather than a regex so that spaces between the call and the test
cannot slip past, and it is fed the shape it hunts, with and without spaces,
plus three reads that must keep passing.

Probe: put `victory-hle`'s audio switch back to the old form -> the scan fails
naming `crates/victory-hle/src/modules/audio/capture.rs:69 VICTORY_AUDIO_CAPTURE`
-> restored byte-identical (sha256 ac03fb3a960689ad).

cargo test -p victory-gpu --lib: 145 passed, 0 failed, 3 ignored.
cargo test -p victory-shader --lib: 217 passed, 0 failed, 3 ignored.
cargo test -p xtask: 6 passed.
Clippy on victory-shader and xtask: clean. victory-hle cannot be reached past
victory-gpu's two pre-existing errors (fxceless#841).
HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
The switch this branch added turned the clamp pass off so `ExecuteIndirect`
could read the title's own argument buffer. `dkdknight` ran it on an RTX
5080, twice, and both runs died with `0xc0000005` writing `0x0` within
seconds. That is the answer the switch deserved: the title's argument
records contain bounds the pass is what enforces, so "read them directly"
is not a fast path, it is a crash with a longer name.

So `0` no longer means "bypass". `clamp_setting` returns `(clamp on, say
so)` and the clamp is on whatever is asked; a run that asked is told once,
with the reason and with what actually answers its complaint. `clamp_is_on`
is consulted where the clamp is first made, so the refusal is spoken even
in a run that never reaches the pass.

That leaves no path for the bypass, so the code is gone rather than
unreachable: the `if !clamped` branch in `draw.rs` and the two `if clamped`
teardowns go with it, and so does `wait_direct`, which existed only to put
a barrier in front of an unclamped execute. Dead code behind a switch that
is now always true is a lie about what the program can do.

The cost the switch was chasing is real -- about five thousand one-record
indirect mesh draws a frame, and SM issue at 4% in `dkdknight`'s Nsight
capture -- and the answer to it is hoisting the clamps out of the
per-record path (`VICTORY_HOIST_CLAMPS`, Phase I), which keeps the bounds
check and stops paying for it once per record.

Probe: `clamp_setting` returns `parse_clamp_enabled(asked)` again -> the new
test fails with `left: (false, true), right: (true, true)` -> restored
byte-identical (sha256 ade38ee886e354e5).

cargo test -p victory-gpu --lib: 161 passed, 1 failed -- the failure is
`warp_budget_saturates...`, the pre-existing flake (fxceless#847/fxceless#849), on a test
this commit does not touch. cargo clippy -p victory-gpu --lib -D warnings:
only the two pre-existing fxceless#841 errors remain.
HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
The switch this branch added turned the clamp pass off so `ExecuteIndirect`
could read the title's own argument buffer. `dkdknight` ran it on an RTX
5080, twice, and both runs died with `0xc0000005` writing `0x0` within
seconds. That is the answer the switch deserved: the title's argument
records contain bounds the pass is what enforces, so "read them directly"
is not a fast path, it is a crash with a longer name.

So `0` no longer means "bypass". `clamp_setting` returns `(clamp on, say
so)` and the clamp is on whatever is asked; a run that asked is told once,
with the reason and with what actually answers its complaint. `clamp_is_on`
is consulted where the clamp is first made, so the refusal is spoken even
in a run that never reaches the pass.

That leaves no path for the bypass, so the code is gone rather than
unreachable: the `if !clamped` branch in `draw.rs` and the two `if clamped`
teardowns go with it, and so does `wait_direct`, which existed only to put
a barrier in front of an unclamped execute. Dead code behind a switch that
is now always true is a lie about what the program can do.

The cost the switch was chasing is real -- about five thousand one-record
indirect mesh draws a frame, and SM issue at 4% in `dkdknight`'s Nsight
capture -- and the answer to it is hoisting the clamps out of the
per-record path (`VICTORY_HOIST_CLAMPS`, Phase I), which keeps the bounds
check and stops paying for it once per record.

Probe: `clamp_setting` returns `parse_clamp_enabled(asked)` again -> the new
test fails with `left: (false, true), right: (true, true)` -> restored
byte-identical (sha256 ade38ee886e354e5).

cargo test -p victory-gpu --lib: 161 passed, 1 failed -- the failure is
`warp_budget_saturates...`, the pre-existing flake (fxceless#847/fxceless#849), on a test
this commit does not touch. cargo clippy -p victory-gpu --lib -D warnings:
only the two pre-existing fxceless#841 errors remain.
akus-elinius pushed a commit to akus-elinius/victory-fork that referenced this pull request Nov 25, 2026
…features (3 lints) (fxceless#841)


PR: fxceless#841
Head: b6b21a2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
akus-elinius pushed a commit to akus-elinius/victory-fork that referenced this pull request Nov 25, 2026
…structure builder has pipelines, xmem maps page runs as one view (fxceless#823)


PR: fxceless#823
Head: aaf658a

Conflict with fxceless#841 (the same three clippy warnings in indirect.rs and resource.rs): fxceless#841's form is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 26, 2026
…n more places

empty, 0, false, no and off are off. That fixed eight call sites and left the
class open. Nineteen reads had the shape, not eight, and
`std::env::var_os(..).is_some()` asks "was this set", which is not the
question any of them asks.

What was still wrong, and what it cost:

- `victory-shader` read `VICTORY_SHADER_CENSUS`, `VICTORY_WAVE_WHY`,
  `VICTORY_DESC_WHY`, `VICTORY_MESH_OUTPUT_STRICT` and `VICTORY_STRICT_JOINS`
  that way: setting any of them to 0 turned it on.
- `crates/victory-shader/src/emit/host.rs` read `VICTORY_D3D12_DEBUG` the old
  way -- the same variable fxceless#166 fixed in the GPU crate. Two readers of one
  switch disagreeing: `VICTORY_D3D12_DEBUG=0` turned the debug layer off on
  the device and left it on in the shader emitter, and the debug layer costs
  hundreds of milliseconds a frame.
- `victory-hle` read `VICTORY_AUDIO_CAPTURE` that way.

The shader crate deliberately does not depend on `victory-gpu`, so it carries
its own twelve-line parser in `victory_shader::env` with the same rule, and a
test that pins the two to the same answers. `victory-hle` already depends on
`victory-gpu`, so it uses `victory_gpu::env_flag` rather than growing a third
copy.

The parser test fxceless#166 shipped could not have caught any of this: it exercises
`parse_env_flag` and says nothing about whether a call site uses it -- a guard
that inspects only itself. So `xtask` now refuses the shape anywhere in the
tree, by name or by file: `var_os(..)` immediately tested with `.is_some()`.
It scans text rather than a regex so that spaces between the call and the test
cannot slip past, and it is fed the shape it hunts, with and without spaces,
plus three reads that must keep passing.

Probe: put `victory-hle`'s audio switch back to the old form -> the scan fails
naming `crates/victory-hle/src/modules/audio/capture.rs:69 VICTORY_AUDIO_CAPTURE`
-> restored byte-identical (sha256 ac03fb3a960689ad).

cargo test -p victory-gpu --lib: 145 passed, 0 failed, 3 ignored.
cargo test -p victory-shader --lib: 217 passed, 0 failed, 3 ignored.
cargo test -p xtask: 6 passed.
Clippy on victory-shader and xtask: clean. victory-hle cannot be reached past
victory-gpu's two pre-existing errors (fxceless#841).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants