Skip to content

fix(agc): the stage-A fast path leaves a view of a pending image whose keys were filled to the full lookup - #249

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:fix/fast-texture-filled-keys
Oct 2, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:fix/fast-texture-filled-keys

Conversation

@MichonGoddijn231849

Copy link
Copy Markdown
Contributor

What

#163's per-read DCC model: after a uniform key fill with a clear code, a sampled read through the surface's keys reads the clear value instead of the image's pending results (cachedTexture, clearThroughKeys). The stage-A fast path (fastTexture) skipped that check. It returned the record's view of the pending image whenever the scanned keys matched the entry's, so a sampled read between the fill and the image's next refresh read the previous results.

The fast path now leaves such a view to the full lookup: when the record's source image has keys filled with a clear code and the read goes through keys (dccAddress != 0). The full lookup then binds the clear or takes its other branches as before. Once the image is refreshed (upload resets filledKeys), the fast path applies again.

GTA V clears its 1280×720 bloom buffer every frame by filling its DCC keys (code 0000). Its composite then samples the buffer through the fast path before the buffer's next refresh, so each frame added onto the last one:

  • the scene luminance went to FP16 max within a second (a white screen);
  • later it alternated between about 19 and 200 from frame to frame (pulsing).

Until now, GTA needed APS5_KEYS_FILL_CLEAR=1 to avoid this.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

…e keys were filled to the full lookup

A sampled read through a surface's keys after a uniform key fill with a clear code reads the
fill's clear value, not the image's pending results (cachedTexture's clear-through-keys). The
stage-A fast path returned the record's view of the pending image without that check, so a
read between the fill and the image's next refresh saw the previous results.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the agc libSceAgc* label Oct 1, 2026
@boykopovar
boykopovar merged commit fbfe6bb into boykopovar:main Oct 2, 2026
3 checks passed
oneandonlydean added a commit to oneandonlydean/AnyPS5 that referenced this pull request Oct 2, 2026
…opovar#251 execution tests, NGS2/audio boykopovar#236-boykopovar#248, boykopovar#249, boykopovar#292, our boykopovar#246) into astrobot

Conflicts:
- tests/Recorder.cpp: our boykopovar#246 commit is already on astrobot (3a494ec) along
  with the later key-fill tests, so ours is kept; every line upstream's boykopovar#246
  added is present once.
- RdnaOpcode.hpp: upstream's order (SClause before SCbranchCdbg, then the cache
  and perf-hint no-ops).
- SpirvAluEmitterMath.cpp: v_writelane fix landed on both sides with the same
  semantics; ours kept.
- libSceNgs2.native: upstream's NGS2 (system, racks, voices, ATRAC9, tests)
  replaces astrobot's single-file port. Astro Bot imports no NGS2 functions.
  Upstream left the Geom and Pan helpers as throwing stubs, so astrobot's
  working versions move to src/GeomPan.cpp in place of Unimplemented.cpp.
  libSceNgs2's stub layer and VerboseLog.hpp (used only by the old port) go.
- TechnicalDebt.md: both entries kept.

boykopovar#143 (NGG passthrough) stays as on astrobot: upstream did not touch its files
since the boykopovar#258 revert. The recompile request serialization stays at version 7.
@MichonGoddijn231849
MichonGoddijn231849 deleted the fix/fast-texture-filled-keys branch October 9, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants