Reuse prepared shaders across irrelevant integer-bit changes #906

Merged
klimovich008 merged 2 commits from codex/keep-prepared-answer-types into main 2026-11-09 08:47:09 +00:00
klimovich008 commented 2026-11-09 01:06:04 +00:00 (Migrated from github.com)

What this fixes

After shader preparation, first use of some depth-comparison and unsigned-storage shaders still triggers recompilation. Their prepared variants are rejected for a texture-format difference that cannot change those shader types.

Why merge

  • Ignore the integer bit only for correctly typed depth comparisons and explicit unsigned formats. Dimensions, signed formats and Typeless matching stay strict.
  • Keep handle/version tracking, descriptor invalidation, the cache format and hash-only readers unchanged.
  • Preserve strict matching in live-memory, capture-off and immediate-registration modes. No option defaults change.

Change

  • gpu/vk/vk_shader.cpp: use the same type normalization when recording and comparing answers, before computing new variant hashes.
  • tests/test_program_answer_domains.py: exercise actual structures and matcher functions, required misses, tracking entries and diagnostic modes.
  • tests/run_all.py: register the existing compiler and Vulkan-header bindings.

Tested

  • python -I -B tests/run_all.py --jobs 1 --strict program_answer_domains; checks matching, recorded hashes and preserved resource tracking.
  • Fails on the old code, passes now: 17 of 63 default assertions fail before; all pass now. Separate processes check the strict-mode fallbacks.
  • Windows/Ryzen 7 5700X3D: CPU fixture passes without loading Vulkan. Windows and Linux source-check CI pass.

Not covered

  • GPU and full-game verification remain pending. No measured stutter reduction is claimed.

No game data is included.

## What this fixes After shader preparation, first use of some depth-comparison and unsigned-storage shaders still triggers recompilation. Their prepared variants are rejected for a texture-format difference that cannot change those shader types. ## Why merge - Ignore the integer bit only for correctly typed depth comparisons and explicit unsigned formats. Dimensions, signed formats and Typeless matching stay strict. - Keep handle/version tracking, descriptor invalidation, the cache format and hash-only readers unchanged. - Preserve strict matching in live-memory, capture-off and immediate-registration modes. No option defaults change. ## Change - `gpu/vk/vk_shader.cpp`: use the same type normalization when recording and comparing answers, before computing new variant hashes. - `tests/test_program_answer_domains.py`: exercise actual structures and matcher functions, required misses, tracking entries and diagnostic modes. - `tests/run_all.py`: register the existing compiler and Vulkan-header bindings. ## Tested - `python -I -B tests/run_all.py --jobs 1 --strict program_answer_domains`; checks matching, recorded hashes and preserved resource tracking. - Fails on the old code, passes now: 17 of 63 default assertions fail before; all pass now. Separate processes check the strict-mode fallbacks. - Windows/Ryzen 7 5700X3D: CPU fixture passes without loading Vulkan. Windows and Linux source-check CI pass. ## Not covered - **GPU and full-game verification remain pending.** No measured stutter reduction is claimed. No game data is included.
Commenting is not possible because the repository is archived.
No description provided.