fix(vk): name the view's format in custom border colours of packed 16-bit textures #1232
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1232
Loading…
Reference in a new issue
No description provided.
Delete branch "jcabarca/Longshot:fix/vk-border-color-format"
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?
Type: fix · Risk: low · Tested on: Windows 11 IoT Enterprise LTSC 24H2 (build 26100.9711), AMD Ryzen 7 9700X (Zen 5: AVX-512, no AVX512-FP16), 16 GB RAM, AMD Radeon RX 9070 XT, AMD Software: Adrenalin Edition 26.10.1 · Needs: none
TL;DR
An RGB565 texture sampled with a custom border colour used a sampler that named no format, which Vulkan forbids for that format, so the colour past the texture edge was undefined. This PR gives those samplers the texture format. A new test fails on main and passes here.
Breakdown
Why
A texture in NVN RGB565 (
VK_FORMAT_B5G6R5_UNORM_PACK16) sampled with a custom border colour uses a sampler whose custom border colour names no format, which Vulkan forbids for that format (VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04015): the colour seen past the texture's edge is then undefined and can differ between drivers.How to reproduce
Seen on: not seen in the game: found by reading
sampler_make()ingpu/vk/vk_draw.cpp; it happens on any device with custom border colours (customBorderColorsandcustomBorderColorWithoutFormat) whenever the game samples an RGB565 texture with a sampler whose border colour is not transparent black, opaque black or opaque whiteSettings and switches: defaults
Steps: game-free:
python -I -B tests/test_sampler_admission.py --cxx clang++ --headers <Vulkan-Headers include>with--sourcepointing at a main checkout (the test from this PR); its newborder-formatcase asks for a sampler for a view of each of the four packed formats and checks the format its custom border colour namesExpected: the custom border colour names the view's format, and its colour is within what that UNORM format holds
Actual: on main the custom border colour names
VK_FORMAT_UNDEFINEDfor every view; the test fails 6 of 153 cases (border-formatandborder-format-in-rangeon each of their three routes)What changed
The sampler now knows the format of the view it samples. For the four packed 16-bit formats VUID 04015 names, its custom border colour names that format (and the colour is clamped to [0, 1], what a UNORM format holds); for every other format it stays
VK_FORMAT_UNDEFINED, as before.gpu/vk/vk_draw.cpp:border_format(VkFormat)(new): returns the view's format forB4G4R4A4_UNORM_PACK16,B5G6R5_UNORM_PACK16,A1B5G5R5_UNORM_PACK16_KHR(the alias named since Vulkan-Headers 1.3.246, so older distro headers build too) andB5G5R5A1_UNORM_PACK16, elseVK_FORMAT_UNDEFINED. Today onlyB5G6R5reaches it (NVN RGB565); the other three are listed because 04015 names them.sampler_make(id, compare, one_level, view_format)andsampler_for(id, compare, one_level, view_format)take the view's format.sampler_make()mixes the border format into its cache key, setsVkSamplerCustomBorderColorCreateInfoEXT::formatto it and clamps the colour when it is set;sampler_for()'s per-thread table keeps the border format in each entry, so a sampler made for one view format is not handed to a view of another.SamplerInfo(the sampler book's key) records the custom border colour's format (19 to 20 words, still without padding).texture_view_of()gains aformat_outargument;HandleHitkeeps the view's format, so a cached hit returns it too.build_descriptors()passes each texture's view format tosampler_for()(repeated table entries reuse it; dummy views passVK_FORMAT_UNDEFINED).tests/sampler_admission_test.cppandtests/test_sampler_admission.py: aborder-formatcase on the three routes (by id,sampler_make()directly, the cache off) with a colour past [0, 1], and aborder-format-in-rangecase with the colour {0.25, 0.5, 0.75, 1}, which every format holds, so only the format tells the samplers apart (it fails ifsampler_info()stops recordingborder_format); the fixture records the format each custom border colour names.The bug, step by step:
vk_formats.cppmapsNVN_FORMAT_RGB565toVK_FORMAT_B5G6R5_UNORM_PACK16, one of the four formats 04015 names (NVN_FORMAT_RGB5andRGB5A1map toA1R5G5B5_UNORM_PACK16, which it does not name).vk_main.cppturns custom border colours on only withcustomBorderColorWithoutFormat(dev.custom_border_color).sampler_make()setsVK_BORDER_COLOR_FLOAT_CUSTOM_EXTwithbc.format = VK_FORMAT_UNDEFINED.build_descriptors()pairs that sampler with whatever view the handle names (sampler_for((int)(handle >> 20), d.is_depth, tex && tex->levels <= 1)), including views of the formats in step 1. Every condition of 04015 holds.The rules:
VK_BORDER_COLOR_FLOAT_CUSTOM_EXT.VK_FORMAT_UNDEFINEDstays valid for every other view.Before:
After:
Measurements
Verdict: it fixes the bug:
tests/test_sampler_admission.pyfails on main and passes with this PR, in both interleaved runs (after the review: 6 of 153 fail on main, 153 of 153 pass here). Cost: the border format is part of every sampler's key, so an RGB565 view with a custom border colour gets a sampler of its own (one more per custom border colour that meets RGB565); every other view keeps the samplers it had. In the game: 84.35 fps median with this PR against 84.2 fps on main, within the spread between runs (see In the game below).Hardware: Windows 11 IoT Enterprise LTSC 24H2 (build 26100.9711), AMD Ryzen 7 9700X (Zen 5: AVX-512, no AVX512-FP16), 16 GB RAM, AMD Radeon RX 9070 XT, AMD Software: Adrenalin Edition 26.10.1; the test itself is game-free (it compiles a cut-out of the source with clang++ from llvm-mingw and runs it on the CPU); Python 3.12
Scene: none, game-free
Method:
tests/test_sampler_admission.pyfrom this PR with--sourceset to each side's checkout, 2 runs each, interleaved (main, PR, main, PR); the result is pass/fail, so the median is the result both runs gaveHow to reproduce:
python -I -B tests/test_sampler_admission.py --cxx clang++ --headers <Vulkan-Headers include> --source <checkout>for each side9ea65c7be8f4d3c5tests/test_sampler_admission.py, run 1tests/test_sampler_admission.py, run 2What the test checks: for a view of each of the four packed formats, the custom border colour names that format and its colour {1.5, -0.5, 0.75, 1} becomes {1, 0, 0.75, 1}; for any other view it names
VK_FORMAT_UNDEFINEDand keeps the colour; a sampler made for one view format is not returned for a view of another. Theborder-format-in-rangecase (added after the review) uses a colour every format holds and checks that an RGB565 view still gets its own sampler naming that format.In the game
Hardware: Windows 11 IoT Enterprise LTSC 24H2 (build 26100.9711), AMD Ryzen 7 9700X (Zen 5: AVX-512, no AVX512-FP16), 16 GB RAM, AMD Radeon RX 9070 XT, AMD Software: Adrenalin Edition 26.10.1
Scene: standing still for 2 minutes at the same spot after loading the same save, 2560x1440, the game's own upscaler at 100%, uncapped, V-Sync off, frame generation off, the same options file on both sides
Method: both DLLs built on the same PC with
RX_MARCH=x86-64-v3from main @9ea65c7b(Before) and main with this PR merged @e8f4d3c5(After); each side in one block (main first, then this PR), each block a warm-up run that builds that DLL's own shader cache, then 2 runs; the fps of a run is the median of the last 60vk: N presents, X fpslines oflongshot_log.txt, its range the lowest and highest of those 60; the shader start-up time is thevk: start-up: the shaders tooklineHow to reproduce: build both sides with
RX_MARCH=x86-64-v3, play the same save the same way on each, and read those lines fromlongshot_log.txt9ea65c7be8f4d3c5The earlier game runs (main @
2f1c0c9c88.35 fps against this PR before the review @4c496b9689.1 fps) are indocs/tested/2026-11-19-border-color-jcabarca-run01.md; these runs are indocs/tested/2026-11-19-border-color-jcabarca-run02.md.Flags and settings
None.
Testing
Tested: on this branch, Windows, Python 3.12, clang++ from llvm-mingw:
test_sampler_admissionpasses (fails on main), and the other checks that read the changed code pass:test_flat_map,test_handle_lookup,test_prof_symbols,test_taau_env_lookup(its seven cases pass; on Windows it then fails to delete its temporaryfixture.exe, the same on main).Built and played: this commit builds on Windows (llvm-mingw back end) and on Linux (
longshot_vk.so, without and with AMD FSR 4). Played on Windows 11 IoT Enterprise LTSC 24H2 (build 26100.9711), AMD Ryzen 7 9700X (Zen 5: AVX-512, no AVX512-FP16), 16 GB RAM, AMD Radeon RX 9070 XT, AMD Software: Adrenalin Edition 26.10.1: the game runs normally.Not tested: a packed 16-bit texture sampled past its edge with a custom border colour, looked at in the game (which textures and samplers the game pairs that way was not traced). Linux was built, not run.
Must be tested: None: the change is the same on every GPU and OS, and the game-free test covers it.
Risks
What could break: an RGB565 view with a custom border colour now gets its own sampler (more sampler keys: at most one more sampler per custom border colour per packed format met).
VUID-VkSamplerCreateInfo-None-04012limits how many samplers with custom border colours a device can have (maxCustomBorderColorSamplers); main does not check that limit either, and this PR does not change that. A border colour outside [0, 1] on those views now reads clamped, which is all the format can hold.Turning it off: revert the commit.
Compatibility: Nothing changes.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (the checks that read the changed code, on this PR, Windows:test_sampler_admission,test_flat_map,test_handle_lookup,test_prof_symbols,test_taau_env_lookup; the last one's cleanup error on Windows also happens onmain)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here. (theborder-formatcase oftests/test_sampler_admission.py)tests/that reads changed source updated in this PR, not weakened. (tests/sampler_admission_test.cppfollows the new arguments; no case removed)longshot_vk.sowithout and with AMD FSR 4; no OS-specific code or paths)docs/tested/for each new measured run (format indocs/tested-configurations.md). (docs/tested/2026-11-19-border-color-jcabarca-run01.mdanddocs/tested/2026-11-19-border-color-jcabarca-run02.md;tests/test_tested_configurations.pypasses its fragment checks)Tested in game: Played on Windows, AMD Radeon RX 9070 XT: the game runs normally.
WIP: fix(vk): name the view's format in custom border colours of packed 16-bit texturesto fix(vk): name the view's format in custom border colours of packed 16-bit texturesA packed 16-bit texture with a custom border colour now names that texture's format on the sampler. I read head
e279a9b2. Approved.Vulkan forbids a custom border colour with no format when the view is one of
B4G4R4A4,B5G6R5,A1B5G5R5orB5G5R5A1. The sampler was built withVK_FORMAT_UNDEFINEDfor every view.border_formatreturns the view's format for those four andVK_FORMAT_UNDEFINEDfor the rest, whichcustomBorderColorWithoutFormatstill allows. The colour is clamped to [0, 1] only when a format is named. The sampler cache, the per-thread table and the sampler book all keep that format, so a sampler made for one of those views is not handed to another.The view's format comes back from
texture_viewon the thread that made it, and a cached handle keeps the format from when the view was made. A missing view still asks for no format. The check compilessampler_makeand records the format the custom border colour names: each of the four formats, the clamp of {1.5, -0.5, 0.75, 1} to {1, 0, 0.75, 1}, and an ordinary view left undefined. It fails on main. The Windows play on an RX 9070 XT did not look at a packed texture past its edge.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
e279a9b28bee253de13bNew commits pushed, approval review dismissed automatically according to repository settings
Rebased onto main @
c14641a6. Main added a one_level parameter to sampler_make() and sampler_for(), so the view format is now their fourth parameter (gpu/vk/vk_draw.cpp, tests/sampler_admission_test.cpp, tests/test_sampler_admission.py); the change itself is the same. The test now has 150 cases. Run again, interleaved main, PR, main, PR: main fails 3 of 150 (border-format on the id, make and cache-off routes) and this PR passes 150 of 150, both times. Measurements updated; the description also gets the two new Everyone boxes.Rebased onto main @
6fbeca96to clear the conflict; head 4b237fb1, no change to the fix.ee253de13b4b237fb18fRebased onto main @
7daafa7a; the related tests pass on it.Added cost (read from the code, not measured in a game): sampler_for: a format switch and one more compare per sampled texture; more samplers for 4 packed formats; how often: every draw (about 48000 lookups a frame). On an AMD Radeon RX 9070 XT: yes (all GPUs). The box for nothing getting worse stays unticked until this is measured.
4b237fb18f51b1bd758aMeasured in the game against main on Windows 11 IoT Enterprise LTSC 24H2 (build 26100.9711), AMD Ryzen 7 9700X (Zen 5: AVX-512, no AVX512-FP16), 16 GB RAM, AMD Radeon RX 9070 XT, AMD Software: Adrenalin Edition 26.10.1 (both DLLs built with RX_MARCH=x86-64-v3, one block per side, a warm-up and 2 runs each): 89.1 fps median with this PR against 88.35 fps on main, within the spread between runs, and no Vulkan validation errors. The numbers are in Measurements, In the game, and the run is recorded in docs/tested/2026-11-19-border-color-jcabarca-run01.md.
51b1bd758a7ddf1dcb49I read head
7dc85165(the fix4c496b96and its testd833035c, merged with main). The fix is right and kept small. The sampler names the view's format only inside thedev.custom_border_colorbranch, andvk_main.cpp:673already requires bothcustomBorderColorsandcustomBorderColorWithoutFormatfor that, so a device without the extension or its features keeps the transparent-black fallback it has on main. The view's format comes fromtexture_view(), which sets it before every return that gives a view. A cachedHandleHit, a repeated table entry and the dummy view all carry it, orVK_FORMAT_UNDEFINED, correctly.Should be fixed before merge
gpu/vk/vk_draw.cpp:3260(andtests/sampler_admission_test.cpp:431):VK_FORMAT_A1B5G5R5_UNORM_PACK16without a suffix is the core Vulkan 1.4 name. As far as I know, Vulkan-Headers before 1.4.303 have onlyVK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR(from 1.3.246, KHR_maintenance5), and older ones have neither. A Linux build with distro headers under/usr, which docs/development.md supports, stops with an undeclared identifier on those headers (Ubuntu 24.04 ships 1.3.275). The rest ofgpu/vkkeeps to_EXT/_KHRnames (VK_INDEX_TYPE_UINT8_EXT, for example), so this would be the first symbol that needs 1.4 headers. No NVN format maps toA1B5G5R5or toB4G4R4A4invk_formats.cpp, so a fix is eitherstatic_cast<VkFormat>(1000470000)with a comment naming it, orVK_FORMAT_A1B5G5R5_UNORM_PACK16_KHRif 1.3.246 is an acceptable floor. Please check this against the oldest headers the build supports.Suggestions
bc.format = bfmt, the clamp, the key mix insampler_make()(themakeroute), and thee.bordercompare insampler_for()(the id route). It doesn't catchsampler_info()'s newi.border_format(vk_draw.cpp:3177) being dropped. The case's colour {1.5, -0.5, ...} is clamped, so the packed sampler'sSamplerInfoalready differs from the plain one. With a colour that is already inside [0, 1],book.madewould hand the plain sampler (formatUNDEFINED) to a packed view, which is the bug again, and no case would notice. A second pass of the loop withcustom-border's {0.25, 0.5, 0.75, 1} would cover it. Thebuild_descriptors()/texture_view_of()plumbing isn't modelled at all. It reads right, but that part was checked by reading the code only.NVN_FORMAT_RGB5maps toVK_FORMAT_A1R5G5B5_UNORM_PACK16(vk_formats.cpp:129), which the VUID doesn't list. In this game onlyNVN_FORMAT_RGB565(B5G6R5) reaches the rule, so "up to four more samplers" is in practice one more per custom border colour.border_format()is applied to every view, not only to samplers with a custom colour. A sampler without one, sampled with an RGB565 view, gets its own key inmine/book.keys. It still shares itsVkSamplerthroughbook.made, since itsSamplerInfois the same, so the cache can't grow by more than 5x keys and adds no device samplers. A sampler id bound to RGB565 and to other views in turn now missessampler_for()'s per-thread entry each time and does aminelookup. That is small, and the in-game run shows no cost.Measurements: the game-free test fails 3 of 150 on main and passes 150 of 150 here, in two interleaved runs. That is the evidence a fix needs, and the test fails for the bug's reason. In the game on an RX 9070 XT, Windows: 89.1 fps against 88.35 fps (88.8/89.4 against 88.5/88.2), one block per side, which is within the spread. "No cost" is a fair reading, and no gain is claimed. The packed texture past its edge wasn't looked at in the game, and Linux was built but not run, as Testing says. The change is the same on every GPU, so no other hardware is needed. CI on the head hasn't run yet ("Blocked by required conditions").
@ -3175,0 +3174,4 @@if (border) std::memcpy(i.custom, bc->customBorderColor.float32, sizeof i.custom);// (the format whatever the address modes: VUID-VkSamplerCustomBorderColorCreateInfoEXT-format-04015 has no// condition on them, so a sampler without it is not one for a view of those formats)i.border_format = (uint32_t)bc->format;Nothing in
border-formatcatches this line being dropped: the clamped colour already makes the packed sampler'sSamplerInfodiffer. A pass with an in-range colour (e.g.custom-border's {0.25, 0.5, 0.75, 1}) would showbook.madehanding back the UNDEFINED-format sampler without it.@ -3251,0 +3257,4 @@/// customBorderColorWithoutFormat feature (required for custom border colours here) allowsVkFormat border_format(VkFormat view_format) {switch (view_format) {case VK_FORMAT_B4G4R4A4_UNORM_PACK16: case VK_FORMAT_B5G6R5_UNORM_PACK16: case VK_FORMAT_A1B5G5R5_UNORM_PACK16:VK_FORMAT_A1B5G5R5_UNORM_PACK16(no suffix) needs Vulkan-Headers 1.4.303 or newer, as far as I know. Older ones have only..._KHR(1.3.246+) or nothing, so a build with distro headers (Ubuntu 24.04: 1.3.275) fails here.static_cast<VkFormat>(1000470000)with a comment naming it would build everywhere. No NVN format maps to it invk_formats.cpptoday.@ -411,0 +428,4 @@// a B4G4R4A4, B5G6R5, A1B5G5R5 or B5G5R5A1 view names that format; VUID-VkSamplerCreateInfo-borderColor-04442: its colour// then within what the format holds. Other views keep no format, as customBorderColorWithoutFormat allows)policy = test;const VkFormat packed[4] = {VK_FORMAT_B4G4R4A4_UNORM_PACK16, VK_FORMAT_B5G6R5_UNORM_PACK16, VK_FORMAT_A1B5G5R5_UNORM_PACK16,Same header point as
vk_draw.cpp:3260: the fixture compiles against--headerstoo.Thanks for the review. New commit:
NVN_FORMAT_RGB565reachesB5G6R5_UNORM_PACK16; RGB5 and RGB5A1 map toA1R5G5B5_UNORM_PACK16, which 04015 does not name. Why, Seen on and step 1 now say so;border_format()keeps the four formats 04015 names.A1B5G5R5_UNORM_PACK16is now spelled with its_KHRalias, so headers older than 1.3.246 build.border-format-in-rangewith a colour every format holds, so only the format tells the samplers apart; it fails ifsampler_info()stops recording the border format. Main fails 6 of 153 cases, this PR passes 153 of 153.7dc8516586e8f4d3c5d1Measurements updated: the game-free test was run again, 2 interleaved runs, on main @
9ea65c7b(6 of 153 cases fail) and on this PR @e8f4d3c5(153 of 153 pass); the table and the output show them. The game runs in Measurements predate the review commit, as the description now says.a27b025b29f702472be7Game runs after the review: main @
9ea65c7bagainst this PR @e8f4d3c5, both built withRX_MARCH=x86-64-v3, each side a warm-up and 2 runs standing still for 2 minutes. Median 84.35 fps with this PR against 84.2 fps on main; shaders at start-up with a warm cache 21.1 and 20.4 s against 21.3 and 20.4 s. The tables and log lines are in Measurements, In the game; the new commit addsdocs/tested/2026-11-19-border-color-jcabarca-run02.md.f702472be78e2e375070Rebased onto main
89c3d21e; the related tests pass again on the new head. The description now names the test PC in full. New commit: the test fixture's Recording gets the pool_sets and pool_descs counters the descriptor writer on main now counts (#1158), so the fixture compiles again; no change to the fix.Recommendation: Request changes. The code is right and every point of the earlier review is fixed; only the description must change: it is in the old template, so
pr statuslists three things to fix (no## Summary, no Still to test: in Testing, no### Ready for reviewunder Checklist) and the PR description check fails on the head. Once the description is moved to the current template, I would recommend approval.For a player: a texture in NVN RGB565 sampled past its edge with a custom border colour gets the colour Vulkan defines rather than whatever the driver does with a format-less border; the code is a small, contained fix with its test.
Does it help: a fix, not a perf change. The game-free test fails on main for the bug's reason (6 of 153:
border-formatandborder-format-in-rangeon the id, make and cache-off routes) and passes here, two interleaved runs. In the game on an RX 9070 XT, Windows: 84.35 against 84.2 fps median (and 89.1 against 88.35 before the review commit), within the spread: no cost seen, no gain claimed. The texture past its edge was not looked at in the game.Other systems: the change is inside
else if (dev.custom_border_color), whichvk_main.cpp:644turns on only with bothcustomBorderColorsandcustomBorderColorWithoutFormat. A driver or vendor without the extension or withoutcustomBorderColorWithoutFormatkeeps the transparent-black fallback, exactly as on main (VUID 04014 would forbidUNDEFINEDthere, so the PR rightly does not try to enable custom colours on such devices). Nothing ingpu/usesVK_EXT_border_color_swizzle, and the PR doesn't need it: views carry NVN component mappings (vk_texture.cpp:653), and a custom border colour on a non-identity view is undefined without that extension on main and here alike; this PR doesn't change it (a possible follow-up, not this PR's). Every vendor (NVIDIA, RADV/AMD Windows, ANV, the Deck) takes the same path; the only device-visible difference is theformatfield for the four packed formats, which drivers are required to accept. Sampler count: at most one more custom-border sampler per colour that meets RGB565 (maxCustomBorderColorSamplersstays unchecked, as on main, and Risks says so). Descriptor reuse: the view's format is a function of the handle and its registration, so a fingerprint hit can't pair a stale format.Switches: none.
Reviewed:
ac958814c7against8859673e(the merge's main parent; main@origin3df5c13eis ahead only invk_main.cpp's zstd lines, nothing this touches):gpu/vk/vk_draw.cpp(SamplerInfo,sampler_info,border_format,sampler_for,sampler_make,HandleHit,texture_view_of,build_descriptors' sampled-texture loop),tests/sampler_admission_test.cpp,tests/test_sampler_admission.py, in full where changed;vk_main.cpp's feature gate andvk_formats.cpp's packed mappings read around it; the twodocs/tested/rows skimmed. Nothing run (a code review). A re-review: compared against my earlier review's head7dc85165; the new code since then isca511a9c(the_KHRalias, the in-range case),f23235eb(docs/tested run02) and8e2e3750(the fixture'spool_sets/pool_descs, matching main'sRecording).Fixed in this review: nothing.
Checked and fine:
VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHRin bothborder_format()and the fixture needs Vulkan-Headers 1.3.246; the build pins its own headers (mise.toml) and Ubuntu 24.04's 1.3.275 is past that floor.border-format-in-rangecase catchessampler_info()'si.border_formatbeing dropped: with an in-range colour theSamplerInfowould then match the plain sampler's andbook.madewould hand it back, sopacked != plainfails. It also checkscreates == 2and that both stay cached.border-formatstill catchesbc.format = bfmt, the clamp, the key mix insampler_make()and thee.bordercompare insampler_for(); on a--sourcefrom main the fixture builds withSAMPLER_VIEW_FORMAT 0and fails on the format assertions, the bug's reason.sampler_info()records the format whatever the address modes, which is right: 04015 has no address-mode condition.c > 0 ? min(c, 1) : 0) maps NaN to 0 and runs only when a format is named (04442); 07605 holds (UNORM formats, float custom colour).texture_view_of(): the format islast_view_formatonly when a view was made,UNDEFINEDotherwise; a cachedHandleHitreturns its stored format; the repeated table entry, the depth-compare refusal and the dummy view each set the format they should.Recordingfixture change matches main'svk_internal.hstruct (pool_sets,pool_descs[6]), no case removed or weakened.Assisted-by:trailers; no game files.Blocking (to change before merge)
pr statuspasses: a## Summary, Still to test: under Testing (None, or the in-game look past a packed texture's edge if you want it there), and the Checklist's### Ready for review/ Ready to merge lists in place of the old Everyone list. While at it,pr statuswarns that the numbers were taken on main9ea65c7band the PR is now on8859673e: a line saying why they still hold (main's changes since don't touch the sampler path) is enough.pr statusalso hints at Docs updated for the twodocs/tested/files.Suggestions (the author may take or leave)
border_format()is mixed into the key for every view, so a sampler without a custom colour sampled with an RGB565 view gets its ownmine/book.keyskey (it still shares theVkSamplerthroughbook.made), and a sampler id bound to RGB565 and other views in turn missessampler_for()'s entry each time. Mixing it only when the sampler takes the custom-colour branch would avoid both; the game run shows no cost, so this is optional.Testing: the author's game-free test (fails on main, passes here, twice) and two in-game blocks on an RX 9070 XT, Windows; Linux built, not run; TrashPanda's approval is stale. CI on the head is still blocked by required conditions, and the description check fails (point 1). No other hardware is needed: the path is the same on every GPU and the feature gate is unchanged.
Overlaps and merge order: none found. The author's other vk fixes, 925 and 1448, touch
vk_texture.cppand the shader profile (vk_main.cpp,vk_shader.cpp), not the sampler code: no order needed.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.