Fix GTA V boot-time text glyph loss #449
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!449
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/449/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?
@CheesyPoofs346 on GitHub · 2026-09-02 00:41 UTC · original
CheesyPoofs346:gta5-text-fix→main· +335 −3 · 6 files · 1 commits · closed without mergingSummary
Problem
In Grand Theft Auto V (PPSA04264), the boot/legal screen and the UI shown before gameplay rendered only scattered glyphs. Characters remained at their correct positions, but most glyphs were invisible; for example,
Performanceappeared asf manc. The in-game settings screen could render correctly, so this was not a missing-font-file problem.The same font atlas was available to other text draws in the same frame, which ruled out missing glyph assets. The surviving characters also preserved their original spacing, ruling out displaced geometry. The failure was specific to the boot-time rendering path.
Cause
The boot font compute shader reads its glyph source through buffer device address (BDA). During the one-shot boot atlas build, dynamically referenced source pages could be read before they had been materialized in the buffer cache. Those reads returned unavailable or zero data, leaving the affected glyphs invisible.
A second cache issue could merge the atlas storage image and its differently formatted sampled view. The text atlas uses an R8 integer storage view and an R8 normalized sampled view; treating those as one image owner could leave the sampled view with stale or incorrectly interpreted contents.
Fix
PrepareBdaRange, which page-aligns and materializes only mapped pages in a bounded range before synchronizing BDA resources.The prefetch is bounded and targeted to the identified boot-font dispatch; normal DMA dispatches retain the existing BDA preparation path.
Verification
ninja -C _Build/profile-buffer-readback shader_recompiler_compute_testsninja -C _Build/profile-buffer-readback kyty_emulatorshader_recompiler_compute_tests.exe --bda-prefetch-onlyAI assistance was used for this change.
@CheesyPoofs346 on GitHub · 2026-09-02 00:44 UTC · original
Closing this GTA V-specific version; a generalized BDA prefetch implementation will replace it.
@chatgpt-codex-connector[bot] on GitHub · 2026-09-02 00:45 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
942e7914b6ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -334,3 +334,3 @@FindBuffers(bindings);if (program.info.uses_dma) {m_context.GetGpuResources().PrepareBda();if (sh_ctx.GetCs().cs_regs.data_addr == 0x0000000242d47200ull &&@chatgpt-codex-connector[bot] on GitHub · 2026-09-02 00:45 UTC · original
When another GTA V build or runtime allocation places this same compute shader at a different guest virtual address, the equality check fails and the dispatch falls back to ordinary
PrepareBda(), so the source pages responsible for the missing glyphs are never materialized. The already-availableprogram.shader_hashor stable shader characteristics should identify this dispatch instead of the observed address from one executable layout.Useful? React with 👍 / 👎.
@ -337,0 +342,4 @@if (source >= prefetch_before) {m_context.GetGpuResources().PrepareBdaRange(source - prefetch_before, prefetch_before + prefetch_after);}@chatgpt-codex-connector[bot] on GitHub · 2026-09-02 00:45 UTC · original
For this selected shader, if the decoded source is nonzero but below
0x40000, this branch performs neitherPrepareBdaRange()nor the previousPrepareBda(). A dispatch using a mapped low BDA address therefore loses all BDA synchronization, not merely the optional preceding-range prefetch; this path should fall back to normal BDA preparation when the prefix cannot be subtracted.Useful? React with 👍 / 👎.
@ -337,0 +345,4 @@}} else {m_context.GetGpuResources().PrepareBda();}@Copilot on GitHub · 2026-09-02 00:46 UTC · original
When the GTA V boot-font dispatch is detected but the computed
sourceis belowprefetch_before, no BDA preparation is performed at all (the innerif (source >= prefetch_before)falls through without callingPrepareBdaRangeorPrepareBda). This leaves the DMA path without the required BDA synchronization for that dispatch.@ -7000,0 +7031,4 @@auto &buffers = resources.GetBufferCache();Require(name, "mapped source pages",buffers.IsRegionRegistered(base + 0x4000, 0x10000),"BDA source pages were not materialized before dispatch");@Copilot on GitHub · 2026-09-02 00:46 UTC · original
IsRegionRegistered()only checks whether any cached buffer intersects the range, so this assertion can pass even if only a single page was materialized. To validatePrepareBdaRange, the test should verify that every page covering[source, source+size)is registered.@copilot-pull-request-reviewer[bot] on GitHub · 2026-09-02 00:46 UTC · original · reviewed
🟡 Changes recommended
The DMA dispatch path can skip BDA preparation in a valid control-flow case, and the new tests include assertions that don’t reliably validate the intended publication/materialization behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR addresses GTA V boot-time text glyph loss by ensuring buffer device address (BDA) source pages are materialized before a one-shot compute dispatch, and by preventing R8 storage-image and R8 sampled-view cache owners from being merged when their numeric formats differ.
Changes:
GpuResourceManager::PrepareBdaRange()and applies a targeted prefetch for the identified GTA V boot-font DMA compute dispatch.File summaries
PrepareBdaRange()API.Review details
Suppressed comments (1)
tests/ShaderRecompilerComputeTests.cpp:7125
💡 Add a
code-reviewagent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.@ -7000,0 +7075,4 @@&mapped, allocation_size, 0x3, 0x10, direct_offset,0x200000) == 0 && mapped == reinterpret_cast<void *>(base),"storage/sample fixed mapping failed");std::memset(mapped, 0x7f, atlas_size);@Copilot on GitHub · 2026-09-02 00:46 UTC · original
This initializes the guest backing to 0x7f, which makes the later "publication" assertion indistinguishable from the initial state. Initializing to 0 makes it possible to detect whether a later publication/readback actually overwrote guest memory.
This issue also appears on line 7121 of the same file.
@ -3,1 +3,4 @@#include "common/assert.h"#include <cstdio>#include <chrono>#include <atomic>@Copilot on GitHub · 2026-09-02 00:46 UTC · original
The newly added standard headers (, , ) are unused in this translation unit, and should be removed to avoid unnecessary includes and potential warning noise.
Pull request closed