perf(vk): cut pass GPU time 8.5-12.8% (+3.8-6.2% FPS, +26.6% 1% low) across GPUs via depth/stencil optimal layouts and fast Z-clear #2705
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2705
Loading…
Reference in a new issue
No description provided.
Delete branch "Jer9/Longshot:perf/vk-depth-optimal-layouts"
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?
Summary
What a player notices:
m passGPU time by -12.8% (-1.307 ms) at1920x120067% render scale(+6.2%Mean FPS,+26.6%1% low) and -8.5% (-0.991 ms) at2880x1800100% render scale(+3.8%Market /+5.0%Hyrule Field Mean FPS).cmds_msstays flat (-0.25 to +0.13 ms), and self-sampled depth feedback passes fall back safely toVK_IMAGE_LAYOUT_GENERAL.Depth/stencil targets previously stayed permanently in
VK_IMAGE_LAYOUT_GENERAL, preventing hardware HTILE/Hi-Z compression and fast Z-clears. This PR tracksTexture::layout(gpu/vk/vk_texture.h/.cpp), initializes depth viaUNDEFINED -> TRANSFER_DST_OPTIMAL -> clear -> DEPTH_STENCIL_ATTACHMENT_OPTIMAL, transitions depth/stencil targets acrossDEPTH_STENCIL_ATTACHMENT_OPTIMAL,DEPTH_STENCIL_READ_ONLY_OPTIMAL(withSTORE_OP_NONEfor Rule 5 read-only depth+sample),GENERAL(Rule 5 self-feedback withdescriptors_disturbed()), andTRANSFER_SRC|DST_OPTIMAL, enablesLOAD_OP_CLEARfast Z-clears for full single-mip/single-layer depth/stencil targets, and guardsr.uploadlayout ordering (UploadLayoutGuard,layout_cmd_rec) so upload-pass transitions never clobberr.cmdlayouts.Files to read first:
gpu/vk/vk_texture.cpp,gpu/vk/vk_draw.cpp,gpu/vk/vk_xfer.cpp, andtests/test_target_layouts.py.Testing
Tested:
26.10.1 (LLPC).Market_Child -> HyruleField_Child -> KokiriForest_Child(3-zone smoke).RX_VK_PASS_TIMING=1,RX_VK_ANTILAG=0,RX_VK_PRECOMPILE=0,12.5 ssettle, Market0:LUP/5000walk to fountain) at1920x120067% render scaleFSR 3.1 and2880x1800100% render scale.python -I -B tests/test_target_layouts.py: failed onforge/main(86b3b9e4) and passes on bothclang++andg++ona477ef20(including same-layoutr.cmd+UploadLayoutGuardrestore anddiscard == truetests).python -I -B tests/run_all.py --strict(16 targeted checks):16 passed, 0 failed, 0 skipped.python -I -B scripts/check_guide_screenshots.py --review-sources:0issues on branch-touched files.Still to test:
RX_VK_VALIDATION=1(VK_LAYER_KHRONOS_validation, not installed on this Windows host): run 3-zone traversal (Market,Hyrule Field,Kokiri,Deku Tree) on Linux/Windows Vulkan SDK, expecting0VUIDlayout mismatches (@Beanstalkbefore merge).@Beanstalkafter push).Measurements
Verdict:
m passGPU time dropped -12.8% (-1.307 ms) at1920x120067% render scale(+6.2%Market Mean FPS,+26.6%1% low3/3rounds won) and -8.5% (-0.991 ms) at2880x1800100% render scale(+3.8%Market /+5.0%Hyrule Field Mean FPS), with0DEVICE_LOSTand0vk: ERROR.Setup: Windows 11, AMD Radeon 860M (
26.10.1 LLPC),RX_VK_PASS_TIMING=1,RX_VK_ANTILAG=0,RX_VK_PRECOMPILE=0,12.5 ssettle, Market (market-entrance,0:LUP/5000to fountain) + Hyrule Field (HyruleField_Child), 3-round interleaved medians (6df6775avsforge/main86b3b9e4;a477ef20only fixes the same-layoutUploadLayoutGuard/discardedge case).Where it makes a difference:
86b3b9e4a477ef201920x120067% render scalem passGPU ms1920x120067% render scaleTotal GPU ms1920x120067% render scaleMean FPS1920x120067% render scale1% low FPS2880x1800100% render scalem passGPU ms2880x1800100% render scaleTotal GPU ms2880x1800100% render scaleMean FPS2880x1800100% render scale1% low FPS2880x1800100% render scaleMean FPS2880x1800100% render scale1% low FPSWhere it does NOT make a difference (within run-to-run variance):
86b3b9e4a477ef201920x120067% render scalecmds_msRisks
VK_LAYER_KHRONOS_validation) on late-game dungeons and NVIDIA/RADV drivers must be verified via@Beanstalkbefore merge because the Windows host lacksVK_LAYER_KHRONOS_validation.longshot_options.ini, or shader caches.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (python -I -B tests/run_all.py:746 passed, 13 failed, 102 skipped; all 13 are pre-existing Windows-env failures shared with cleanmain,test_sampler_admission.pypassed).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Windows 11 Radeon 860M (26.10.1 LLPC): 3-zone smoke + 3-round interleaved A/B at 1920x1200 67% FSR 3.1 (-12.8% m pass, +6.2% FPS, +26.6% 1% low) and 2880x1800 100% (-8.5% m pass, +3.8-5.0% FPS), 0 DEVICE_LOST
@Beanstalk Please run
RX_VK_VALIDATION=1(VK_LAYER_KHRONOS_validation) 3-zone traversal (Market,Hyrule Field,Kokiri,Deku Tree) on Linux/Windows Vulkan SDK, plus Market + Hyrule Field A/B on discrete AMD RDNA 3/4, NVIDIA RTX, and Steam Deck RADV.@Jer9 only members of
BigBeanscan start the farm. One of them can approve this request by reacting 👍 to it or to this comment.@beanstalk
Beanstalk test farm · 🔄 testing (12 of 8 reports so far)
Commit
a477ef2· approved by HumanBean (reviewed) · dashboard⚠️ Note: Validation is requested, but the plan cannot ensure the Vulkan validation layer is installed or prove that every depth-feedback and upload-ordering path was reached.
⚠️ Note: The farm fixes output at 1920x1080 and measures total GPU pass time, not the reported individual m pass or cmds_ms values; it cannot reproduce the claimed resolutions, exact render scales or Market walk.
⚠️ Note: Late-game dungeons, vendor-SDK upscalers, ReShade and the standalone source tests are not covered.
Done (started 00:32 UTC, last report 00:48 UTC). Comment
@Beanstalkto run it again.nvidianvidia+gpu-rtx-*(GPU "rtx *")windows+amdlinux+radvamd+dgpuwindows+amd+igpuintelradv+steamdeckdepth-layout-traversal· frame time p99 (ms), main → PR at each leveldlss=0(reference)dlss=3nvidianvidia+gpu-rtx-*(GPU "rtx *")windows+amdlinux+radvamd+dgpuwindows+amd+igpuintelradv+steamdeckCouldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
nvidia, report 1:main's longshot-builder failed (exit 1): could not compile 'proc-macro2' (build script) due to 1 previous errornvidia, report 2:main's longshot-builder failed (exit 1): could not compile 'proc-macro2' (build script) due to 1 previous errornvidia+gpu-rtx-*, report 1:main's longshot-builder failed (exit 1): could not compile 'libm' (build script) due to 1 previous errornvidia+gpu-rtx-*, report 2:main's longshot-builder failed (exit 1): could not compile 'proc-macro2' (build script) due to 1 previous errorwindows+amd, report 1:main's longshot-builder failed (exit 1): could not compile 'icu_locale_fallback_data' (build script) due to 1 previous errorwindows+amd, report 2:main's longshot-builder failed (exit 1): could not compile 'serde_core' (build script) due to 1 previous errorlinux+radv, report 1:the main base failed (exit 1): The game's Rust (longshot-rs) has no prebuilt library for these sources (8846f3f16e7e), and nothing here to build it with: in a checkout, install Rust (mise install) or set LONGSHOT_CARGO; a release's tree carlinux+radv, report 2:the main base failed (exit 1): The builder stopped on an error: cargo build -p longshot-rs failed: Updating crates.io indexWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)Three alternating runs per build will compare Market and Hyrule Field GPU time, frame times and FPS, and compare screenshots against main in those areas, Kokiri Forest and the Deku Tree. The upscaler axis covers the game's own upscaler and FSR 3.1 because both use changed depth paths. Crashes, Vulkan validation errors, screenshot differences above 0.2, or GPU-time or frame-time regressions over 15% fail the plan. The Steam Deck target waits for an online tester. No tester online now matches radv+steamdeck: that target waits for one.
0or3.market-entrance(switchesRX_VK_ANTILAG=0,RX_VK_PRECOMPILE=0,RX_VK_VALIDATION=1), then teleport to Market, take the picture market to compare with main, measure market for 20 s (after 13 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 20 s (after 13 s warm-up), teleport to Kokiri Forest, take the picture kokiri to compare with main, teleport to Inside the Deku Tree, take the picture deku to compare with main; 3 runs on each side for each of 2 cells (1 game start a run).Measurements on `nvidia`, for the PR description
Verdict: could not be judged on nvidia (2 reports).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu+dlss
NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.012th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+xessNVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 32 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `nvidia+gpu-rtx-*`, for the PR description
Verdict: could not be judged on nvidia+gpu-rtx-* (2 reports).
Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss+xessNVIDIA GeForce RTX 5050 Laptop GPU, 621.40.0AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `windows+amd`, for the PR description
Verdict: could not be judged on windows+amd (2 reports).
Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4
AMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM; 2: windows+amd+amd-proprietary+dgpuAMD Radeon RX 6950 XT, 2.0.353AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `linux+radv`, for the PR description
Verdict: could not be judged on linux+radv (2 reports).
Hardware: 1: linux+amd+radv+igpu
AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `amd+dgpu`, for the PR description
Verdict: could not be judged on amd+dgpu (2 reports).
Hardware: 1: linux+amd+radv+dgpu
AMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `windows+amd+igpu`, for the PR description
Verdict: could not be judged on windows+amd+igpu (1 report).
Hardware: 1: windows+amd+amd-proprietary+igpu+xess
AMD Radeon(TM) Graphics, 2.0.279AMD Ryzen 5 5600G with Radeon Graphics, 28 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
Measurements on `intel`, for the PR description
Verdict: could not be judged on intel (1 report).
Hardware: 1: windows+intel+intel-proprietary+igpu
Intel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAMScene: depth-layout-traversal, from the repository's save market-entrance (RX_VK_ANTILAG=0, RX_VK_PRECOMPILE=0, RX_VK_VALIDATION=1); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); depth-layout-traversal: 3 game starts a side, market 20 s after 13 s warm-up, field 20 s after 13 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
dlss0,3As Markdown for the PR description:
The testers' hardware
nvidiaNVIDIA GeForce RTX 3050 Laptop GPU, 621.40.012th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAMnvidiaNVIDIA GeForce GTX 980, 582.78.0Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 32 GB RAMnvidia+gpu-rtx-*NVIDIA GeForce RTX 4070, 621.24.0AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAMnvidia+gpu-rtx-*NVIDIA GeForce RTX 5050 Laptop GPU, 621.40.0AMD Ryzen 5 220 w/ Radeon 740M Graphics, 16 GB RAMwindows+amdAMD Radeon RX 9070 XT, 2.0.416AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAMwindows+amdAMD Radeon RX 6950 XT, 2.0.353AMD Ryzen 7 5800X3D 8-Core Processor, 32 GB RAMlinux+radvAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMlinux+radvAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMamd+dgpuAMD Radeon RX 7900 XTX (RADV NAVI31), 26.2.7AMD Ryzen 7 5800X3D 8-Core Processor, 64 GB RAMamd+dgpuAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMwindows+amd+igpuAMD Radeon(TM) Graphics, 2.0.279AMD Ryzen 5 5600G with Radeon Graphics, 28 GB RAMintelIntel(R) UHD Graphics 630, 0.404.2115Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM@review
Recommendation: Approve. The reported AMD iGPU results show a promising gain, but they were measured on an earlier commit and the requested validation and Tier 1 hardware runs are still outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The change uses optimal Vulkan depth/stencil layouts and fast clears to reduce rendering time. It adds layout tracking and transitions across rendering, transfers, uploads, dumps and upscalers, increasing the amount of synchronization state the renderer must keep consistent.
Should fix (1): not blocking, but worth doing before merging.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
a477ef20, so they cannot establish the gain or frame pacing of the code proposed for merge. Do: Repeat the interleaved comparison of the base and head on the reported hardware and scenes, including mean FPS, 1% low and frame times.@fixcan do L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven for the head. The PR reports three interleaved runs on a Windows Radeon 860M: Market mean FPS rose from 37.31 to 39.61 and pass GPU time fell from 10.246 to 8.939 ms at 1920x1200 and 67% scale. Those runs used 6df6775a, not head
a477ef20.Other systems: The change reaches depth sampling, transfers, compaction, ReShade and temporal upscalers. The reported smoke test covers one AMD Windows driver; Vulkan validation, NVIDIA, discrete AMD and Steam Deck RADV results remain outstanding.
Switches: None added, changed or removed.
Reviewed:
a477ef2016against86b3b9e4f0: Read the repository rules, PR template, commit log and the changed sections of the Vulkan files and tests. Skimmed the guide manifest and the large new test; the changed code files were not read in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent from the checkout.; nothing run (a code review).Checked and fine:
Testing: No code, scripts or tests were run, as requested. The PR reports game and check results; CI is still running.
Overlaps and merge order: Unknown; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
Addressed BeanBot Should fix L3 in commit
9d21c2fe:--headersand--cxxdefaults (find_vulkan_headers()andfind_cxx()) intests/test_target_layouts.pywhile keepingRUN_ALL_ARGSintact.python -I -B tests/test_target_layouts.py(with zero flags),tests/run_all.py --strict tests/test_target_layouts.py, andtests/run_all.py --exact tests/byte_compile_tracked.pyall pass (zero C++ source changes sincea477ef20).