fix(vk): report native shader keys in draw statistics #2896

Open
github-sync wants to merge 1 commit from github/pr/2896 into main
Owner

@klimovich008 opened this pull request on GitHub · 2026-11-12 18:55 UTC · original

What this fixes

Draw statistics report a combined program key, making suspicious draws hard to match to native shaders. Cached programs may have no translation log with those keys.

Why merge

  • Snapshots four keys per accepted query; retains no program pointer and keeps distinct tuples separate.
  • Preserves count rows, GPU commands, cache formats and defaults; adds 1 MiB of query metadata.

Change

  • gpu/vk/vk_draw.cpp: snapshot stage keys and append counted code rows after successful readback.
  • tests/test_draw_stats_codes.py: exercise the real producer and formatter with synthetic inputs.
  • docs/development.md: explain the trigger and key slots.
  • docs/tested-configurations.md: record the earlier-API AMD run.

Tested

  • python -I -B tests/test_draw_stats_codes.py --cxx clang++: identities, grouping, lifetime and capacity; GCC passes too. Fails on the old code, passes now. Omitting the copy or changing the header slot fails executable assertions.
  • python -I -B tests/run_all.py --jobs 4 --timeout 120: 487 passed, 1 failed, 37 skipped. The NUP path check also fails on unchanged main without Windows symlink privileges. Renderer-only build links.
  • RX 9070 XT, Windows, Hyrule Field, 84 seconds: 2,920 queries and 442 key groups; both tables' totals match. Same patch on the earlier API19 base. No game data is included.

Not covered

  • API21 game integration and full validation untested; the earlier validation startup hit the memory guard.
  • Linux, NVIDIA and Intel untested.
> [@klimovich008](https://github.com/klimovich008) opened this pull request on GitHub · 2026-11-12 18:55 UTC · [original](https://github.com/NotRexed/Hookshot/pull/2896) ## What this fixes Draw statistics report a combined program key, making suspicious draws hard to match to native shaders. Cached programs may have no translation log with those keys. ## Why merge - Snapshots four keys per accepted query; retains no program pointer and keeps distinct tuples separate. - Preserves count rows, GPU commands, cache formats and defaults; adds 1 MiB of query metadata. ## Change - `gpu/vk/vk_draw.cpp`: snapshot stage keys and append counted `code` rows after successful readback. - `tests/test_draw_stats_codes.py`: exercise the real producer and formatter with synthetic inputs. - `docs/development.md`: explain the trigger and key slots. - `docs/tested-configurations.md`: record the earlier-API AMD run. ## Tested - `python -I -B tests/test_draw_stats_codes.py --cxx clang++`: identities, grouping, lifetime and capacity; GCC passes too. Fails on the old code, passes now. Omitting the copy or changing the header slot fails executable assertions. - `python -I -B tests/run_all.py --jobs 4 --timeout 120`: 487 passed, 1 failed, 37 skipped. The NUP path check also fails on unchanged main without Windows symlink privileges. Renderer-only build links. - RX 9070 XT, Windows, Hyrule Field, 84 seconds: 2,920 queries and 442 key groups; both tables' totals match. Same patch on the earlier API19 base. No game data is included. ## Not covered - API21 game integration and full validation untested; the earlier validation startup hit the memory guard. - Linux, NVIDIA and Intel untested. <!-- github-sync:item:2896 -->
Cached programs skip the translation-miss log, so draw statistics alone cannot
match a combined program key to its native stages. Copy the existing stage keys
into each accepted query record and print a separate table, retaining distinct
tuples and the original count rows.

The game-free fixture exercises the real query producer and report, including
graphics, mesh and compute inputs, lifetime, capacity and inactive recording.

Assisted-by: OpenAI Codex
Assisted-by: GPT-6.1 Sol
Co-Authored-By: OpenAI Codex <[email protected]>
Co-Authored-By: GPT-6.1 Sol <[email protected]>
Commenting is not possible because the repository is archived.
No description provided.