WIP: fix(vk): a samples-passed run with no draw reads 0, not 4096 for good (RX_VK_OCC_EMPTY) #2289

Closed
TrashPanda wants to merge 3 commits from TrashPanda/Longshot:fix/occ-empty-run into main
Member

Summary

With real occlusion queries on (RX_VK_OCC_QUERIES, on wherever the device can reset queries from the CPU), the game
resets its samples-passed counter, draws an object's bounding box and reports the count. The replay writes 4096
("visible") into the report at once and the GPU's count over it once the draw's queries are done. A run in which no draw
took a query (no draw at all between the reset and the report, or only draws that render nothing: turned off by a render
condition, or rasterizer discard) never got a count, so its report stayed 4096 for good, where the console's counter reads
0: nothing passed.

It is not rare. The log line this adds counts such runs: about 83 a frame in Kokiri Forest and in Hyrule Field, about 500
a frame in the Market (RTX 4070 Ti; the line is written at the 1st, 10th, 100th ... run, read against the present count).

The report now writes 0 for such a run (RX_VK_OCC_EMPTY, a kill switch, on). A run with a query taken (its count comes
from the GPU), a run whose count is not known (a colour draw, or too many draws: overflow), a report with no run open,
other counters and the clear flags the CPU writes itself are as before.

The first commit also logs, once per program and value, fixed function the replay leaves out (a blend factor reading the
target's alpha on an NVN format without alpha, dual-source blend factors, an alpha test, a logic op other than COPY) and
nvnCommandBufferSetPointSize with a size other than 1. None of these fired in Kokiri Forest, Hyrule Field or the Market,
on an RTX 4070 Ti or an AMD iGPU (no X-format target appears at all), so no fix follows for them.

Read first: NOP_REPORT_COUNTER in gpu/vk/vk_replay.cpp; tests/test_occ_empty_run.py.

Testing

Tested: Linux 7.0, RTX 4070 Ti (NVIDIA 595.99.02) and the AMD Ryzen 7 9800X3D's iGPU (RADV, Mesa 26.0.8):

  • tests/test_occ_empty_run.py (new) cuts the real report case and occ_close out of vk_replay.cpp: before the fix it
    fails for the bug's reason ("a counted run with no draw: the count word reads 4096, expected 0"); with it, it passes with
    the switch unset, =1 and =0 (4096 as before), and its two broken copies fail;
  • tests/test_vk_occlusion_queries.py passes unchanged; the whole suite: no check fails here only (the 22 failures fail
    on main too, as listed in #2290);
  • in the game, Kokiri Forest, Hyrule Field and the Market, main against this branch, 30 s after arrival with
    RX_VK_OCC_LOG=1: the same objects on screen at each spot (only Navi and fireflies moved), draws a frame 468 / 768 /
    1637 on main and 472 / 769 / 1623 here; the reports that read 0 stay at 54-56 % on both sides; logdiff of the problem
    lines: nothing new;
  • the empty-run line in every run of this branch on both GPUs (forest, field, market), on neither side the other lines.

Still to test:

  • a scene where objects pop in and out behind walls (a dungeon, Kakariko at night), main against this PR, expecting no
    object missing for a frame or more (by hand, or @Beanstalk with shots)
  • Windows (NVIDIA, AMD, Intel Arc with RX_VK_OCC_COPY): the same three scenes (@Beanstalk)

Measurements

Verdict: the bug is gone: runs with no draw now read 0 (about 83 a frame in Kokiri Forest and Hyrule Field, about 500 in
the Market) instead of 4096; the game draws the same (draws a frame within 1 %), so no speed change is claimed.

Setup: Linux 7.0, RTX 4070 Ti, 2560x1440, the runtime's options; tools' gamerun.py (shared mode: a correctness run, not a
timing one), the kokiri-start save, the Debug tab's teleport, 30 s.

Before: main @ a2dc5385 After: perf/game-barrier-flags @ ce5266d2
reports of counted runs with no draw 4096, for good 0
draws a frame, Kokiri Forest / Hyrule Field / Market 468 / 768 / 1637 472 / 769 / 1623
occlusion reports read 0 56.1 / 53.8 / 54.0 % 56.4 / 53.7 / 56.1 %
tests/test_occ_empty_run.py fails: reads 4096, expected 0 passes
vk: a samples-passed report closed a counted run with no draw (100000 so far): it reads 0, as the console's count
vk: occlusion queries: 5172 reports written (2901 of them 0, 56.1%), 0 left visible (a draw did not draw), ...

Risks

An object whose bounding-box draws the replay leaves out for a reason the console would not would now read occluded and be
left out by the game. None is known: every draw op takes its query before it is recorded (tests/test_vk_occlusion_queries.py),
and a draw that renders nothing renders nothing on the console either. RX_VK_OCC_EMPTY=0 restores 4096; nothing changes on
disk.

Found while checking fixed-function behaviour against Rekarina's notes (another PC port of this game); the fix is our own.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (the fixed-function log lines ride along as the commit
    that found this; split them off if review asks)
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux built; the host change is one logging
    function in nvn_native.c using its existing Interlocked helpers: Windows not built here)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary With real occlusion queries on (`RX_VK_OCC_QUERIES`, on wherever the device can reset queries from the CPU), the game resets its samples-passed counter, draws an object's bounding box and reports the count. The replay writes 4096 ("visible") into the report at once and the GPU's count over it once the draw's queries are done. A run in which no draw took a query (no draw at all between the reset and the report, or only draws that render nothing: turned off by a render condition, or rasterizer discard) never got a count, so its report stayed 4096 for good, where the console's counter reads 0: nothing passed. It is not rare. The log line this adds counts such runs: about 83 a frame in Kokiri Forest and in Hyrule Field, about 500 a frame in the Market (RTX 4070 Ti; the line is written at the 1st, 10th, 100th ... run, read against the present count). The report now writes 0 for such a run (`RX_VK_OCC_EMPTY`, a kill switch, on). A run with a query taken (its count comes from the GPU), a run whose count is not known (a colour draw, or too many draws: overflow), a report with no run open, other counters and the clear flags the CPU writes itself are as before. The first commit also logs, once per program and value, fixed function the replay leaves out (a blend factor reading the target's alpha on an NVN format without alpha, dual-source blend factors, an alpha test, a logic op other than COPY) and `nvnCommandBufferSetPointSize` with a size other than 1. None of these fired in Kokiri Forest, Hyrule Field or the Market, on an RTX 4070 Ti or an AMD iGPU (no X-format target appears at all), so no fix follows for them. Read first: `NOP_REPORT_COUNTER` in `gpu/vk/vk_replay.cpp`; `tests/test_occ_empty_run.py`. ## Testing **Tested:** Linux 7.0, RTX 4070 Ti (NVIDIA 595.99.02) and the AMD Ryzen 7 9800X3D's iGPU (RADV, Mesa 26.0.8): - `tests/test_occ_empty_run.py` (new) cuts the real report case and `occ_close` out of `vk_replay.cpp`: before the fix it fails for the bug's reason ("a counted run with no draw: the count word reads 4096, expected 0"); with it, it passes with the switch unset, `=1` and `=0` (4096 as before), and its two broken copies fail; - `tests/test_vk_occlusion_queries.py` passes unchanged; the whole suite: no check fails here only (the 22 failures fail on `main` too, as listed in #2290); - in the game, Kokiri Forest, Hyrule Field and the Market, `main` against this branch, 30 s after arrival with `RX_VK_OCC_LOG=1`: the same objects on screen at each spot (only Navi and fireflies moved), draws a frame 468 / 768 / 1637 on `main` and 472 / 769 / 1623 here; the reports that read 0 stay at 54-56 % on both sides; `logdiff` of the problem lines: nothing new; - the empty-run line in every run of this branch on both GPUs (forest, field, market), on neither side the other lines. **Still to test:** - a scene where objects pop in and out behind walls (a dungeon, Kakariko at night), `main` against this PR, expecting no object missing for a frame or more (by hand, or @Beanstalk with shots) - Windows (NVIDIA, AMD, Intel Arc with `RX_VK_OCC_COPY`): the same three scenes (@Beanstalk) ## Measurements **Verdict:** the bug is gone: runs with no draw now read 0 (about 83 a frame in Kokiri Forest and Hyrule Field, about 500 in the Market) instead of 4096; the game draws the same (draws a frame within 1 %), so no speed change is claimed. Setup: Linux 7.0, RTX 4070 Ti, 2560x1440, the runtime's options; tools' `gamerun.py` (shared mode: a correctness run, not a timing one), the kokiri-start save, the Debug tab's teleport, 30 s. | | Before: main @ a2dc5385 | After: perf/game-barrier-flags @ ce5266d2 | |---|---|---| | reports of counted runs with no draw | 4096, for good | 0 | | draws a frame, Kokiri Forest / Hyrule Field / Market | 468 / 768 / 1637 | 472 / 769 / 1623 | | occlusion reports read 0 | 56.1 / 53.8 / 54.0 % | 56.4 / 53.7 / 56.1 % | | `tests/test_occ_empty_run.py` | fails: reads 4096, expected 0 | passes | ``` vk: a samples-passed report closed a counted run with no draw (100000 so far): it reads 0, as the console's count vk: occlusion queries: 5172 reports written (2901 of them 0, 56.1%), 0 left visible (a draw did not draw), ... ``` ## Risks An object whose bounding-box draws the replay leaves out for a reason the console would not would now read occluded and be left out by the game. None is known: every draw op takes its query before it is recorded (`tests/test_vk_occlusion_queries.py`), and a draw that renders nothing renders nothing on the console either. `RX_VK_OCC_EMPTY=0` restores 4096; nothing changes on disk. Found while checking fixed-function behaviour against Rekarina's notes (another PC port of this game); the fix is our own. ## Checklist ### Ready for review - [ ] One topic, on current `main`; the title is a Conventional Commit. (the fixed-function log lines ride along as the commit that found this; split them off if review asks) - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux built; the host change is one logging function in nvn_native.c using its existing Interlocked helpers: Windows not built here) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
No behaviour change. Per draw (once per program and value, the first 20 of each kind, and the
draws every 120 presents where any came): a blend factor that reads the destination's alpha on
an NVN format without alpha whose Vulkan image keeps one (X formats, BGR5, RGB5), dual-source
blend factors, an alpha test other than ALWAYS, a logic op other than COPY. A samples-passed
report that closes a counted run with no draw (it reads 4096 where the console counts 0), and
nvnCommandBufferSetPointSize with a size other than 1, each logged at the 1st, 10th, 100th ...

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 98109a39ee860398903f30ffcb7405b5d4721b9d)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b3b956eaf911a2258387586b06d738525b1613af)
fix(vk): a samples-passed run with no draw reads 0, not 4096 for good (RX_VK_OCC_EMPTY)
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
b85cf3aabc
With real occlusion queries, a report that closes a counted run in which no draw took a query
(no draw, or only draws that render nothing) never got a count: its slot kept the 4096 written at
the report, "visible", where the console's counter reads 0. Such runs come tens of times a frame in
OoT (hundreds in the Market). It now writes 0 at the report. RX_VK_OCC_EMPTY=0: 4096, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit ce5266d2cb6da8905eac439971ca436673034781)
Author
Member

