presentation: copy the video-out subresource the texture cache resolved #2372
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!2372
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2372/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?
@Nawid3333 on GitHub · 2026-11-18 06:17 UTC · original
Nawid3333:fix/present-resolved-subresource→main· +149 −18 · 3 files · 2 commits · closed without mergingProblem
Beat Saber (PPSA15035, #2337) stops at its first flips. @Crispy81's log on official
1e87171:Presenter::Impl::ResolveSurfacelooks the flip address up withFindImage, asking for level 0, layer 0 and one layer. When a larger cached image covers the address,FindImagereturns that image: at the image's start address the view keeps level 0 and layer 0 (textureCache.cpp:811-817 at2638b1b07), inside it the view gets the matching level and layer (textureCache.cpp:830-834, 1316-1321).ResolveSurfacereturned only theImage&, andFrame::CopyFromcopied allsource.backing.layerslayers into the one-layer frame, so an array image at the flip address ends in the layer-countEXIT_IF(swapchain.cpp:219).In Beat Saber the flipped buffer is the left eye texture ("Hmd2: separate eye textures are not supported; showing the left one"), the start of a cached two-layer 1632x1836 image. A diagnostic build printed
presentation copy layer mismatch: source layers=2 extent=1632x1836 format=64 | frame layers=1 extent=1632x1836 format=64.Change
ResolveSurfacereturns aPresentSource: the image plus thebase_levelandbase_layerthatFindImageresolved.CopyFromcopies that one level and layer into layer 0 of the frame, and the copy extent is that level's extent, clamped to the frame as before.PrepareFramesizes the frame from that level's extent.Tests
shader_recompiler_compute_tests --present-array-layer-only(CTestvideo_out_array_layer, next topm4_flipandvideo_out_flip_rate): a cached two-layer 128x128R8G8B8A8Srgbrender target has one video-out buffer of the same format and extent on each layer (the array start and the second layer's 64 KiB slice), and the flip of each must complete. The presenter has no frame readback, so the test checks that both flips complete, not the copied pixels.RX 9070 XT (Windows 11, clang-cl): with the change the test passes, and
pm4_flipandvideo_out_flip_ratestill pass. With main'sswapchain.cppthe same test stops at the game's exact check:Fork build of this head (run 44248180832): Windows, Linux and macOS build.
In a game
2638b1b(452d8a6). The game got past the presenter and stopped later, in a color resolve between two formats (image.cpp:421), which #2371 fixes.Written with Claude Code (AI): Claude Code found the cause in the reporter's logs, wrote the change and the tester builds; GLM fact-checked this text.
@coderabbitai[bot] on GitHub · 2026-11-18 06:24 UTC · original
No actionable comments were generated in the recent review.
Walkthrough
Presentation sources now include mip and array-layer selection. Frame preparation uses the selected mip’s extent, and frame copying targets the selected mip and layer. A new host test submits flips for both layers of a two-layer image, and CTest can run that test directly.
Suggested reviewers:
nmzik,pcniadoChange: Bug fix
Merge Risk:
Minimal · up to
75198Presentation now copies the single mip level and array layer that the texture cache resolves, which fixes the reported Beat Saber layer-count failure on two-layer images. Flips of one-layer images at level 0 behave as before. The new test checks that flips on both layers complete but not the displayed pixels. No concrete merge-blocking risk was found.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the change the presenter now makes: it copies the video-out subresource (mip level and array layer) that the texture cache resolved. The raw summary and objectives confirm that ResolveSurface now returns the resolved base level and layer, and CopyFrom copies that subresource. The title is specific and matches the main change.
Full details: Description check
Explanation
The description explains the problem (Beat Saber failing at the swapchain.cpp:219 layer-count check), the cause (FindImage resolves a level and layer that the presenter discarded), the change (ResolveSurface returns a PresentSource, CopyFrom copies one level and layer, PrepareFrame sizes from that level), the added test, and in-game results. It is closely related to the changeset.
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
741c2e05-71b3-461f-9093-ec3452b2f738Reviewing files that changed from the base of the PR and between
2638b1b076and7519894e0b.CMakeLists.txtsrc/graphics/presentation/window/swapchain.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
@Nmzik on GitHub · 2026-11-18 14:20 UTC · original
Credited
Pull request closed