perf(graphics): avoid repeated framebuffer uploads in Hades #1094
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!1094
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1094/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?
@juanfariasdev on GitHub · 2026-10-06 02:33 UTC · original
juanfariasdev:fix/hades-texture-uploads→main· +162 −0 · 5 files · 1 commits · closed without mergingSummary
Hades (PPSA03355, 01.003.000) clears its framebuffers with a bounded DWORD pattern-fill compute kernel. When the pattern period is one, the kernel writes a constant value, but its EXEC branches prevent the existing uniform-fill analysis from recognizing it. Running this clear through buffer emulation marks the images dirty and repeatedly uploads the entire framebuffers.
Recognize this kernel's complete executed instruction sequence and route proven, complete period-one fills through the existing native image-clear path. In the same steady scene, texture uploads fell from approximately 5,823 to 128 MiB/s, while presentation remained around 60 FPS.
Changes
S_ENDPGMare excluded. The matcher does not depend on a game name, shader hash or guest address.The PR contains only this optimization and its tests. The earlier mutex optimization, performance panel, macOS compatibility fixes and temporary probes are excluded.
Testing
Apple M4 Pro, macOS, MoltenVK 1.4.2, x86_64 Release build. Hades was tested on the local
test/perf-macbranch with #1083 and #1090 merged:launcherandshader_recompiler_compute_testssuccessfully.compute_dword_pattern_clearpassed, including SPIR-V validation and the existing generic-fill regression. The new recognition case failed before the implementation was added.compute image clearpath and the reduction in texture uploads.Measurements from one-second samples of the same steady scene, selecting 800–900 draws/s and 59–61 FPS:
This is approximately 97.8% less upload traffic. The scene was already around 60 FPS, so these measurements do not establish an FPS increase.
The full GPU test harness requires barycentrics and 64-bit atomics unavailable on this MoltenVK, so its GPU cases could not run locally.
VK_LAYER_KHRONOS_validationwas also unavailable. Linux/Windows builds were not run locally. The intermittent Hades startup crash and other stutters remain separate issues.🤖 Generated with Codex
@coderabbitai[bot] on GitHub · 2026-10-06 02:39 UTC · original · edited 2026-10-06 02:44 UTC
📝 Walkthrough
Walkthrough
The recompiler marks matching compute shaders with a
dword_pattern_fillflag.ResolveComputeBufferFilluses that flag to resolve eligible period-one dispatches as buffer fills. Tests cover supported and rejected shapes, runtime clear values, and GPU cases. CTest registers host-only coverage and adds the GPU test only on non-Apple platforms.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🟡 Moderate · up to
50945Non-Apple test suites can fail on runners without the required Vulkan support. Make unsupported GPU environments skip this test before merging.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
50945The optimization accepts only narrowly validated complete fills and reuses existing clearing behavior. No introduced security flaw was established, but broader memory-authorization and exceptional-recovery guarantees remain incompletely verified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❓ 1
❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. (2 skipped: 1 unsupported, 1 too large.)
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.@ -662,0 +663,4 @@COMMAND $<TARGET_FILE:shader_recompiler_compute_tests> --dword-pattern-clear-host-only)if(NOT APPLE)add_test(NAME compute_dword_pattern_clear_gpuCOMMAND $<TARGET_FILE:shader_recompiler_compute_tests> --dword-pattern-clear-only)@coderabbitai[bot] on GitHub · 2026-10-06 02:39 UTC · original
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 40400
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 17827
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 18350
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2116
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 435
🏁 Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 222
Skip the GPU test when its Vulkan prerequisites are unavailable.
if(NOT APPLE)registers this test for every non-Apple build. The selected test path constructsVulkanHarness, whose initialization aborts when no Vulkan device is available or no device meets its required feature checks. The test has no CTest skip property, so an unsupported runner can fail the test suite instead of skipping this test. Return a dedicated skip code for unavailable prerequisites and configure this test’sSKIP_RETURN_CODE.@coderabbitai[bot] on GitHub · 2026-10-06 02:39 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
81a23160-0424-43a0-9395-e4f26bd62acc📥 Commits
Reviewing files that changed from the base of the PR and between
cdb64bfd4fand50945f8523.📒 Files selected for processing (5)
CMakeLists.txtsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ir/ShaderIR.htests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Nmzik on GitHub · 2026-10-17 02:27 UTC · original
@juanfariasdev fixed & credited
9202bddad2Thanks!Pull request closed