Tested in game: Linux 7.0, RTX 4070 Ti (NVIDIA 595.99.02): Kokiri Forest, Hyrule Field and the Market, main vs the fix, screenshots 30 s after arrival show the same objects (only Navi and fireflies moved), draws a frame within spread, no new problem log lines; the empty-run counter fired about 83 a frame (Kokiri, Field) and 500 (Market). Runs made on the original branch at main a2dc5385; this head is the same commits cherry-picked onto current main, compiled, its checks pass, not yet run in the game.

Tested in game: Linux 7.0, RTX 4070 Ti (NVIDIA 595.99.02): Kokiri Forest, Hyrule Field and the Market, main vs the fix, screenshots 30 s after arrival show the same objects (only Navi and fireflies moved), draws a frame within spread, no new problem log lines; the empty-run counter fired about 83 a frame (Kokiri, Field) and 500 (Market). Runs made on the original branch at main a2dc5385; this head is the same commits cherry-picked onto current main, compiled, its checks pass, not yet run in the game.
Member

Possibly related, for context:

  • PR #260 fix(vk): occlusion counts stay visible unless known: one query numbering across queues, no count from a draw that didn't run — Earlier merged occlusion-query correctness work; this PR addresses the empty-run case it left visible.
Possibly related, for context: - PR #260 fix(vk): occlusion counts stay visible unless known: one query numbering across queues, no count from a draw that didn't run — Earlier merged occlusion-query correctness work; this PR addresses the empty-run case it left visible.
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The change mixes an unrelated fixed-function census into the occlusion fix, and the new point-size logger has a data race. The fix also changes the existing occlusion dry-run mode and still needs visibility and performance checks on the systems it can affect.

