shader: support compute stores through V#s read from a descriptor table #931

Closed
github-bot wants to merge 1 commit from gh-pr/931/head into gh-pr/931/base
Owner

@⁠TheCruZ on GitHub · 2026-09-29 22:07 UTC · original
pr/vsharp-table-stores → main · +1304 −69 · 22 files · 1 commits · closed without merging

Summary

Fixes the emulator exiting with buffer descriptor is not a valid runtime value when Grand Theft Auto V (PPSA04263) enters Story mode in Fidelity mode (ray tracing). The failing shaders are skinning compute shaders that only run in that mode and feed the ray-tracing BVH, Performance mode never dispatches them.

Problem

The skinning compute shaders pick their output buffer per wave: a waterfall loop reads a key with V_READFIRSTLANE, loads the store V# with S_BUFFER_LOAD_DWORDX4 from a table of V#s at key * 16, and stores through it.

Resource tracking only accepted GPU-selected V#s for raw DWORD loads, so the store V# was not a valid runtime value and the dispatch failed.

Change

Shader. Resource tracking recognizes a store V# whose DWORDs are consecutive reads of one bound table at (key << 4) + offset, in compute stages only, other untrackable descriptors still fail with a clear message. The SPIR-V store resolves the V# per lane with the same address and bounds rules as the existing indirect loads and writes through BDA.

Every target is cached before the dispatch. BDA only reaches memory that a cached buffer holds, so a store to any other memory would be dropped. In GTA V the table is the game's 2 MiB descriptor heap (131072 entries, about 40000 buffer V#s over 600 MiB), prepared about 150 times a second. IndirectWriteTables keeps a snapshot of each table and only rescans the pages the CPU wrote since the previous preparation (MemoryTracker::ConsumeCpuWrites, fed by a per-page bit set when a page becomes CPU dirty), so an unchanged table costs a few microseconds. Targets sharing a caching page become one buffer, targets released by the garbage collector or mapped later are cached again. T#s, S#s, V#s without a data format (the shader drops those stores) and unmapped targets are skipped, and a table the unchanged table costs a few microseconds. Targets sharing a caching page become one buffer, targets released by the garbage collector or mapped later are cached again. T#s, S#s, V#s without a data format (the shader drops those stores) and unmapped targets are skipped, and a table the GPU wrote is downloaded first.

The GPU reports what it wrote. Each store sets the bit of its caching page in a write bitmap in the second half of the fault buffer. After the submission completes, the bitmap is read back like the faults: the written bytes of the targets become GPU modified and images over them are invalidated as for any other buffer write, while pages the CPU dirtied meanwhile keep the CPU's bytes. Nothing is marked written before the dispatch, so buffers the CPU keeps writing are not read-protected. The fault-buffer parser now also skips empty words and keeps pages it has no room for until its next pass instead of dropping them.

Measured in GTA V (Fidelity): uncovered target pages ~21000 → 0, BDA accesses to uncached memory 463 → 0 per run, preparation cost per dispatch ~520 µs (first capped version) → 3-7 µs. The first preparation caches about 2000 target groups (~330 MiB) once, in ~150 ms.

Relation to #690

#690 targets the same failure (see #507, #548, #810) with a more general approach: any V# derived from memory becomes a dynamic buffer resolved per lane in the shader. This PR differs in that the host caches every target before the dispatch (so no store is dropped) and learns from the GPU which bytes were written (so later CPU reads and uploads stay coherent), and it adds no GPU waits, whereas #690 adds FlushAndWait() after every direct compute dispatch. #690 covers more access kinds (sub-DWORD, add_tid, swizzle, graphics stages).

Before After
image image

Testing

  • Grand Theft Auto V (PPSA04263), Fidelity mode: with this PR and #927, Story mode loads and the game is playable, skinned characters and vehicles render correctly.
  • resource_tracking_tests: table-selected store V#s are tracked as indirect stores, graphics stages still reject them.
  • shader_recompiler_compute_tests: BufferStoresGpuSelectedDescriptors (--indirect-buffer-only) runs stores through GPU-selected V#s on the GPU and checks the write bitmap, IndirectWriteTables (--indirect-write-tables-only) covers target coverage, incremental rescans, GC and late-mapped targets and the write marking. All 479 cases pass.
  • memory_tracker_tests: CPU-write consumption and GPU marking that skips CPU-dirty pages.
  • Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090.

AI usage

AI (Claude Opus 5.5) was used to investigate the issue and to implement the change. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my GTA V fork, i will be bringing PRs here after test them enough.

**@⁠TheCruZ** on GitHub · 2026-09-29 22:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931) `pr/vsharp-table-stores` → `main` · +1304 −69 · 22 files · 1 commits · closed without merging ## Summary Fixes the emulator exiting with `buffer descriptor is not a valid runtime value` when Grand Theft Auto V (PPSA04263) enters Story mode in Fidelity mode (ray tracing). The failing shaders are skinning compute shaders that only run in that mode and feed the ray-tracing BVH, Performance mode never dispatches them. ## Problem The skinning compute shaders pick their output buffer per wave: a waterfall loop reads a key with `V_READFIRSTLANE`, loads the store V# with `S_BUFFER_LOAD_DWORDX4` from a table of V#s at `key * 16`, and stores through it. Resource tracking only accepted GPU-selected V#s for raw DWORD loads, so the store V# was not a valid runtime value and the dispatch failed. ## Change **Shader.** Resource tracking recognizes a store V# whose DWORDs are consecutive reads of one bound table at `(key << 4) + offset`, in compute stages only, other untrackable descriptors still fail with a clear message. The SPIR-V store resolves the V# per lane with the same address and bounds rules as the existing indirect loads and writes through BDA. **Every target is cached before the dispatch.** BDA only reaches memory that a cached buffer holds, so a store to any other memory would be dropped. In GTA V the table is the game's 2 MiB descriptor heap (131072 entries, about 40000 buffer V#s over 600 MiB), prepared about 150 times a second. `IndirectWriteTables` keeps a snapshot of each table and only rescans the pages the CPU wrote since the previous preparation (`MemoryTracker::ConsumeCpuWrites`, fed by a per-page bit set when a page becomes CPU dirty), so an unchanged table costs a few microseconds. Targets sharing a caching page become one buffer, targets released by the garbage collector or mapped later are cached again. T#s, S#s, V#s without a data format (the shader drops those stores) and unmapped targets are skipped, and a table the unchanged table costs a few microseconds. Targets sharing a caching page become one buffer, targets released by the garbage collector or mapped later are cached again. T#s, S#s, V#s without a data format (the shader drops those stores) and unmapped targets are skipped, and a table the GPU wrote is downloaded first. **The GPU reports what it wrote.** Each store sets the bit of its caching page in a write bitmap in the second half of the fault buffer. After the submission completes, the bitmap is read back like the faults: the written bytes of the targets become GPU modified and images over them are invalidated as for any other buffer write, while pages the CPU dirtied meanwhile keep the CPU's bytes. Nothing is marked written before the dispatch, so buffers the CPU keeps writing are not read-protected. The fault-buffer parser now also skips empty words and keeps pages it has no room for until its next pass instead of dropping them. Measured in GTA V (Fidelity): uncovered target pages ~21000 → 0, BDA accesses to uncached memory 463 → 0 per run, preparation cost per dispatch ~520 µs (first capped version) → 3-7 µs. The first preparation caches about 2000 target groups (~330 MiB) once, in ~150 ms. ## Relation to #690 #690 targets the same failure (see #507, #548, #810) with a more general approach: any V# derived from memory becomes a dynamic buffer resolved per lane in the shader. This PR differs in that the host caches every target before the dispatch (so no store is dropped) and learns from the GPU which bytes were written (so later CPU reads and uploads stay coherent), and it adds no GPU waits, whereas #690 adds `FlushAndWait()` after every direct compute dispatch. #690 covers more access kinds (sub-DWORD, add_tid, swizzle, graphics stages). | **Before** | **After** | :-------------------------:|:-------------------------: <img width="2265" height="53" alt="image" src="https://github.com/user-attachments/assets/2b74a3ce-9831-4481-a216-79d1d7a2c391" /> | <img width="1286" height="760" alt="image" src="https://github.com/user-attachments/assets/08b29eca-7c3b-482a-b306-271ebc596972" /> ## Testing - Grand Theft Auto V (PPSA04263), Fidelity mode: with this PR and #927, Story mode loads and the game is playable, skinned characters and vehicles render correctly. - `resource_tracking_tests`: table-selected store V#s are tracked as indirect stores, graphics stages still reject them. - `shader_recompiler_compute_tests`: `BufferStoresGpuSelectedDescriptors` (`--indirect-buffer-only`) runs stores through GPU-selected V#s on the GPU and checks the write bitmap, `IndirectWriteTables` (`--indirect-write-tables-only`) covers target coverage, incremental rescans, GC and late-mapped targets and the write marking. All 479 cases pass. - `memory_tracker_tests`: CPU-write consumption and GPU marking that skips CPU-dirty pages. - Tested on Windows 11 with AMD Ryzen 5900x and RTX 3090. ## AI usage AI (Claude Opus 5.5) was used to investigate the issue and to implement the change. I reviewed the code, understand it, tested it as described above, and wrote this description myself, in general fully tested the game while doing few missions and playing in-game with my [GTA V fork](https://github.com/TheCruZ/KytyPS5-GTA), i will be bringing PRs here after test them enough.
GTA V's (PPSA04263) skinning compute shaders pick their output buffer per
wave: a waterfall loop reads a key with V_READFIRSTLANE, loads the store
V# with S_BUFFER_LOAD_DWORDX4 from a table of V#s at key * 16, and stores
through it. Resource tracking only accepted GPU-selected V#s for raw DWORD
loads, so the dispatch failed with "buffer descriptor is not a valid
runtime value". The shaders run in Fidelity mode and feed the ray-tracing
BVH.

