tests: resolve the host depth-stencil format against device support #930
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!930
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/930/head"
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?
@theantipopau on GitHub · 2026-09-29 21:58 UTC · original
theantipopau:depth-stencil-device-format→main· +77 −28 · 1 files · 3 commits · closed without mergingWhat
Follow-up to #875. That PR stopped the suite from aborting on a GPU missing the production
rasterization features, but the suite still aborted on this machine — later, in a different
place, and for a different reason:
format=129isVK_FORMAT_D24_UNORM_S8_UINT.Image::ImagecallsEXITwhenvkGetPhysicalDeviceImageFormatPropertiesrejects the configuration, so this is not a testfailure — it terminates the process, and every case after it never runs.
Two checks hardcode
D24S8as the host format:CheckUnifiedImageViewCache(1 sample) andCheckUnifiedTextureCacheFlow(2 samples, plus a D16-fallback case that also lands on D24S8).Neither consults device capability.
Evidence
Querying the local device for every attachment usage and sample count combination:
DEPTH_STENCIL_ATTACHMENTCOLOR_ATTACHMENTD16_UNORMD16_UNORM_S8_UINTD24_UNORM_S8_UINTD32_SFLOATD32_SFLOAT_S8_UINTD24S8is rejected for every usage subset and every sample count — including empty usage atone sample — while the surrounding colour and depth formats behave normally, so this is a real
driver gap rather than a bad query.
D32_SFLOAT_S8_UINTis the same shape (depth + stencil,8 bytes per texel) and is supported at all sample counts.
The fix
VulkanHarness::SupportedDepthStencilFormat(preferred, samples)returns the first format thedevice can attach as depth-stencil at that sample count, preferring the one the check
intended, falling back to
D32_SFLOAT_S8_UINTand thenD16_UNORM_S8_UINT.On a device that supports
D24S8— which is most of them — the helper returnseD24UnormS8Uintand every line below behaves exactly as before. The fallback only engageswhere the hardcoded format would otherwise have killed the process. When no depth-stencil
format is available at all the affected sub-case is counted as a skip through the existing
SkipRasterizationCasescounter rather than aborting.CheckUnifiedTextureCacheFlowresolves the format once at the top, because the depth-dependentwork is spread through the whole check; the 2-sample site re-resolves for
e2specifically.CheckUnifiedImageViewCacheguards only its depth/stencil aspect sub-block so the colour, 1Dand volume view coverage after it still runs.
Testing
shader_recompiler_compute_testsbuilds clean. Before the change the run died atimage.cpp:704afterNativeIndirectDispatch; after it the suite proceeds through all thehost and compute cases and reports the pre-existing shader mismatches (for example
VectorFractF16CapturedAndEdges, unchanged from the failure inventory in #875).No game was run for this one — it only changes which host format a test allocates, and no
emulator code path is touched.
Note for reviewers
The deeper issue is that
Image::Imagetreats an unsupported image configuration as fatal. Thesibling path in the same function already degrades gracefully — when a block-compressed format
lacks storage support it logs one warning and carries on. I kept this PR test-side and am not
proposing a product change here: falling back on a guest-requested depth format is a real
rendering-correctness decision that deserves its own discussion, and no game on this machine
exercises it.
@coderabbitai[bot] on GitHub · 2026-09-29 22:03 UTC · original · edited 2026-10-06 04:44 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
40eaace9-97fe-40dd-a289-5f54be08666e📥 Commits
Reviewing files that changed from the base of the PR and between
7a15b84c9fand9192a95861.📒 Files selected for processing (1)
tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.
📝 Walkthrough
Walkthrough
The tests now select depth/stencil formats based on required image usage and sample-count support. They skip cases when no suitable format is available. Depth/stencil image and view descriptors use the selected format, including the fallback descriptor.
Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Other
Merge Risk: 🟡 Moderate · up to
9192aOn devices without two-sample depth-stencil support, this test can leave GPU state behind when it skips, potentially affecting later cases. Move the support check before resource setup before merging.
Architecture Summary
Architecture risk: 🔵 Low · up to
9192aThe change affects 1 system.
Changed systems:
testsArchitecture concerns
No architecture-level concerns identified.
Review details
Systems and components
Before / after behavior
VulkanHarnessadds a depth/stencil format selector that checks the preferred format, then D32S8 and D16S8, for depth-stencil attachment, sampled, transfer-source, and transfer-destination usage with the requested sample count; it returnseUndefinedif no candidate qualifies.CheckUnifiedTextureCacheFlownow selects a supported single-sample depth/stencil format before proceeding; if none is available, it records one skipped rasterization case and returns.🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -6229,0 +6273,4 @@if (ms_depth_format == vk::Format::eUndefined) {SkipRasterizationCases(1);return;}@coderabbitai[bot] on GitHub · 2026-09-29 22:03 UTC · original
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 29911
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 35642
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 40738
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4512
Move the 2-sample format check before resource allocation.
When 2-sample support is unavailable, this return occurs after direct-memory allocation, fixed mapping,
InitializeGpu,InstallGpuResources(&resources), andresources.MapMemory.RenderContext::~RenderContextdoes callShutdownGpu, but it does not release the direct memory or clear the installed GPU-resource pointer. The return leaves the fixed mapping and a dangling installed pointer that can affect later cases.Resolve the format beside
host_depth_stencil, before creating the context or allocating resources.Suggested fix
Remove the later format lookup and early return. Keep only
ms_depth_desc.info.pixel_format = ms_depth_formatat that location.@coderabbitai[bot] on GitHub · 2026-09-29 22:03 UTC · original · reviewed
Actionable comments posted: 1
🧹 Nitpick comments (1)
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
165871d9-9be0-4116-8320-05dd9bf33cff📥 Commits
Reviewing files that changed from the base of the PR and between
05057c9441and2482d13957.📒 Files selected for processing (1)
tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
@theantipopau on GitHub · 2026-09-29 23:07 UTC · original
Updated failure inventory
With this change the suite runs to completion on my GPU instead of dying at
image.cpp:704, soit is worth restating where the remaining failures actually are. Measured on AMD hardware,
subgroup_size == 64, with #930, #933 and #934 all applied locally:For reference, before #930 the run aborted at
CheckUnifiedTextureCacheFlowand nothing afterit ran at all.
The three float16 ones
All three differ by one unit in the last place, in the low direction:
VectorFractF16CapturedAndEdgesis the same shape but on hardware-captured edge values. Thevalues involved are subnormal-adjacent, which is where f16 conversion rounding differs between
round-to-nearest-even and the flush-to-zero behaviour of the guest. I read these as expectations
captured from hardware that the SPIR-V path cannot reproduce exactly, rather than as defects in
the conversion, so I have left them alone — changing them would paper over the difference rather
than explain it.
DsAppendAllocatesAcrossWaves32This one looks like a genuine defect rather than a stale expectation. Details are in #934: the
recompiler never declares
SubgroupSizeControl, so on a GPU whose subgroups are 64 wide, awave32 shader gets a subgroup twice the guest wave width, and everything that assumes
SubgroupLocalInvocationIdis the wave lane stops being true.Cases that turned out to be wrong expectations, now fixed
Two of the failures I listed earlier were not emulator bugs at all, and are corrected in #933:
BranchVccnzUsesWaveMaskasserted an all-uniform result for a per-lane branch.BranchVccnzUsesCarryProducedWaveMaskusedV_CMP_F_U32, whose implicitsrc2of 0 is the"always false" predicate, so it never actually supplied the carry-in it was written to test.
And
BufferStoreFormatXAddTidUsesLaneIndex(#934) had an expectation that depended on the hostchoosing 32-wide subgroups, which nothing guarantees.
@MuteRex on GitHub · 2026-10-21 13:42 UTC · original
Retested on current main (
4644c52, 2026-10-21) on AMD RDNA4, and this is still needed. I'm asking for it to be reopened.Hardware: RX 9060 XT (RADV GFX1200), Mesa 26.0.8, Ubuntu 26.04, kernel 7.0.0-38
On current main, the hardcoded D24S8 now breaks 6 test cases, up from 3 when this PR was opened. All of them die at
image.cpp:725withimage format does not support required usage: format=129 type=1 usage=0x23:texture_cache_layered_image,texture_cache_image_views,texture_cache_storage_sampled(samples=1)texture_cache_image_overlap,texture_cache_htile_clear,buffer_cache_ranges(samples=2)RADV on GFX1200 doesn't support
VK_FORMAT_D24_UNORM_S8_UINTfor that usage, whileD32_SFLOAT_S8_UINTis supported (checked with a smallvkGetPhysicalDeviceImageFormatPropertiesprogram, included).4644c524644c52+ this PRThe diff no longer applies cleanly to main. One hunk in
tests/ShaderRecompilerComputeTests.cppconflicted because of context drift. I re-placed it at the same spot (right afterEnsureRuntimeContext()in that harness function), and that rebased diff is in the zip. The remaining failures are unrelated:gpu_tiler(fixed by #795),shader_recompiler_compute(BoundedRecordBufferAccess32), and 4 emulator CLI tests that only show "Not Run" because I builtkyty_testswithout the emulator.Logs for all three runs, the rebased diff and the format check are attached.
AI assistance (Claude) was used to rebase the diff, run the suites and summarise the logs. I ran the tests on my own hardware and reviewed the results.
kytyps5-rdna4-pr-tests.zip
@theantipopau on GitHub · 2026-10-22 03:24 UTC · original
@MuteRex thanks for the retest — that is exactly the failure mode this was meant to fix, and your numbers (12 failed / 57 on
main, 6 of them cleared by this change) are now recorded in the continuation PR.GitHub refuses to reopen this one:
gh pr reopen 930returnsreopenPullRequest: Could not open the pull requestafter the branch was force-pushed to rebase it. I rebased the identical change onto currentmain(7b7f9a70) and opened #1811 with that branch, so the work is reviewable there rather than lost in this closed thread. The only difference from the diff you tested is formatting at the rebased hunk.Your point about the remaining failures still stands: with #1811 applied the run should stop aborting on D24S8 and report the real failures instead. If you are willing, a rerun of
shader_recompiler_compute_testsagainst #1811 would confirm the six D24S8 aborts are gone on RADV; the other failures you listed (gpu_tiler,BoundedRecordBufferAccess32) are tracked separately.Pull request closed