Empty counted occlusion runs now report zero instead of staying visible at 4096. The game-free test exercises that result, but the added diagnostic census adds work to every recorded draw and belongs in a separate change.

Blocking (1): must change before merging.

  1. L1 gpu/vk/vk_draw.cpp:9401: The fixed-function census is unrelated to the empty-occlusion fix and adds work to every recorded draw, contrary to the repository's one-topic rule. (more on the line) Do: Move the fixed-function and point-size diagnostics to a separate pull request, including their helpers and reporting call.

Should fix (2): not blocking, but worth doing before merging.

  • L2 host/nvn_native.c:2376: The point-size logger reads and writes tell_at without synchronization between guest threads; volatile does not make those accesses atomic. (more on the line) Do: Remove this unrelated logger with the census, or protect the threshold with atomic operations or a lock and bound its multiplication.
  • L3 gpu/vk/vk_replay.cpp:1844: Empty runs now write zero even when RX_VK_OCC_DRY requests that reports remain at 4096. (more on the line) Do: Honor RX_VK_OCC_DRY when choosing the initial empty-run value and add a test for that combination.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4 gpu/vk/vk_replay.cpp:1844: The new zero result can hide objects if a run is classified empty when the console would count samples; the reported scenes do not cover the wall-occlusion case. (more on the line) Do: Compare base and this head in a wall-occlusion scene, and run the affected Windows and Tier 1 GPU paths, including Steam Deck and the query-copy path.
  • L5 gpu/vk/vk_draw.cpp:9401: The per-draw census has no frame-time or FPS comparison; draw counts do not measure its cost. (more on the line) Do: Measure interleaved base and head runs in a heavy scene, including average FPS, 1% lows and frame times, on affected systems. (@fix does its part first: Remove the unrelated census from this pull request.)

@fix can do L1, L2, L3 and L5.

Checks: Still running: 9 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the isolated bug: the reported game-free test reads 4096 on the base and 0 with the fix. The reported game runs found the same objects in three outdoor scenes, but did not exercise the requested wall-occlusion scene or this exact head.

Other systems: The report path also serves asynchronous replay, query-copy mode and dry-run diagnostics. The author reports Linux runs on NVIDIA and an AMD iGPU; Windows, Intel Arc, Steam Deck and a wall-occlusion scene remain untested. The census runs on every recorded draw on all platforms.

Switches: RX_VK_OCC_EMPTY is added as an on-by-default kill switch and has a switches.def row; setting it to 0 restores the old empty-run result. Its default still needs the requested visibility checks across affected systems. RX_VK_OCC_DRY retains its documented default of off, but its enabled behavior changes for empty runs.

Reviewed: b85cf3aabc against 67ba729d21: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff and commit messages, and the changed test in full. Read the changed code and surrounding occlusion, draw and logging paths; skimmed the switch table and test runner. docs/review-checklist.md and the adjacent Tooling checkout were absent. The large changed renderer and host files were not read in full; no generated files or translations changed.; nothing run (a code review).

Checked and fine:

  • The empty-run check excludes overflowed runs and runs with queries.
  • The new test covers the default and both values of RX_VK_OCC_EMPTY and includes broken variants.
  • The switch has a table entry and the commits record AI assistance.
  • No game-derived files, generated files, shader headers or renderer API changes appear in the diff.

Testing: No code or tests were run, as requested. The author reports the new game-free test passing and Linux game comparisons on NVIDIA and AMD; CI is still running.

