feat(vk): GPU- and settings-independent pipeline state list (HKSTATE2) #2046
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2046
Loading…
Reference in a new issue
No description provided.
Delete branch "pipeline-states-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A pipeline state list only helps a player whose GPU and settings make the same pipelines as the PC that recorded it. Version 1 records store that PC's own Vulkan choices: the formats it rendered in, and on a GPU with the mesh fallback, the fallback's topology and stage numbering. So a list recorded on one GPU or at one setting misses on others, and on a GPU without mesh shaders every mesh record was skipped.
What changes
Version 2 records (
HKSTATE2, 552 bytes) store what the game asked for:answers_portable,portable_variant).At prepare time each record goes through the same functions the draw uses, so there is one mapping, not two:
attachment_format(built fromimage_format_ofandview_format_of, whichtexture_get'screateandtexture_viewnow call);color_types_of, pulled out ofdraw();pipeline_topology, also used bydraw()and by the predictor's builds;answers_hereinrecord_answers.Mesh records are now prepared on GPUs that use the mesh fallback too.
Version 1 lists still work:
hookshot_pipeline_states_v1.binand still prepared; new records go to a v2 list.nx2/pipeline_states.pyreads both. As soon as any source is v2, merge, check and add convert v1 records to v2 (--v2converts a v1 list on its own).V1_NVN, checked againstvk_formats.cpp,nvn_api.hand the Vulkan headers) and renumbers v1 mesh records made with the fallback.assets/pipeline_states/convert, none lost.Results
RTX 3090, cold caches (another stamp, no compute list, no driver pipeline cache, empty NVIDIA shader cache, then
--prepare-shaders), a save loaded into Hyrule Field. The number is the total ofdraws left out (not ready)from the menus into field play.RX_VK_FORCE_MESH_FALLBACK=1)The 12–24 left over are the same one or two programs every time. The recording run never drew them, so they aren't in the list at all; it's a coverage gap, not the mapping.
The prepare's state-list step takes under a second. Total prepare time with a list is about the same as without one.
Not proven yet
hdr=2): the headless test reported SDR to the game, so the game's own HDR path never ran. It needs a run on an HDR display.With #2040
#2040 (sources split into the tour's list and contributed files) is already in main, and this PR is built on it.
Follow-up I can open: convert each committed source to v2 in place (
nx2/pipeline_states.py --v2, notes kept) and updatetest_pipeline_state_sources.py's pre-split hash, which is computed over the v1 bytes. After that the tour and contributors write v2 directly.Tests
tests/test_pipeline_state_portable.pycompiles the real mapping code against two made-up GPUs: one samples ASTC and has mesh shaders, the other decodes ASTC and uses the mesh fallback.test_pipeline_states.pyandtest_pipeline_state_sources.pycover the v2 layout, conversion and mixed-version merge, add and check.The HKSTATE2 Windows source fixture still fails to compile with the MSVC/UCRT headers. The same
fopendeprecation promoted to an error appears in this PR's Windows run and the #2060 Windows run. #2060 changes only the Python setup parser and its fixture. Other source fixtures already use the project's Windows CRT define when compiling production C/C++ slices.github-sync referenced this pull request2026-11-12 06:22:54 +00:00