Fix for Call of Duty Vanguard to get to first mission screen #1961
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!1961
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1961"
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?
@chaitan3 on GitHub · 2026-10-28 13:43 UTC · original
chaitan3:codv_new_debug→main· +1207 −160 · 30 files · 17 commits · openThis branch fixes the memory and descriptor-tracking failures that stopped
Call of Duty: Vanguard while loading the first campaign mission on a 16 GiB
GPU. It is stacked on the cache work from #937 and the sparse
BDA page table from #1270.
Memory and caches:
only after it is exhausted, and force collection at submission boundaries.
loading burst, with larger per-frame eviction budgets.
images can be reclaimed.
texture downloads in a dedicated buffer.
Shaders:
nested sampler-descriptor phis.
loads) as indexed image heaps so the GPU selects the descriptor slot.
genuinely lane-varying state.
Result:
The game reaches the first campaign intro ("HAMBURG 1945") and continues
running at roughly 15.2 GiB VRAM.
Known limitation - this is a hack:
The buffer/texture cache eviction and the transfer of guest buffer mirrors to
host memory are a workaround, not a proper fix. They trade VRAM for PCIe
traffic, re-uploads and eviction churn. A proper solution needs guest-memory
import/zero-copy for buffers, a real residency and eviction policy for images,
and GPU-side selection for lane-varying descriptors.
PS: Not sure from all the cache commits which are necessary to get to the first mission screen as I tried a bunch of commits to get it to that stage.
@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Walkthrough
The changes add pressure-based GPU cache collection, sparse buffer residency, and allocation-time eviction. Shader compilation gains a 64-bit arithmetic-right-shift opcode and expanded descriptor tracking. Runtime library changes affect rwlock destruction, add-on content unmounting, and NP-manager responses.
Suggested reviewers:
nmzik,shadowbeat070,senaxxPriority:
Normal
Change: Bug fix
Merge Risk:
Moderate · up to
ad6d6This change moves Call of Duty: Vanguard toward the first mission, but it introduces GPU resource-lifetime hazards, shader-descriptor test conflicts, and global behavior changes in add-on mounts and NP state. These could cause crashes, wrong rendering, or broken online flows in other titles. Fix the eviction lifetime and test or descriptor-merge issues before merging.
Pre-merge checks:
4 ·
1
Full details: Title check
Explanation
The title names Call of Duty: Vanguard and the goal of reaching the first mission screen, which matches the stated objective. It is specific, but it does not name the main technical changes (memory cache collection, descriptor tracking, shader lane-mask handling). The title is a fair summary of the developer-facing goal, so it passes.
Full details: Description check
Explanation
The pull request description directly matches the changeset. It covers GPU cache eviction, sparse residency, memory pressure handling, descriptor tracking, shader updates, and the reported Vanguard loading result.
Full details: Docstring Coverage
Explanation
Docstring coverage is 11.84% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 76 functions across 28 files. (2 skipped: 2 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
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.@ -327,0 +373,4 @@m_memory_tracker.UntrackMemory(buffer.CpuAddress(), buffer.Size());Unregister(id);ReleaseBuffer(id);}@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5763
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 33950
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 24439
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 5000
Defer allocation-path buffer release until the current tick completes.
PrepareBdasynchronizes BDA ranges but does not updatelast_use_tick. A BDA shader can therefore use a registered buffer while its recorded tick remains free.EvictCleanForAllocationthen callsReleaseBuffer, which can erase the buffer before that GPU work completes.Proposed fix
Committable suggestion
@ -410,0 +463,4 @@m_graphics.GetDeviceMemoryUsage() + AllocationHeadroom >=m_graphics.GetTotalMemoryBudget()) {(void)EvictCleanForAllocation(64ull << 20u);}@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 4769
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 10298
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 6465
Align buffer eviction with the measured heap.
On discrete GPUs,
GetDeviceMemoryUsage()andGetTotalMemoryBudget()include only device-local heaps.MemoryUsage::Uploadrequests host-visible memory. If Vulkan places these buffers in a non-device-local heap,EvictCleanForAllocation(64ull << 20u)frees memory that the pressure gate does not measure. RepeatedCreateBuffercalls can then evict clean buffers without reducing device-local pressure, causing unnecessary re-uploads.Use the allocation's actual heap when deciding whether eviction can relieve pressure, or include the upload heap in the pressure metric.
@ -210,0 +261,4 @@victims.push_back(id);bytes += image->AccountedSize();return bytes >= EVICT_TARGET;});@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 13271
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42843
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42107
Exclude current-tick images from allocation-failure eviction.
FindImagerecords the current scheduler tick. The fallback can select that image becauseForEachItemBelow(clock)includes entries whose tick equalsclock. It then unregisters the image before deferred release, so the current command can lose its resolved image.Finish()waits only through the previous tick.Suggested fix
Committable suggestion
@ -710,0 +783,4 @@const auto condition = first->Arg(0).Resolve();return ValidateRuntimeValue(m_program, condition, RuntimeValueType::Integer) ? condition: Value {};};@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 43435
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 35964
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 26299
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 28628
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9799
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 8951
Restrict
shared_predicateto mask values proven nonzero when the predicate holds.The current shape also matches scalar conditional selects. For example,
S_CSELECT_B64can writeVCCasSelect(SCC, runtime_value, 0)for both halves. IfSCCis true whileruntime_valueis zero,VCCis zero, butshared_predicatereturnsSCCbecause the true arms are not immediate zero. This can select the wrong descriptor.Accept only
EXEC/WQMvalues, or otherwise prove that both true arms are nonzero whenever the shared predicate is true.@ -774,0 +967,4 @@}const auto value = LowerDescriptorValue(inst.Arg(true_arg));return ValidateRuntimeValue(m_program, value) ? value : Value {};}@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 1092
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 42477
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9872
Align the sampler tests with the approximation path.
For sampler descriptors in shaders without memory writes,
MakeSourceenablesm_approximate_sampler_select. WhenDescriptorConditionreturns an empty value, both Phi lowerings select and validate the true-path sampler. The two affected tests still expectPlanAndTrack()to fail.If this approximation is intended, update the tests to expect successful planning, true-path selection, and the one-time approximation log. Otherwise, restrict the approximation to preserve the rejection behavior. The fallback can select the wrong sampler on lanes that take the false path, but it is not silent because it emits a log.
@ -3214,6 +3539,7 @@ private:indirect.table_offset = table_offset;indirect.table_immediate = table_immediate;indirect.table_stride = table_stride;indirect.indexed = plan.table_indexed;@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 2751
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 43001
Allow indexed image sources to share the native heap.
InternSourcestill rejects differentindexedvalues even whenshared_image_heapis true. This prevents scalar and waterfall uses of the same image table from sharing one source. If the sources merge, preserveindexedin the merged descriptor so materialization keeps the indexed heap stride.Suggested fix
@ -281,0 +296,4 @@// alive so later reads succeed. A subsequent mount request returns the// existing mount point instead of allocating another one.LOGF("\t addcont unmount: keeping '%s' mounted (label '%s')\n", point.c_str(),it->label.c_str());@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Release mount slots after unmount.
Each successful unmount retains its bookkeeping entry. After a game mounts and unmounts 64 distinct add-ons, the next distinct mount returns
APP_CONTENT_ERROR_MOUNT_FULL. The repeatable--addcontoption permits such catalogs (src/main.cpp:47–49). (raw.githubusercontent.com)Restrict the retention workaround to affected titles, or otherwise reclaim slots while preserving the required Vanguard paths.
@ -3990,0 +3991,4 @@// signed-in NP user. Without this, games that require PSN sign-in stop at a// "connection failed" dialog instead of falling back to their offline menus.static bool NpSignedInEnabled() {return Config::IsNetworkConnected();@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 1300
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 41948
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 24409
Do not advertise NP online state while HTTP remains a stub.
When host networking is enabled,
NpCheckNpAvailabilityandNpCheckNpReachabilitycomplete successfully. Every valid request passed toHttpSendRequestis then marked and returned asHTTP_ERROR_TIMEOUT. Compared with the base revision, these checks previously returned signed-out, so titles could remain on their offline path. A title that uses successful NP checks to enter an HTTP flow can now take a path that fails at the HTTP call.The Vanguard workaround intentionally enables this state globally. A title-specific opt-in is not established as a project requirement; the inspected configuration exposes only global
network_connectedcontrol. Treat that scope change as a design decision, or keep NP availability consistent with the supported HTTP behavior.@ -4275,2 +4308,4 @@*account_id = 0;if (NpSignedInEnabled()) {*account_id = 0x00000000feedfaceull;@coderabbitai[bot] on GitHub · 2026-10-28 13:54 UTC · original
Do not assign every user the same account ID.
When host networking is enabled, this returns the same account ID for every
user_id.UserServiceGetLoginUserIdListcan expose multiple local users insrc/libs/libUserService.cppLines 88–101. A game that keys profiles by account ID will treat those users as the same account. Restrict the simulated account to the configured user, or provide distinct identities for supported users. (raw.githubusercontent.com)@coderabbitai[bot] on GitHub · 2026-10-28 13:55 UTC · original · reviewed
Actionable comments posted: 9
🔇 Additional comments: 1
962edc6a-b8ec-4108-948d-459133816d87Reviewing files that changed from the base of the PR and between
6c01401862andad6d62dd1a.src/graphics/guest_gpu/graphicsRun.cppsrc/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/pageManager.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/bufferCache.hsrc/graphics/host_gpu/renderer/cache/streamBuffer.cppsrc/graphics/host_gpu/renderer/cache/streamBuffer.hsrc/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.hsrc/graphics/host_gpu/renderer/commandScheduler.cppsrc/graphics/host_gpu/renderer/commandScheduler.hsrc/graphics/host_gpu/renderer/image/image.cppsrc/graphics/host_gpu/renderer/image/image.hsrc/graphics/host_gpu/renderer/pipeline/imageHeap.cppsrc/graphics/host_gpu/renderer/pipeline/imageHeap.hsrc/graphics/host_gpu/renderer/renderContext.cppsrc/graphics/host_gpu/renderer/renderContext.hsrc/graphics/presentation/window/swapchain.cppsrc/graphics/presentation/window/vulkanWindow.cppsrc/graphics/shader/recompiler/frontend/decode/ShaderDecoder.hsrc/graphics/shader/recompiler/frontend/decode/VectorAluOps.cppsrc/graphics/shader/recompiler/frontend/translate/Vector.cppsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppsrc/graphics/shader/recompiler/ir/passes/ResourceTracking.cppsrc/kernel/pthread.cppsrc/libs/libAppContent.cppsrc/libs/network.cpptests/ResourceTrackingTests.cpptests/ShaderRecompilerComputeTests.cpptests/shaderCfgTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@Nmzik on GitHub · 2026-10-29 17:40 UTC · original
@chaitan3 Thanks! All non-shader commits have been cherry-picked (credited ofc)
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.Merge
Merge the changes and update on Forgejo.