Recognize a store V# whose DWORDs are consecutive reads of one table at
(key << 4) + offset, mark its memory IndirectBuffer and the table binding
as selecting written targets. The SPIR-V store resolves the V# per lane
with the same address and bounds rules as indirect loads and writes
through BDA, which only reaches memory that a cached buffer holds.
Graphics stages are not supported and keep failing.

Before the dispatch, IndirectWriteTables caches every target the table
names, so that no store is dropped. In GTA V the table is the game's
2 MiB descriptor heap (131072 entries, about 40000 buffer V#s over
600 MiB) and it is prepared about 150 times a second. Each table keeps a
snapshot and only rescans the pages the CPU wrote since the previous
preparation (MemoryTracker::ConsumeCpuWrites, fed by a per-page bit set
whenever a page becomes CPU dirty), so an unchanged table costs a few
microseconds. Targets that share a caching page are cached as one
buffer. Targets whose buffers the garbage collector released, or whose
memory was not mapped yet, are cached again later. T#s, S#s, V#s
without a data format (the shader drops those stores) and unmapped
targets are skipped; a target covers the whole DWORDs its stores write.
A table the GPU wrote is downloaded first. The targets are prepared
before PrepareBda, which uploads the CPU writes of the new buffers.

Which bytes the stores wrote comes back from the GPU: each store sets the
bit of its caching page in a write bitmap in the second half of the fault
buffer (an atomic OR only when the bit is clear). Once the submission
completed, the bitmap is read back like the faults; the written bytes of
the targets become GPU modified, and images over them are invalidated as
for other buffer writes. Pages the CPU dirtied since keep the CPU's
bytes. The fault-buffer parser skips empty words and leaves the pages it
has no room for in the bitmap for its next pass instead of dropping them.

A dispatch that prepared targets gets the shader write hazard barrier.

Tests: resource tracking of table-selected store V#s,
BufferStoresGpuSelectedDescriptors (stores and write bitmap,
--indirect-buffer-only), IndirectWriteTables
(--indirect-write-tables-only) and the memory tracker's CPU-write and
GPU-marking helpers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:37:13 +00:00
github-bot closed this pull request 2026-11-26 09:37:13 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 22:15 UTC · original · edited 2026-10-08 21:14 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The changes add compute-stage support for GPU-selected indirect DWORD stores. Resource tracking identifies V# descriptor tables and links them to bound buffers. The SPIR-V emitter writes active indirect-buffer components and records written-page bits. The renderer tracks CPU and GPU page ownership, processes fault and write bitmaps, and prepares indirect-write table targets during compute dispatch. Tests cover resource tracking, buffer stores, write-bit reporting, and table tracking.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🟡 Moderate · up to 4b326

The change allows compute shaders to write through descriptor-table-selected buffers. Several open issues can still leave written data or textures stale. One is a table read failure that is never retried. Another is writes to image aliases. A third is preparation limits that skip valid targets. These issues can cause rendering corruption in affected games, so they should be resolved or explicitly accepted before merging.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to c87fa

The new write capability can leave modified bytes incompletely tracked or allow later reads to use stale data. The demonstrated impact concerns emulated workload data; broader host-memory exposure has not been established. Data ownership and recovery need attention.

Retained concerns

  • Medium · reliability · inferred: The new write-reporting path narrows reported pages to descriptor-sized target intervals, although emitted stores can legally write outside those intervals. For example, bounds mode 2 accepts any nonzero record count: a zero-stride descriptor with one record can store a DWORD at offset 4, while TargetRange records only one byte at its base. Absolute DWORD alignment can also write before an unaligned descriptor base. When the reported page intersects a target, NoteWrites omits the remaining bytes rather than using its whole-page fallback. NoteGpuWrites and subsequent downloads therefore need not preserve every byte actually written. This breaks the CPU/GPU ownership handoff and can discard changes during readback or reclamation.
  • Medium · reliability · inferred: The new caller reports arbitrary target intersections to an existing GPU invalidation operation that ignores overlapping images unless their base equals the reported address. Subrange writes can consequently leave an overlapping native image current according to its flags. Even a matching-base multisampled image can remain stale: invalidation marks it buffer-modified, but InitializeImage returns without uploading it and FindTexture can still return its native view. Ordinary matching-base, uncompressed, single-sample images do have a refresh path. The consumer limitations predate this PR, but the newly supported indirect stores expose them through a new state-ownership transfer.
Security review details

Security Blast Radius

  • inferred — The sensitive outcome is a physical-address GPU write to host-managed representations of guest memory. For in-range page translations, the demonstrated scope is cached guest-buffer pages owned by the rendering context. Translation is not restricted to a descriptor's exact byte interval; broader host-memory access or privilege gain is not established.

Security Findings and Attack Paths

  • inferred — A guest controlling compute descriptors and offsets can exercise the write-footprint mismatch without host privileges. Permitted stores can modify bytes absent from the exact dirty intervals, or modify image backing without a corresponding usable refresh. These are state-ownership and consistency failures; the inspected paths do not establish a host escape.

Trust Boundaries and Controls

  • observed — Guest addresses become physical pointers through a host-populated page table. A zero translation records a fault and suppresses the store. Each component is translated independently after DWORD alignment, preventing an individual DWORD from crossing a caching-page boundary. CPU-dirty pages are excluded from the later GPU-ownership update.

Resilience and Maintainability Implications

  • observed — Buffer reclamation publishes queued dirty-buffer downloads before clearing ownership. Write readback waits before reusing a reader slot, caps host consumption to its capacity, and retains unreported source bits. These controls reduce loss and reuse hazards, but do not resolve the exact-byte accounting or image-alias handoff concerns.

Hardening Proposals

  • proposed — Define one writable-footprint contract shared by descriptor preparation, emitted addressing, and ownership reconciliation, including alignment and bounds modes. Make image handoff overlap-aware and require each affected representation either to refresh successfully or reject the unsupported access before reuse.
🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 13.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 21 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the compute-store failure, the table-selected V# support, GPU write tracking, testing, and performance results. It is directly related to the changeset.
Title check ✅ Passed The title clearly and concisely identifies the main change: support for compute stores through V#s read from a descriptor table.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 21 files. (1 skipped: 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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#issuecomment-5900131123) · edited 2026-10-08 21:14 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/931?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The changes add compute-stage support for GPU-selected indirect DWORD stores. Resource tracking identifies V# descriptor tables and links them to bound buffers. The SPIR-V emitter writes active indirect-buffer components and records written-page bits. The renderer tracks CPU and GPU page ownership, processes fault and write bitmaps, and prepares indirect-write table targets during compute dispatch. Tests cover resource tracking, buffer stores, write-bit reporting, and table tracking. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"4b326c8b709633f60c4c9d181620baefaafbdb89" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **🟡 Moderate** · up to `4b326` <!-- final_review_risk_coverage:{"sourceCommitId":"4b326c8b709633f60c4c9d181620baefaafbdb89","coveredCommitId":"4b326c8b709633f60c4c9d181620baefaafbdb89","kind":"reviewed"} --> The change allows compute shaders to write through descriptor-table-selected buffers. Several open issues can still leave written data or textures stale. One is a table read failure that is never retried. Another is writes to image aliases. A third is preparation limits that skip valid targets. These issues can cause rendering corruption in affected games, so they should be resolved or explicitly accepted before merging. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🟡 Moderate_ · up to `c87fa` The new write capability can leave modified bytes incompletely tracked or allow later reads to use stale data. The demonstrated impact concerns emulated workload data; broader host-memory exposure has not been established. Data ownership and recovery need attention. **Retained concerns** - **Medium · reliability · inferred:** The new write-reporting path narrows reported pages to descriptor-sized target intervals, although emitted stores can legally write outside those intervals. For example, bounds mode 2 accepts any nonzero record count: a zero-stride descriptor with one record can store a DWORD at offset 4, while TargetRange records only one byte at its base. Absolute DWORD alignment can also write before an unaligned descriptor base. When the reported page intersects a target, NoteWrites omits the remaining bytes rather than using its whole-page fallback. NoteGpuWrites and subsequent downloads therefore need not preserve every byte actually written. This breaks the CPU/GPU ownership handoff and can discard changes during readback or reclamation. - **Medium · reliability · inferred:** The new caller reports arbitrary target intersections to an existing GPU invalidation operation that ignores overlapping images unless their base equals the reported address. Subrange writes can consequently leave an overlapping native image current according to its flags. Even a matching-base multisampled image can remain stale: invalidation marks it buffer-modified, but InitializeImage returns without uploading it and FindTexture can still return its native view. Ordinary matching-base, uncompressed, single-sample images do have a refresh path. The consumer limitations predate this PR, but the newly supported indirect stores expose them through a new state-ownership transfer. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The sensitive outcome is a physical-address GPU write to host-managed representations of guest memory. For in-range page translations, the demonstrated scope is cached guest-buffer pages owned by the rendering context. Translation is not restricted to a descriptor's exact byte interval; broader host-memory access or privilege gain is not established. **Security Findings and Attack Paths** - _inferred_ — A guest controlling compute descriptors and offsets can exercise the write-footprint mismatch without host privileges. Permitted stores can modify bytes absent from the exact dirty intervals, or modify image backing without a corresponding usable refresh. These are state-ownership and consistency failures; the inspected paths do not establish a host escape. **Trust Boundaries and Controls** - _observed_ — Guest addresses become physical pointers through a host-populated page table. A zero translation records a fault and suppresses the store. Each component is translated independently after DWORD alignment, preventing an individual DWORD from crossing a caching-page boundary. CPU-dirty pages are excluded from the later GPU-ownership update. **Resilience and Maintainability Implications** - _observed_ — Buffer reclamation publishes queued dirty-buffer downloads before clearing ownership. Write readback waits before reusing a reader slot, caps host consumption to its capacity, and retains unreported source bits. These controls reduce loss and reuse hazards, but do not resolve the exact-byte accounting or image-alias handoff concerns. **Hardening Proposals** - _proposed_ — Define one writable-footprint contract shared by descriptor preparation, emitted addressing, and ownership reconciliation, including alignment and bounds modes. Make image handoff overlap-aware and require each affected representation either to refresh successfully or reject the unsupported access before reuse. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❓ 1</summary> ### ❌ Failed checks (1 inconclusive) | Check name | Status | Explanation | Resolution | | :---------------- | :------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ❓ Inconclusive | Docstring coverage is 13.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 21 files. (1 skipped:… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ✅ Passed | The description clearly explains the compute-store failure, the table-selected V# support, GPU write tracking, testing, and performance results. It is directly related to the changeset. | | Title check | ✅ Passed | The title clearly and concisely identifies the main change: support for compute stores through V#s read from a descriptor table. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> <details> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 13.25% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 83 functions across 21 files. (1 skipped: 1 too large.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=931)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 22:15 UTC · original · edited 2026-09-30 08:10 UTC
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1858 (outdated):

@@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) {
 		if (!image.Overlaps(address, size)) {
 			continue;
 		}
+		// Invalidation replaces the native contents with the buffer's bytes, which never received
+		// this image's GPU writes. For a write that may not happen, keep the native contents.
+		if (possible_write && (image.IsGpuModified() || image.depth_id)) {

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Track actual writes to GPU-modified image aliases.

If the shader selects a V# that aliases a GPU-modified image, this branch skips the only texture-cache notification for that target. The buffer store can then change the backing buffer while RefreshImage still treats the native image as current. A later texture read can return the old image contents. Preserve the image’s existing GPU writes before dispatch, but mark an image stale when the selected target is written.

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4138887442) · edited 2026-09-30 08:10 UTC On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1858 (outdated): ```diff @@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) { if (!image.Overlaps(address, size)) { continue; } + // Invalidation replaces the native contents with the buffer's bytes, which never received + // this image's GPU writes. For a write that may not happen, keep the native contents. + if (possible_write && (image.IsGpuModified() || image.depth_id)) { ``` _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _🏗️ Heavy lift_ **Track actual writes to GPU-modified image aliases.** If the shader selects a V# that aliases a GPU-modified image, this branch skips the only texture-cache notification for that target. The buffer store can then change the backing buffer while `RefreshImage` still treats the native image as current. A later texture read can return the old image contents. Preserve the image’s existing GPU writes before dispatch, but mark an image stale when the selected target is written. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:52da656b5db37a9037c74189 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 22:15 UTC · original · edited 2026-09-30 08:11 UTC
On src/graphics/host_gpu/renderer/renderCompute.cpp line 58 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Prepare every target the shader can select.

The host scans at most 4096 table entries and rejects targets larger than 256 MiB. The emitted store has no corresponding limits. If a shader selects a later entry or writes within a larger valid target, the host does not prepare its BDA range, so the store can be dropped. Scan large tables in bounded chunks and prepare valid target ranges without excluding shader-reachable addresses.

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4138887447) · edited 2026-09-30 08:11 UTC On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 58 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; ``` _🎯 Functional Correctness_ | _🟠 Major_ | _🏗️ Heavy lift_ **Prepare every target the shader can select.** The host scans at most 4096 table entries and rejects targets larger than 256 MiB. The emitted store has no corresponding limits. If a shader selects a later entry or writes within a larger valid target, the host does not prepare its BDA range, so the store can be dropped. Scan large tables in bounded chunks and prepare valid target ranges without excluding shader-reachable addresses. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:a757c9e9812b08ddc3015521 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 22:15 UTC · original · edited 2026-09-30 08:10 UTC
On src/graphics/host_gpu/renderer/renderCompute.cpp line 93 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;
+	const auto&        program         = *bindings.runtime->program;
+	const auto&        layout          = program.bindings;
+	if (layout.memory_offset_count == 0) {
+		return false;
+	}
+	// Buffer sources follow the bound resources, which leave out buffers the shader never
+	// accesses, not the shader's buffer list.
+	const auto& resources = layout.descriptors.front().resources;
+	bool        prepared  = false;
+	for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) {
+		const auto& resource = program.info.buffers[resources[i]];
+		const auto& table    = bindings.buffer_sources[i];
+		if (!resource.indirect_write_table || table.address == 0 ||
+		    table.size <= resource.indirect_table_offset) {
+			continue;
+		}
+		const auto available =
+		    (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource);
+		if (available > MaxTableEntries) {
+			static bool logged = false;
+			if (!logged) {
+				logged = true;
+				LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64
+				     " entries; stores through entries past %" PRIu64 " are dropped\n",
+				     table.address, available, MaxTableEntries);
+			}
+		}
+		const auto                        entries = std::min<uint64_t>(available, MaxTableEntries);
+		std::vector<ShaderBufferResource> targets(entries);
+		const auto                        address = table.address + resource.indirect_table_offset;
+		const auto                        bytes   = entries * sizeof(ShaderBufferResource);
+		if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) &&
+		    !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) {
+			LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address);
+			continue;

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect the read contracts and GPU-dirty handling without running repository code.
rg -n -C 6 'TryReadGpuCleanBacking\s*\(|TryReadBacking\s*\(' \
  -g '*.cpp' -g '*.h' .
rg -n -C 5 'IsRegionGpuModified\s*\(|HasGpuDirtyBytes\s*\(|ReadMemory\s*\(' \
  -g '*.cpp' -g '*.h' .

Repository: KytyPS5/KytyPS5

Length of output: 42126


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- renderCompute.cpp changed path ---'
cat -n src/graphics/host_gpu/renderer/renderCompute.cpp | sed -n '1,145p'
printf '%s\n' '--- TryReadBacking declarations and implementations ---'
rg -n -C 12 'TryReadBacking\s*\(' src -g '*.cpp' -g '*.h' -g '!renderCompute.cpp'
printf '%s\n' '--- GPU dirty/readback call sites relevant to dispatch ---'
rg -n -C 8 'TryReadGpuCleanBacking|ReadMemory\(|InvalidateMemoryFromGPU|MarkRegionAsGpuModified|PrepareIndirectWriteTargets' src/graphics src/kernel -g '*.cpp' -g '*.h'

Repository: KytyPS5/KytyPS5

Length of output: 42022


Do not fall back to unsynchronized backing for a GPU-dirty table.

When TryReadGpuCleanBacking rejects a GPU-dirty table, the code immediately calls TryReadBacking, which does not perform cache readback. It can read stale descriptors. PrepareIndirectWriteTargets can then omit a target selected by the shader, so the target is not passed to ObtainBuffer or InvalidateMemoryFromGPU. Synchronize the table before scanning it when GPU-dirty state causes the clean read to fail.

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4138887450) · edited 2026-09-30 08:10 UTC On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 93 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; + const auto& program = *bindings.runtime->program; + const auto& layout = program.bindings; + if (layout.memory_offset_count == 0) { + return false; + } + // Buffer sources follow the bound resources, which leave out buffers the shader never + // accesses, not the shader's buffer list. + const auto& resources = layout.descriptors.front().resources; + bool prepared = false; + for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) { + const auto& resource = program.info.buffers[resources[i]]; + const auto& table = bindings.buffer_sources[i]; + if (!resource.indirect_write_table || table.address == 0 || + table.size <= resource.indirect_table_offset) { + continue; + } + const auto available = + (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource); + if (available > MaxTableEntries) { + static bool logged = false; + if (!logged) { + logged = true; + LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64 + " entries; stores through entries past %" PRIu64 " are dropped\n", + table.address, available, MaxTableEntries); + } + } + const auto entries = std::min<uint64_t>(available, MaxTableEntries); + std::vector<ShaderBufferResource> targets(entries); + const auto address = table.address + resource.indirect_table_offset; + const auto bytes = entries * sizeof(ShaderBufferResource); + if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) && + !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) { + LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address); + continue; ``` _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect the read contracts and GPU-dirty handling without running repository code. rg -n -C 6 'TryReadGpuCleanBacking\s*\(|TryReadBacking\s*\(' \ -g '*.cpp' -g '*.h' . rg -n -C 5 'IsRegionGpuModified\s*\(|HasGpuDirtyBytes\s*\(|ReadMemory\s*\(' \ -g '*.cpp' -g '*.h' . ``` Repository: KytyPS5/KytyPS5 Length of output: 42126 --- 🏁 Script executed: ```bash #!/bin/bash set -e printf '%s\n' '--- renderCompute.cpp changed path ---' cat -n src/graphics/host_gpu/renderer/renderCompute.cpp | sed -n '1,145p' printf '%s\n' '--- TryReadBacking declarations and implementations ---' rg -n -C 12 'TryReadBacking\s*\(' src -g '*.cpp' -g '*.h' -g '!renderCompute.cpp' printf '%s\n' '--- GPU dirty/readback call sites relevant to dispatch ---' rg -n -C 8 'TryReadGpuCleanBacking|ReadMemory\(|InvalidateMemoryFromGPU|MarkRegionAsGpuModified|PrepareIndirectWriteTargets' src/graphics src/kernel -g '*.cpp' -g '*.h' ``` Repository: KytyPS5/KytyPS5 Length of output: 42022 --- </details> **Do not fall back to unsynchronized backing for a GPU-dirty table.** When `TryReadGpuCleanBacking` rejects a GPU-dirty table, the code immediately calls `TryReadBacking`, which does not perform cache readback. It can read stale descriptors. `PrepareIndirectWriteTargets` can then omit a target selected by the shader, so the target is not passed to `ObtainBuffer` or `InvalidateMemoryFromGPU`. Synchronize the table before scanning it when GPU-dirty state causes the clean read to fail. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:fbaaed9360f14bf0e8b60e2d --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-29 22:15 UTC · original · reviewed

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 921d79c7-beca-431c-addd-3680bd114a66