Overlaps and merge order: Not checked; network access is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The change mixes an unrelated fixed-function census into the occlusion fix, and the new point-size logger has a data race. The fix also changes the existing occlusion dry-run mode and still needs visibility and performance checks on the systems it can affect. Empty counted occlusion runs now report zero instead of staying visible at 4096. The game-free test exercises that result, but the added diagnostic census adds work to every recorded draw and belongs in a separate change. **Blocking (1)**: must change before merging. 1. **L1** `gpu/vk/vk_draw.cpp:9401`: The fixed-function census is unrelated to the empty-occlusion fix and adds work to every recorded draw, contrary to the repository's one-topic rule. (more on the line) **Do:** Move the fixed-function and point-size diagnostics to a separate pull request, including their helpers and reporting call. **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `host/nvn_native.c:2376`: The point-size logger reads and writes tell_at without synchronization between guest threads; volatile does not make those accesses atomic. (more on the line) **Do:** Remove this unrelated logger with the census, or protect the threshold with atomic operations or a lock and bound its multiplication. - **L3** `gpu/vk/vk_replay.cpp:1844`: Empty runs now write zero even when RX_VK_OCC_DRY requests that reports remain at 4096. (more on the line) **Do:** Honor RX_VK_OCC_DRY when choosing the initial empty-run value and add a test for that combination. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4** `gpu/vk/vk_replay.cpp:1844`: The new zero result can hide objects if a run is classified empty when the console would count samples; the reported scenes do not cover the wall-occlusion case. (more on the line) **Do:** Compare base and this head in a wall-occlusion scene, and run the affected Windows and Tier 1 GPU paths, including Steam Deck and the query-copy path. - **L5** `gpu/vk/vk_draw.cpp:9401`: The per-draw census has no frame-time or FPS comparison; draw counts do not measure its cost. (more on the line) **Do:** Measure interleaved base and head runs in a heavy scene, including average FPS, 1% lows and frame times, on affected systems. *(`@fix` does its part first: Remove the unrelated census from this pull request.)* `@fix` can do L1, L2, L3 and L5. **Checks:** Still running: 9 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the isolated bug: the reported game-free test reads 4096 on the base and 0 with the fix. The reported game runs found the same objects in three outdoor scenes, but did not exercise the requested wall-occlusion scene or this exact head. **Other systems:** The report path also serves asynchronous replay, query-copy mode and dry-run diagnostics. The author reports Linux runs on NVIDIA and an AMD iGPU; Windows, Intel Arc, Steam Deck and a wall-occlusion scene remain untested. The census runs on every recorded draw on all platforms. **Switches:** RX_VK_OCC_EMPTY is added as an on-by-default kill switch and has a switches.def row; setting it to 0 restores the old empty-run result. Its default still needs the requested visibility checks across affected systems. RX_VK_OCC_DRY retains its documented default of off, but its enabled behavior changes for empty runs. **Reviewed:** b85cf3aabc5b against 67ba729d215b: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff and commit messages, and the changed test in full. Read the changed code and surrounding occlusion, draw and logging paths; skimmed the switch table and test runner. docs/review-checklist.md and the adjacent Tooling checkout were absent. The large changed renderer and host files were not read in full; no generated files or translations changed.; nothing run (a code review). **Checked and fine:** - The empty-run check excludes overflowed runs and runs with queries. - The new test covers the default and both values of RX_VK_OCC_EMPTY and includes broken variants. - The switch has a table entry and the commits record AI assistance. - No game-derived files, generated files, shader headers or renderer API changes appear in the diff. **Testing:** No code or tests were run, as requested. The author reports the new game-free test passing and Linux game comparisons on NVIDIA and AMD; CI is still running. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -9342,6 +9398,7 @@ void draw(VkCommandBuffer cmd, NvnState& s, const DrawArgs& d) {
}
ps.sampled_targets |= samples;
ps.written |= writes;
ff_census(s, at, p); // (fixed function the replay does not carry out: logged)
Member

L1 (blocking): The fixed-function census is unrelated to the empty-occlusion fix and adds work to every recorded draw, contrary to the repository's one-topic rule.

When: Every normal draw now inspects fixed-function state, even when no empty occlusion run is involved; matching states can also take a mutex and update a set.

Do: Move the fixed-function and point-size diagnostics to a separate pull request, including their helpers and reporting call.

**L1** (blocking): The fixed-function census is unrelated to the empty-occlusion fix and adds work to every recorded draw, contrary to the repository's one-topic rule. *When:* Every normal draw now inspects fixed-function state, even when no empty occlusion run is involved; matching states can also take a mutex and update a set. **Do:** Move the fixed-function and point-size diagnostics to a separate pull request, including their helpers and reporting call.
Member

L5 (should fix): The per-draw census has no frame-time or FPS comparison; draw counts do not measure its cost.

When: CPU-limited scenes execute the added state checks for every draw, and matching states also increment atomics and acquire a mutex.

Do: Measure interleaved base and head runs in a heavy scene, including average FPS, 1% lows and frame times, on affected systems.

**L5** (should fix): The per-draw census has no frame-time or FPS comparison; draw counts do not measure its cost. *When:* CPU-limited scenes execute the added state checks for every draw, and matching states also increment atomics and acquire a mutex. **Do:** Measure interleaved base and head runs in a heavy scene, including average FPS, 1% lows and frame times, on affected systems.
@ -1830,3 +1842,3 @@
// frames in Kokiri, 4-6 with this, RX 7900 GRE). RX_VK_OCC_FIXED=<n>: that value; -1: the per-draw count as before
static const int64_t occ_fixed = getenv("RX_VK_OCC_FIXED") ? atoll(getenv("RX_VK_OCC_FIXED")) : 4096;
const uint64_t rec[2] = {samples ? (occ_fixed >= 0 ? (uint64_t)occ_fixed : s.samples_passed) : 0, ns * 12 / 625};
const uint64_t count = occ_empty_zero && empty_run ? 0 : occ_fixed >= 0 ? (uint64_t)occ_fixed : s.samples_passed;
Member

L3 (should fix): Empty runs now write zero even when RX_VK_OCC_DRY requests that reports remain at 4096.

When: With RX_VK_OCC_DRY=1 and the new switch at its default, an empty counted run immediately writes 0; the dry-mode guard in query collection cannot restore 4096 because this run has no pending query.

Do: Honor RX_VK_OCC_DRY when choosing the initial empty-run value and add a test for that combination.

**L3** (should fix): Empty runs now write zero even when RX_VK_OCC_DRY requests that reports remain at 4096. *When:* With RX_VK_OCC_DRY=1 and the new switch at its default, an empty counted run immediately writes 0; the dry-mode guard in query collection cannot restore 4096 because this run has no pending query. **Do:** Honor RX_VK_OCC_DRY when choosing the initial empty-run value and add a test for that combination.
Member

L4 (should fix): The new zero result can hide objects if a run is classified empty when the console would count samples; the reported scenes do not cover the wall-occlusion case.

When: An affected bounding-box run that takes no replay query now produces 0, so the game can omit the corresponding visible object instead of keeping it visible.

Do: Compare base and this head in a wall-occlusion scene, and run the affected Windows and Tier 1 GPU paths, including Steam Deck and the query-copy path.

**L4** (should fix): The new zero result can hide objects if a run is classified empty when the console would count samples; the reported scenes do not cover the wall-occlusion case. *When:* An affected bounding-box run that takes no replay query now produces 0, so the game can omit the corresponding visible object instead of keeping it visible. **Do:** Compare base and this head in a wall-occlusion scene, and run the affected Windows and Tier 1 GPU paths, including Steam Deck and the query-copy path.
@ -2373,0 +2373,4 @@
static volatile LONG n, tell_at = 1;
if (F(0) != 1.0f) {
const LONG k = InterlockedIncrement(&n);
if (k == tell_at) tell_at *= 10, hos_log("nvn: SetPointSize %g (%ld so far other than 1): points are one pixel", F(0), (long)k);
Member

L2 (should fix): The point-size logger reads and writes tell_at without synchronization between guest threads; volatile does not make those accesses atomic.

When: Two threads calling SetPointSize with a non-default size can access tell_at while one updates it, causing a C data race and undefined behavior.

Do: Remove this unrelated logger with the census, or protect the threshold with atomic operations or a lock and bound its multiplication.

**L2** (should fix): The point-size logger reads and writes tell_at without synchronization between guest threads; volatile does not make those accesses atomic. *When:* Two threads calling SetPointSize with a non-default size can access tell_at while one updates it, causing a C data race and undefined behavior. **Do:** Remove this unrelated logger with the census, or protect the threshold with atomic operations or a lock and bound its multiplication.
Member

Closing as stale: no update here for 12 days, and none from you on any Longshot pull request for 9 days, and it no longer merges cleanly with main. Nothing is lost: the branch stays, and you can reopen this, or open a new PR on current main, when you pick it up again.

🤖 Generated with Claude Code

Closing as stale: no update here for 12 days, and none from you on any Longshot pull request for 9 days, and it no longer merges cleanly with main. Nothing is lost: the branch stays, and you can reopen this, or open a new PR on current main, when you pick it up again. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
klimovich008 closed this pull request 2026-12-04 20:55:50 +00:00
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2289
No description provided.