gpu(native): log a reason for every dropped draw, and count the skipped ones (#531) #621

Open
AnastasisKon wants to merge 1 commit from upstream-pr/621 into main
AnastasisKon commented 2026-11-28 15:42:35 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:42:35Z.


Refs #531 — the "make the host log a reason for every draw it drops" item. Claimed on the issue.

What this changes

crates/victory-gpu/src/native/glue.rs only, 26 insertions:

  • make_pipe: when native_stages(key) is None the pipeline was previously refused with no log at all — likely the three reflection/post-pass draws e2945217, 456f02b5, a1f08b8b from #531. It now calls refused_translation, which warns once per pipeline key and counts the refusal by reason in the shader stats.
  • make_host_pipe: the two remaining silent Pipe::Refused returns — a compute pipeline whose stages hold no compute shader, and a guessed graphics pipeline without a vertex stage — now also go through refused_translation with a specific reason.
  • graphics_inner's Pipe::Skipped arm called warn_once directly, so those draws were never counted in no_pipeline ("native draws so far"). It now calls dropped(...), which warns once, increments the counter, and keeps the reason for the pass trace.
  • New test a_dropped_draw_is_counted_every_time_and_warned_once pins that dropped() counts every drop.

The put-off path (frame pipeline budget spent) already logs a counter line plus the generic draw-level reason, so it is unchanged. The rectangle stage-in and v_cvt_f32_f64 parts of #531 stay separate.

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-gpu --lib -- a_dropped_draw — passes (native mod is x86_64-only, runs under Rosetta)
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask (host arm64) — green
  • cargo test --target x86_64-apple-darwin -p victory-gpu — green except 2–3 pre-existing Metal GPU tests in native/tests.rs that flake under parallel Rosetta on this M1 right now; the identical set fails on a clean upstream/main checkout at the same moment and each passes in isolation (issue #548 class)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — clean
  • cargo xtask policy — 404 files ok
  • Not game-dependent; no game run needed for this change

Checklist

  • One change, one PR; branch vibe/drop-reason-log-1705ac from upstream/main, pushed to my fork only
  • No game/GDK files, no dumps/logs in the repo
  • No new VICTORY_* switches; existing warn/refusal paths only
  • No AI attribution in the diff

Note: the fork's main already carries 7fa3a417 (warn_drop_pipe, which names the dropped pipeline at each drop path). This PR is complementary, not duplicative: it gives the silent Pipe::Refused returns a refused_translation reason where no warning fired at all, and makes the Pipe::Skipped draw arm count in no_pipeline.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5541858790 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/621). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:42:35Z. --- Refs #531 — the "make the host log a reason for every draw it drops" item. Claimed on the issue. ## What this changes `crates/victory-gpu/src/native/glue.rs` only, 26 insertions: - `make_pipe`: when `native_stages(key)` is `None` the pipeline was previously refused with no log at all — likely the three reflection/post-pass draws `e2945217`, `456f02b5`, `a1f08b8b` from #531. It now calls `refused_translation`, which warns once per pipeline key and counts the refusal by reason in the shader stats. - `make_host_pipe`: the two remaining silent `Pipe::Refused` returns — a compute pipeline whose stages hold no compute shader, and a guessed graphics pipeline without a vertex stage — now also go through `refused_translation` with a specific reason. - `graphics_inner`'s `Pipe::Skipped` arm called `warn_once` directly, so those draws were never counted in `no_pipeline` ("native draws so far"). It now calls `dropped(...)`, which warns once, increments the counter, and keeps the reason for the pass trace. - New test `a_dropped_draw_is_counted_every_time_and_warned_once` pins that `dropped()` counts every drop. The put-off path (frame pipeline budget spent) already logs a counter line plus the generic draw-level reason, so it is unchanged. The rectangle stage-in and `v_cvt_f32_f64` parts of #531 stay separate. ## How it was tested - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu --lib -- a_dropped_draw` — passes (native mod is x86_64-only, runs under Rosetta) - [x] `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` (host arm64) — green - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu` — green except 2–3 pre-existing Metal GPU tests in `native/tests.rs` that flake under parallel Rosetta on this M1 right now; the identical set fails on a clean `upstream/main` checkout at the same moment and each passes in isolation (issue #548 class) - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — clean - [x] `cargo xtask policy` — 404 files ok - [x] Not game-dependent; no game run needed for this change ## Checklist - [x] One change, one PR; branch `vibe/drop-reason-log-1705ac` from `upstream/main`, pushed to my fork only - [x] No game/GDK files, no dumps/logs in the repo - [x] No new `VICTORY_*` switches; existing warn/refusal paths only - [x] No AI attribution in the diff Note: the fork's `main` already carries 7fa3a417 (`warn_drop_pipe`, which names the dropped pipeline at each drop path). This PR is complementary, not duplicative: it gives the *silent* `Pipe::Refused` returns a `refused_translation` reason where no warning fired at all, and makes the `Pipe::Skipped` draw arm count in `no_pipeline`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/621:upstream-pr/621'
git switch 'upstream-pr/621'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/621'
git switch 'upstream-pr/621'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/621'
git switch 'upstream-pr/621'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/621'
git switch 'main'
git merge --squash 'upstream-pr/621'
git switch 'main'
git merge --ff-only 'upstream-pr/621'
git switch 'main'
git merge 'upstream-pr/621'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS!621
No description provided.