📥 Commits

Reviewing files that changed from the base of the PR and between 05057c9441 and 0a4e916ec65379fb4e72bb952b16d9aebadfc7b5.

📒 Files selected for processing (10)
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/ir/Program.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • tests/ResourceTrackingTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-29 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#pullrequestreview-5359201837) · **reviewed** **Actionable comments posted: 3** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `921d79c7-beca-431c-addd-3680bd114a66` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 05057c9441dbf3972d49f9143b90213a43a01a00 and 0a4e916ec65379fb4e72bb952b16d9aebadfc7b5. </details> <details> <summary>📒 Files selected for processing (10)</summary> * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/ir/Program.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `tests/ResourceTrackingTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠TheCruZ on GitHub · 2026-09-30 07:59 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1858 (outdated):

@@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) {
 		if (!image.Overlaps(address, size)) {
 			continue;
 		}
+		// Invalidation replaces the native contents with the buffer's bytes, which never received
+		// this image's GPU writes. For a write that may not happen, keep the native contents.
+		if (possible_write && (image.IsGpuModified() || image.depth_id)) {

Reworked. The host no longer touches the texture cache for every table entry before the dispatch, so possible_write is gone from this PR. Each V#-table store now sets the bit of its caching page in a write bitmap (second half of the fault buffer); when the submission completes, the written bytes of the targets become GPU modified and are invalidated in the texture cache with the regular, exact InvalidateMemoryFromGPU, like any other buffer store. Images under entries the shader did not select are left alone. In GTA V no written page overlapped a GPU-modified image.

**@⁠TheCruZ** on GitHub · 2026-09-30 07:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142217122) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1858 (outdated): ```diff @@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) { if (!image.Overlaps(address, size)) { continue; } + // Invalidation replaces the native contents with the buffer's bytes, which never received + // this image's GPU writes. For a write that may not happen, keep the native contents. + if (possible_write && (image.IsGpuModified() || image.depth_id)) { ``` Reworked. The host no longer touches the texture cache for every table entry before the dispatch, so possible_write is gone from this PR. Each V#-table store now sets the bit of its caching page in a write bitmap (second half of the fault buffer); when the submission completes, the written bytes of the targets become GPU modified and are invalidated in the texture cache with the regular, exact InvalidateMemoryFromGPU, like any other buffer store. Images under entries the shader did not select are left alone. In GTA V no written page overlapped a GPU-modified image.
Author
Owner

@⁠TheCruZ on GitHub · 2026-09-30 07:59 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 58 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;

Done. There is no entry or size cap anymore: IndirectWriteTables covers the whole table (131072 entries in GTA V) and caches every buffer V# with a data format whose range is mapped. Each table keeps a snapshot and only rescans the pages the CPU wrote since the previous preparation; targets sharing a caching page are cached as one buffer, and targets released by the garbage collector or mapped later are cached again. In GTA V every target is now covered (0 uncovered pages, ~21000 before; 0 BDA faults, 463 before) and a preparation costs a few microseconds. Unmapped targets are skipped and revisited when the mappings change.

**@⁠TheCruZ** on GitHub · 2026-09-30 07:59 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142217250) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 58 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; ``` Done. There is no entry or size cap anymore: IndirectWriteTables covers the whole table (131072 entries in GTA V) and caches every buffer V# with a data format whose range is mapped. Each table keeps a snapshot and only rescans the pages the CPU wrote since the previous preparation; targets sharing a caching page are cached as one buffer, and targets released by the garbage collector or mapped later are cached again. In GTA V every target is now covered (0 uncovered pages, ~21000 before; 0 BDA faults, 463 before) and a preparation costs a few microseconds. Unmapped targets are skipped and revisited when the mappings change.
Author
Owner

@⁠TheCruZ on GitHub · 2026-09-30 08:00 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 93 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;
+	const auto&        program         = *bindings.runtime->program;
+	const auto&        layout          = program.bindings;
+	if (layout.memory_offset_count == 0) {
+		return false;
+	}
+	// Buffer sources follow the bound resources, which leave out buffers the shader never
+	// accesses, not the shader's buffer list.
+	const auto& resources = layout.descriptors.front().resources;
+	bool        prepared  = false;
+	for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) {
+		const auto& resource = program.info.buffers[resources[i]];
+		const auto& table    = bindings.buffer_sources[i];
+		if (!resource.indirect_write_table || table.address == 0 ||
+		    table.size <= resource.indirect_table_offset) {
+			continue;
+		}
+		const auto available =
+		    (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource);
+		if (available > MaxTableEntries) {
+			static bool logged = false;
+			if (!logged) {
+				logged = true;
+				LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64
+				     " entries; stores through entries past %" PRIu64 " are dropped\n",
+				     table.address, available, MaxTableEntries);
+			}
+		}
+		const auto                        entries = std::min<uint64_t>(available, MaxTableEntries);
+		std::vector<ShaderBufferResource> targets(entries);
+		const auto                        address = table.address + resource.indirect_table_offset;
+		const auto                        bytes   = entries * sizeof(ShaderBufferResource);
+		if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) &&
+		    !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) {
+			LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address);
+			continue;

Fixed: when the buffer cache holds GPU-written bytes of the table, it is downloaded with ReadMemory first and then rescanned in full. (In GTA V the table is never GPU-written.)

**@⁠TheCruZ** on GitHub · 2026-09-30 08:00 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142219080) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 93 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; + const auto& program = *bindings.runtime->program; + const auto& layout = program.bindings; + if (layout.memory_offset_count == 0) { + return false; + } + // Buffer sources follow the bound resources, which leave out buffers the shader never + // accesses, not the shader's buffer list. + const auto& resources = layout.descriptors.front().resources; + bool prepared = false; + for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) { + const auto& resource = program.info.buffers[resources[i]]; + const auto& table = bindings.buffer_sources[i]; + if (!resource.indirect_write_table || table.address == 0 || + table.size <= resource.indirect_table_offset) { + continue; + } + const auto available = + (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource); + if (available > MaxTableEntries) { + static bool logged = false; + if (!logged) { + logged = true; + LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64 + " entries; stores through entries past %" PRIu64 " are dropped\n", + table.address, available, MaxTableEntries); + } + } + const auto entries = std::min<uint64_t>(available, MaxTableEntries); + std::vector<ShaderBufferResource> targets(entries); + const auto address = table.address + resource.indirect_table_offset; + const auto bytes = entries * sizeof(ShaderBufferResource); + if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) && + !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) { + LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address); + continue; ``` Fixed: when the buffer cache holds GPU-written bytes of the table, it is downloaded with ReadMemory first and then rescanned in full. (In GTA V the table is never GPU-written.)
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 08:10 UTC · original
On src/graphics/host_gpu/renderer/cache/textureCache.cpp line 1858 (outdated):

@@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) {
 		if (!image.Overlaps(address, size)) {
 			continue;
 		}
+		// Invalidation replaces the native contents with the buffer's bytes, which never received
+		// this image's GPU writes. For a write that may not happen, keep the native contents.
+		if (possible_write && (image.IsGpuModified() || image.depth_id)) {
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
ast-grep outline src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp --match 'RecordBdaWrite|StoreBdaDword' --view expanded
ast-grep outline src/graphics/host_gpu/renderer/indirectWriteTables.cpp --match 'NoteWrites|Prepare' --view expanded
ast-grep outline src/graphics/host_gpu/renderer/cache/faultManager.cpp --match 'Process|ProcessWriteBuffer' --view expanded
rg -n -C 12 'RecordBdaWrite|StoreBdaDword' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
rg -n -A 65 'void IndirectWriteTables::NoteWrites' src/graphics/host_gpu/renderer/indirectWriteTables.cpp
rg -n -C 12 'ProcessWriteBuffer|TakePendingWrites|NoteWrites' src/graphics/host_gpu/renderer/renderContext.cpp
rg -n -A 95 'void FaultManager::Process\(' src/graphics/host_gpu/renderer/cache/faultManager.cpp
rg -n -A 23 'void TextureCache::InvalidateMemoryFromGPU' src/graphics/host_gpu/renderer/cache/textureCache.cpp
rg -n -C 2 '\bpossible_write\b' src/graphics/host_gpu/renderer || true

Length of output: 13300


@TheCruZ, thanks for the rework. I verified that active, mapped stores record their caching page in the write bitmap. The deferred readback calls IndirectWriteTables::NoteWrites, which marks buffer ranges GPU-modified and calls the regular InvalidateMemoryFromGPU. The possible_write bypass is gone.

This addresses the missing texture-cache notification in this finding. The bitmap tracks pages, not individual DWORDs, so invalidation remains conservative within each written page.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-30 08:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142310817) On `src/graphics/host_gpu/renderer/cache/textureCache.cpp` line 1858 (outdated): ```diff @@ -1853,6 +1853,11 @@ void TextureCache::InvalidateMemoryFromGPU(uint64_t address, uint64_t size) { if (!image.Overlaps(address, size)) { continue; } + // Invalidation replaces the native contents with the buffer's bytes, which never received + // this image's GPU writes. For a write that may not happen, keep the native contents. + if (possible_write && (image.IsGpuModified() || image.depth_id)) { ``` <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail ast-grep outline src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp --match 'RecordBdaWrite|StoreBdaDword' --view expanded ast-grep outline src/graphics/host_gpu/renderer/indirectWriteTables.cpp --match 'NoteWrites|Prepare' --view expanded ast-grep outline src/graphics/host_gpu/renderer/cache/faultManager.cpp --match 'Process|ProcessWriteBuffer' --view expanded rg -n -C 12 'RecordBdaWrite|StoreBdaDword' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp rg -n -A 65 'void IndirectWriteTables::NoteWrites' src/graphics/host_gpu/renderer/indirectWriteTables.cpp rg -n -C 12 'ProcessWriteBuffer|TakePendingWrites|NoteWrites' src/graphics/host_gpu/renderer/renderContext.cpp rg -n -A 95 'void FaultManager::Process\(' src/graphics/host_gpu/renderer/cache/faultManager.cpp rg -n -A 23 'void TextureCache::InvalidateMemoryFromGPU' src/graphics/host_gpu/renderer/cache/textureCache.cpp rg -n -C 2 '\bpossible_write\b' src/graphics/host_gpu/renderer || true ``` Length of output: 13300 --- </details> `@TheCruZ`, thanks for the rework. I verified that active, mapped stores record their caching page in the write bitmap. The deferred readback calls `IndirectWriteTables::NoteWrites`, which marks buffer ranges GPU-modified and calls the regular `InvalidateMemoryFromGPU`. The `possible_write` bypass is gone. This addresses the missing texture-cache notification in this finding. The bitmap tracks pages, not individual DWORDs, so invalidation remains conservative within each written page. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=%40coderabbitai%20caught%20a%20stale-texture%20hazard%3A%20track%20V%23%20stores%20in%20a%20write%20bitmap%2C%20then%20invalidate%20only%20written%20targets%20on%20completion.%20Precise%20cache%20updates%2C%20no%20needless%20invalidations%E2%80%94try%20CodeRabbit!%20%F0%9F%90%87%E2%9C%85&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F931%23discussion_r4138887442)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 08:10 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 93 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;
+	const auto&        program         = *bindings.runtime->program;
+	const auto&        layout          = program.bindings;
+	if (layout.memory_offset_count == 0) {
+		return false;
+	}
+	// Buffer sources follow the bound resources, which leave out buffers the shader never
+	// accesses, not the shader's buffer list.
+	const auto& resources = layout.descriptors.front().resources;
+	bool        prepared  = false;
+	for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) {
+		const auto& resource = program.info.buffers[resources[i]];
+		const auto& table    = bindings.buffer_sources[i];
+		if (!resource.indirect_write_table || table.address == 0 ||
+		    table.size <= resource.indirect_table_offset) {
+			continue;
+		}
+		const auto available =
+		    (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource);
+		if (available > MaxTableEntries) {
+			static bool logged = false;
+			if (!logged) {
+				logged = true;
+				LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64
+				     " entries; stores through entries past %" PRIu64 " are dropped\n",
+				     table.address, available, MaxTableEntries);
+			}
+		}
+		const auto                        entries = std::min<uint64_t>(available, MaxTableEntries);
+		std::vector<ShaderBufferResource> targets(entries);
+		const auto                        address = table.address + resource.indirect_table_offset;
+		const auto                        bytes   = entries * sizeof(ShaderBufferResource);
+		if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) &&
+		    !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) {
+			LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address);
+			continue;
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
ast-grep outline src/graphics/host_gpu/renderer/indirectWriteTables.cpp --items all --view expanded
cat -n src/graphics/host_gpu/renderer/indirectWriteTables.cpp | sed -n '1,225p'

Length of output: 8984


@TheCruZ, verified. In IndirectWriteTables::Prepare, GPU-dirty table bytes trigger ReadMemory before scanning. The code then sets full = true and scans all table entries. This addresses the stale-descriptor concern.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-30 08:10 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142316538) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 93 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; + const auto& program = *bindings.runtime->program; + const auto& layout = program.bindings; + if (layout.memory_offset_count == 0) { + return false; + } + // Buffer sources follow the bound resources, which leave out buffers the shader never + // accesses, not the shader's buffer list. + const auto& resources = layout.descriptors.front().resources; + bool prepared = false; + for (uint32_t i = 0; i < bindings.buffer_sources.size() && i < resources.size(); ++i) { + const auto& resource = program.info.buffers[resources[i]]; + const auto& table = bindings.buffer_sources[i]; + if (!resource.indirect_write_table || table.address == 0 || + table.size <= resource.indirect_table_offset) { + continue; + } + const auto available = + (table.size - resource.indirect_table_offset) / sizeof(ShaderBufferResource); + if (available > MaxTableEntries) { + static bool logged = false; + if (!logged) { + logged = true; + LOGF("Compute: V# table 0x%016" PRIx64 " has %" PRIu64 + " entries; stores through entries past %" PRIu64 " are dropped\n", + table.address, available, MaxTableEntries); + } + } + const auto entries = std::min<uint64_t>(available, MaxTableEntries); + std::vector<ShaderBufferResource> targets(entries); + const auto address = table.address + resource.indirect_table_offset; + const auto bytes = entries * sizeof(ShaderBufferResource); + if (!LibKernel::Memory::TryReadGpuCleanBacking(address, targets.data(), bytes) && + !LibKernel::Memory::TryReadBacking(address, targets.data(), bytes)) { + LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable\n", address); + continue; ``` <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail ast-grep outline src/graphics/host_gpu/renderer/indirectWriteTables.cpp --items all --view expanded cat -n src/graphics/host_gpu/renderer/indirectWriteTables.cpp | sed -n '1,225p' ``` Length of output: 8984 --- </details> `@TheCruZ`, verified. In `IndirectWriteTables::Prepare`, GPU-dirty table bytes trigger `ReadMemory` before scanning. The code then sets `full = true` and scans all table entries. This addresses the stale-descriptor concern. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=GPU-dirty%20tables%20need%20readback%20before%20scanning%E2%80%94stale%20descriptors%20can%20hide%20shader%20write%20targets%20and%20skip%20invalidation.%20Catch%20sync%20bugs%20early%20with%20%40coderabbitai%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F931%23discussion_r4138887450)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 08:11 UTC · original
On src/graphics/host_gpu/renderer/renderCompute.cpp line 58 (outdated):

@@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor
 	return true;
 }
 
+// Stores through V#s selected from a descriptor table write guest memory by device address.
+// Prepare every table entry as a written cache range so the BDA page table covers the
+// targets and later readers observe the GPU data. Returns whether any target was prepared.
+static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) {
+	constexpr uint64_t MaxTableEntries = 4096;
+	constexpr uint64_t MaxTargetSize   = uint64_t {256} << 20u;

@TheCruZ, thanks for the fix and the implementation details. The updated preparation path removes both limits and delegates target caching to IndirectWriteTables. This addresses the shader-reachable target coverage concern.

Your reported GTA V results—zero uncovered pages and zero BDA faults—also support the fix.


✏️ Learnings added
Learnt from: TheCruZ
Repo: KytyPS5/KytyPS5 PR: 931
File: src/graphics/host_gpu/renderer/renderCompute.cpp:0-0
Timestamp: 2026-09-30T08:11:21.639Z
Learning: In KytyPS5, indirect compute-store target preparation is handled by IndirectWriteTables in src/graphics/host_gpu/renderer/indirectWriteTables.cpp. Table snapshots support incremental rescanning of CPU-written pages. Targets that share a caching page are coalesced. Unmapped targets are retried when mappings change, and targets released by buffer-cache garbage collection are cached again.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-30 08:11 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4142324998) On `src/graphics/host_gpu/renderer/renderCompute.cpp` line 58 (outdated): ```diff @@ -49,6 +50,86 @@ static bool FillSourcesDisjoint(std::span<const ShaderRecompiler::IR::Descriptor return true; } +// Stores through V#s selected from a descriptor table write guest memory by device address. +// Prepare every table entry as a written cache range so the BDA page table covers the +// targets and later readers observe the GPU data. Returns whether any target was prepared. +static bool PrepareIndirectWriteTargets(RenderContext& context, const PreparedBindings& bindings) { + constexpr uint64_t MaxTableEntries = 4096; + constexpr uint64_t MaxTargetSize = uint64_t {256} << 20u; ``` `@TheCruZ`, thanks for the fix and the implementation details. The updated preparation path removes both limits and delegates target caching to `IndirectWriteTables`. This addresses the shader-reachable target coverage concern. Your reported GTA V results—zero uncovered pages and zero BDA faults—also support the fix. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: TheCruZ Repo: KytyPS5/KytyPS5 PR: 931 File: src/graphics/host_gpu/renderer/renderCompute.cpp:0-0 Timestamp: 2026-09-30T08:11:21.639Z Learning: In KytyPS5, indirect compute-store target preparation is handled by IndirectWriteTables in src/graphics/host_gpu/renderer/indirectWriteTables.cpp. Table snapshots support incremental rescanning of CPU-written pages. Targets that share a caching page are coalesced. Unmapped targets are retried when mappings change, and targets released by buffer-cache garbage collection are cached again. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Prepare%20every%20shader-reachable%20target%2C%20not%20just%20the%20first%204096.%20%40coderabbitai%20helped%20drive%20full-table%2C%20incremental%20caching%E2%80%94GTA%20V%3A%200%20uncovered%20pages%2C%200%20BDA%20faults.%20Try%20it!%20%F0%9F%8E%AF&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F931%23discussion_r4138887447)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -649,0 +673,4 @@
start, finish - start, [&](uint64_t page, uint64_t bytes) {
const auto first = std::max(page, start);
const auto last = std::min(page + bytes, finish);
m_gpu_modified_ranges.Add(first, last - first);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 17:05 UTC · original · edited 2026-10-08 21:18 UTC

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

sed -n '980,1039p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
sed -n '10,37p;155,181p' src/graphics/host_gpu/renderer/indirectWriteTables.cpp
sed -n '650,685p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp
rg -n 'ForEachInRange|NoteGpuWrites|MarkRegionAsGpuModifiedUnlessCpuDirty' src/graphics/host_gpu src/common

Repository: KytyPS5/KytyPS5

Length of output: 6971


🏁 Script executed:

set -o pipefail
rg -n -F -- 'IndirectBufferInBounds' src/graphics/shader
rg -n -F -- 'PrepareIndirectBuffer' src/graphics/shader
rg -n -F -- 'Base48()' src/graphics/shader src/graphics/host_gpu
sed -n '1,150p' src/graphics/host_gpu/rangeSet.h
sed -n '80,145p' src/graphics/host_gpu/memoryTracker.h
sed -n '1,210p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp | grep -n -B8 -A30 'IndirectBufferInBounds'
sed -n '1,180p' src/graphics/shader/shaderBindings.h
sed -n '120,185p' src/graphics/host_gpu/renderer/indirectWriteTables.cpp
rg -n -F -- 'InvalidateMemoryFromGPU' src/graphics/host_gpu

Repository: KytyPS5/KytyPS5

Length of output: 22454


🏁 Script executed:

sed -n '875,965p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
sed -n '1870,1915p' src/graphics/host_gpu/renderer/cache/textureCache.cpp
rg -n -F -- 'MarkGpuDirtyUnlessCpuDirty' src/graphics/host_gpu
rg -n -F -- 'CACHING_PAGESIZE' src/graphics/host_gpu/renderer/cache/bufferCache.h src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu

Repository: KytyPS5/KytyPS5

Length of output: 8520


🏁 Script executed:

sed -n '135,185p' src/graphics/host_gpu/regionManager.h
rg -n -F -- 'm_gpu_modified_ranges' src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu/renderer/cache/bufferCache.h
sed -n '1,48p' src/graphics/host_gpu/renderer/cache/bufferCache.h
rg -n -F -- 'MarkGpuDirtyUnlessCpuDirty' src/graphics/host_gpu/regionManager.h

Repository: KytyPS5/KytyPS5

Length of output: 5053


🏁 Script executed:

sed -n '95,140p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp
sed -n '590,650p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4097


🏁 Script executed:

rg -n -F -- 'ValidateGpuDirtyPages' src/graphics/host_gpu
sed -n '1,180p' src/graphics/host_gpu/memoryTracker.h

Repository: KytyPS5/KytyPS5

Length of output: 8094


🏁 Script executed:

sed -n '1,95p' src/graphics/host_gpu/memoryTracker.cpp

Repository: KytyPS5/KytyPS5

Length of output: 3832


Track the aligned bytes written by an indirect DWORD store.

StoreIndirectBuffer aligns the store address down to four bytes. An unaligned target base can therefore cause the store to write bytes before the target range. NoteWrites excludes those bytes from BufferCache::NoteGpuWrites, so m_gpu_modified_ranges can omit data that the GPU changed and leave stale CPU readback.

The callback uses an end address, not a size. Extend only the buffer-cache range. Keep texture invalidation on the original target range:

🐛 Suggested fix
 			targeted = true;
 			m_targets.ForEachInRange(start, end - start, [&](uint64_t begin, uint64_t finish) {
-				note(begin, finish);
+				const auto aligned_begin = Common::AlignDown(begin, sizeof(uint32_t));
+				buffer_cache.NoteGpuWrites(aligned_begin, finish - aligned_begin);
+				texture_cache.InvalidateMemoryFromGPU(begin, finish - begin);
 			});

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 17:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4186647176) · edited 2026-10-08 21:18 UTC _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _🏗️ Heavy lift_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '980,1039p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp sed -n '10,37p;155,181p' src/graphics/host_gpu/renderer/indirectWriteTables.cpp sed -n '650,685p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp rg -n 'ForEachInRange|NoteGpuWrites|MarkRegionAsGpuModifiedUnlessCpuDirty' src/graphics/host_gpu src/common ``` Repository: KytyPS5/KytyPS5 Length of output: 6971 --- 🏁 Script executed: ```bash set -o pipefail rg -n -F -- 'IndirectBufferInBounds' src/graphics/shader rg -n -F -- 'PrepareIndirectBuffer' src/graphics/shader rg -n -F -- 'Base48()' src/graphics/shader src/graphics/host_gpu sed -n '1,150p' src/graphics/host_gpu/rangeSet.h sed -n '80,145p' src/graphics/host_gpu/memoryTracker.h sed -n '1,210p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp | grep -n -B8 -A30 'IndirectBufferInBounds' sed -n '1,180p' src/graphics/shader/shaderBindings.h sed -n '120,185p' src/graphics/host_gpu/renderer/indirectWriteTables.cpp rg -n -F -- 'InvalidateMemoryFromGPU' src/graphics/host_gpu ``` Repository: KytyPS5/KytyPS5 Length of output: 22454 --- 🏁 Script executed: ```bash sed -n '875,965p' src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp sed -n '1870,1915p' src/graphics/host_gpu/renderer/cache/textureCache.cpp rg -n -F -- 'MarkGpuDirtyUnlessCpuDirty' src/graphics/host_gpu rg -n -F -- 'CACHING_PAGESIZE' src/graphics/host_gpu/renderer/cache/bufferCache.h src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu ``` Repository: KytyPS5/KytyPS5 Length of output: 8520 --- 🏁 Script executed: ```bash sed -n '135,185p' src/graphics/host_gpu/regionManager.h rg -n -F -- 'm_gpu_modified_ranges' src/graphics/host_gpu/renderer/cache/bufferCache.cpp src/graphics/host_gpu/renderer/cache/bufferCache.h sed -n '1,48p' src/graphics/host_gpu/renderer/cache/bufferCache.h rg -n -F -- 'MarkGpuDirtyUnlessCpuDirty' src/graphics/host_gpu/regionManager.h ``` Repository: KytyPS5/KytyPS5 Length of output: 5053 --- 🏁 Script executed: ```bash sed -n '95,140p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp sed -n '590,650p' src/graphics/host_gpu/renderer/cache/bufferCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4097 --- 🏁 Script executed: ```bash rg -n -F -- 'ValidateGpuDirtyPages' src/graphics/host_gpu sed -n '1,180p' src/graphics/host_gpu/memoryTracker.h ``` Repository: KytyPS5/KytyPS5 Length of output: 8094 --- 🏁 Script executed: ```bash sed -n '1,95p' src/graphics/host_gpu/memoryTracker.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 3832 --- </details> **Track the aligned bytes written by an indirect DWORD store.** `StoreIndirectBuffer` aligns the store address down to four bytes. An unaligned target base can therefore cause the store to write bytes before the target range. `NoteWrites` excludes those bytes from `BufferCache::NoteGpuWrites`, so `m_gpu_modified_ranges` can omit data that the GPU changed and leave stale CPU readback. The callback uses an end address, not a size. Extend only the buffer-cache range. Keep texture invalidation on the original target range: <details> <summary>🐛 Suggested fix</summary> ```diff targeted = true; m_targets.ForEachInRange(start, end - start, [&](uint64_t begin, uint64_t finish) { - note(begin, finish); + const auto aligned_begin = Common::AlignDown(begin, sizeof(uint32_t)); + buffer_cache.NoteGpuWrites(aligned_begin, finish - aligned_begin); + texture_cache.InvalidateMemoryFromGPU(begin, finish - begin); }); ``` </details> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:2bc8f36c9dad64a04811d6cf --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 17:05 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9a6a8f1c-2bab-41ec-b975-1f7cfe62692a
📥 Commits

Reviewing files that changed from the base of the PR and between fd2791a94f17d1a88844cd3afb30c1854d6ec1d8 and c87faf95bad1842627cf1cd5ad3c43b493faa5ab.

📒 Files selected for processing (16)
  • CMakeLists.txt
  • src/common/bitArray.h
  • src/graphics/host_gpu/memoryTracker.h
  • src/graphics/host_gpu/regionManager.h
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/bufferCache.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • src/graphics/host_gpu/renderer/renderContext.h
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/ir/Program.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • tests/MemoryTrackerTests.cpp
  • tests/ResourceTrackingTests.cpp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 17:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#pullrequestreview-5418059409) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `9a6a8f1c-2bab-41ec-b975-1f7cfe62692a` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between fd2791a94f17d1a88844cd3afb30c1854d6ec1d8 and c87faf95bad1842627cf1cd5ad3c43b493faa5ab. </details> <details> <summary>📒 Files selected for processing (16)</summary> * `CMakeLists.txt` * `src/common/bitArray.h` * `src/graphics/host_gpu/memoryTracker.h` * `src/graphics/host_gpu/regionManager.h` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/bufferCache.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `src/graphics/host_gpu/renderer/renderContext.h` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/ir/Program.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `tests/MemoryTrackerTests.cpp` * `tests/ResourceTrackingTests.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠overlordxrz-source on GitHub · 2026-10-05 22:49 UTC · original

Validation + rebase report for this PR (read the diff, rebased onto current main cdb64bf, built, tested on x86_64 macOS no-Qt Release):

Rebase (3 spots, semantic resolutions):

  1. PrepareGraphicsBindings: main refactored FindBuffers to batch-span mode. Kept the batch call, added the per-stage CacheDmaBases loop.
  2. DispatchDirect: same batch-FindBuffers refactor; kept it and added PrepareIndirectWriteTargets after it.
  3. BdaPageIndex helper uses TypeScalarU64/ConstantDeviceAddress, which don't exist on main (renamed to TypeU64/ConstantU64). Ported (11 lines). Heads-up: the fork base behind this PR seems to have diverged renames; worth checking nothing else in the stack depends on the new names.
    Rebased helper branch (for reference, not a competing PR): overlordxrz-source/KytyPS5@helper/pr931-rebase.

Blocking finding: shader_cfg fails on the PR's own head, before any rebase. Reproduced on pristine c87faf95 (stashed my port, rebuilt, same result), so this is not a merge artifact:
ShaderCfgTests: failed: material selection accepted an inclusive induction bound
The ExpectFatal(TranslateProgram(unbounded...)) negative test in shaderCfgTests.cpp no longer rejects the s_cmp_le_u32 wraparound case. The PR's materialization changes appear to have loosened induction-bound rejection while the test still expects it. Worth a look before landing.

What passes: kyty_emulator links clean; resource_tracking + memory_tracker green. GPU-harness tests not runnable here (no Vulkan loader — pre-existing env limitation, same as clean main).

**@⁠overlordxrz-source** on GitHub · 2026-10-05 22:49 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#issuecomment-6004780651) Validation + rebase report for this PR (read the diff, rebased onto current main cdb64bf, built, tested on x86_64 macOS no-Qt Release): **Rebase (3 spots, semantic resolutions):** 1. `PrepareGraphicsBindings`: main refactored `FindBuffers` to batch-span mode. Kept the batch call, added the per-stage `CacheDmaBases` loop. 2. `DispatchDirect`: same batch-`FindBuffers` refactor; kept it and added `PrepareIndirectWriteTargets` after it. 3. `BdaPageIndex` helper uses `TypeScalarU64`/`ConstantDeviceAddress`, which don't exist on main (renamed to `TypeU64`/`ConstantU64`). Ported (11 lines). Heads-up: the fork base behind this PR seems to have diverged renames; worth checking nothing else in the stack depends on the new names. Rebased helper branch (for reference, not a competing PR): overlordxrz-source/KytyPS5@helper/pr931-rebase. **Blocking finding: `shader_cfg` fails on the PR's own head, before any rebase.** Reproduced on pristine `c87faf95` (stashed my port, rebuilt, same result), so this is not a merge artifact: `ShaderCfgTests: failed: material selection accepted an inclusive induction bound` The `ExpectFatal(TranslateProgram(unbounded...))` negative test in `shaderCfgTests.cpp` no longer rejects the `s_cmp_le_u32` wraparound case. The PR's materialization changes appear to have loosened induction-bound rejection while the test still expects it. Worth a look before landing. **What passes:** `kyty_emulator` links clean; `resource_tracking` + `memory_tracker` green. GPU-harness tests not runnable here (no Vulkan loader — pre-existing env limitation, same as clean main).
@ -649,0 +673,4 @@
start, finish - start, [&](uint64_t page, uint64_t bytes) {
const auto first = std::max(page, start);
const auto last = std::min(page + bytes, finish);
m_gpu_modified_ranges.Add(first, last - first);
Author
Owner

@⁠TheCruZ on GitHub · 2026-10-08 21:08 UTC · original

Fixed in 4b326c8: IndirectWriteTables::TargetRange now covers the whole DWORDs a target's stores can write (base aligned down and end aligned up to 4 bytes), so the buffer-cache GPU-modified ranges, the texture invalidation and the cached buffers all include the bytes an unaligned base exposes. Added an unaligned case to the IndirectWriteTables test.

**@⁠TheCruZ** on GitHub · 2026-10-08 21:08 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4224147923) Fixed in 4b326c8: `IndirectWriteTables::TargetRange` now covers the whole DWORDs a target's stores can write (base aligned down and end aligned up to 4 bytes), so the buffer-cache GPU-modified ranges, the texture invalidation and the cached buffers all include the bytes an unaligned base exposes. Added an unaligned case to the `IndirectWriteTables` test.
@ -0,0 +56,4 @@
table.address, address);
}
return;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 21:14 UTC · original

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Retry the scan after a failed TryReadBacking.

If TryReadBacking fails, Scan returns and keeps the old entries. For a new table, those entries are all zero. Later calls to Prepare find the table with full = false. They rescan only the pages that ConsumeCpuWrites reports. If the CPU does not write the table again, the table is never scanned. target_count stays 0, so Prepare returns false and leaves the targets uncached. Stores through those V#s then reach memory that no cached buffer covers. The same failure keeps a stale snapshot after the GPU-dirty download path at Line 125. The static bool logged flag also hides every later failure, for every table.

Fix: record the failure on the Table, for example with a needs_full_scan flag. Then force full = true on the next Prepare.

Proposed fix
--- "a/src/graphics/host_gpu/renderer/indirectWriteTables.cpp"
+++ "b/src/graphics/host_gpu/renderer/indirectWriteTables.cpp"
@@ -47,9 +47,10 @@
                                std::vector<GuestRange>& targets) {
 	std::vector<ShaderBufferResource> entries(last - first);
 	const auto address = table.address + first * sizeof(ShaderBufferResource);
 	if (!LibKernel::Memory::TryReadBacking(address, entries.data(),
 	                                       entries.size() * sizeof(ShaderBufferResource))) {
+		table.needs_full_scan = true;
 		static bool logged = false;
 		if (!logged) {
 			logged = true;
 			LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable at 0x%016" PRIx64 "\n",
// In Prepare, after table->last_use:
bool full = ... || std::exchange(table->needs_full_scan, false);
**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4224201223) **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** **Retry the scan after a failed `TryReadBacking`.** If `TryReadBacking` fails, `Scan` returns and keeps the old entries. For a new table, those entries are all zero. Later calls to `Prepare` find the table with `full = false`. They rescan only the pages that `ConsumeCpuWrites` reports. If the CPU does not write the table again, the table is never scanned. `target_count` stays 0, so `Prepare` returns false and leaves the targets uncached. Stores through those V#s then reach memory that no cached buffer covers. The same failure keeps a stale snapshot after the GPU-dirty download path at Line 125. The `static bool logged` flag also hides every later failure, for every table. Fix: record the failure on the `Table`, for example with a `needs_full_scan` flag. Then force `full = true` on the next `Prepare`. <details> <summary>Proposed fix</summary> ```diff --- "a/src/graphics/host_gpu/renderer/indirectWriteTables.cpp" +++ "b/src/graphics/host_gpu/renderer/indirectWriteTables.cpp" @@ -47,9 +47,10 @@ std::vector<GuestRange>& targets) { std::vector<ShaderBufferResource> entries(last - first); const auto address = table.address + first * sizeof(ShaderBufferResource); if (!LibKernel::Memory::TryReadBacking(address, entries.data(), entries.size() * sizeof(ShaderBufferResource))) { + table.needs_full_scan = true; static bool logged = false; if (!logged) { logged = true; LOGF("Compute: V# table 0x%016" PRIx64 " is unreadable at 0x%016" PRIx64 "\n", ``` ```cpp // In Prepare, after table->last_use: bool full = ... || std::exchange(table->needs_full_scan, false); ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:2d7ec54b5800d7807f5d532b --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 21:14 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 32d0e555-69ac-4ac5-afff-1d7809365296
📥 Commits

Reviewing files that changed from the base of the PR and between c87faf95bad1842627cf1cd5ad3c43b493faa5ab and 4b326c8b70.

📒 Files selected for processing (2)
  • src/graphics/host_gpu/renderer/indirectWriteTables.cpp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#pullrequestreview-5462925202) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `32d0e555-69ac-4ac5-afff-1d7809365296` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c87faf95bad1842627cf1cd5ad3c43b493faa5ab and 4b326c8b709633f60c4c9d181620baefaafbdb89. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/host_gpu/renderer/indirectWriteTables.cpp` * `tests/ShaderRecompilerComputeTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=8adb8a82-cf8a-4125-87b4-34e078ff015d attempt=42e737b0-73b8-470c-af0a-1ed2dd6c728a batch=1/1 -->
@ -649,0 +673,4 @@
start, finish - start, [&](uint64_t page, uint64_t bytes) {
const auto first = std::max(page, start);
const auto last = std::min(page + bytes, finish);
m_gpu_modified_ranges.Add(first, last - first);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 21:18 UTC · original

@TheCruZ, thanks for fixing this in 4b326c8. Aligning IndirectWriteTables::TargetRange covers the exposed bytes consistently across cached buffers, GPU-modified ranges, and texture invalidation. The unaligned test case covers the reported edge case.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/931#discussion_r4224237829) `@TheCruZ`, thanks for fixing this in `4b326c8`. Aligning `IndirectWriteTables::TargetRange` covers the exposed bytes consistently across cached buffers, GPU-modified ranges, and texture invalidation. The unaligned test case covers the reported edge case. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Unaligned%20indirect%20DWORD%20stores%20can%20modify%20bytes%20before%20the%20target%2C%20causing%20stale%20GPU%20readback.%20Track%20the%20full%20aligned%20range%E2%80%94try%20%40coderabbitai%20for%20sharp%20code%20reviews%20%F0%9F%90%87&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F931%23discussion_r4186647176)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.