shader: run GTA V's ray tracing dispatches #1258

Closed
github-bot wants to merge 2 commits from gh-pr/1258/head into gh-pr/1258/base
Owner

@⁠TheCruZ on GitHub · 2026-10-08 20:54 UTC · original
pr/gtav-ray-tracing-dispatches → main · +1282 −127 · 27 files · 2 commits · closed without merging

Depends on #1257 (bindless T# tables). This branch contains that PR's commit; only the last commit, shader: run GTA V's ray tracing dispatches, belongs to this PR.

Summary

Lets Grand Theft Auto V (PPSA04263) run its ray tracing compute shaders instead of failing on them: 0xfa8b1616fddc203b, 0x6db33a2bcb077bc3, 0xca313cf56ef25496 and 0x651da332bc4a3f98 in Fidelity mode and 0xedc5bdc9a5687671 in Performance RT mode. Without them, ray-traced reflections and shadows are missing and Franklin's house had dark, wrong indirect lighting in Fidelity.

Problem

With BVH intersections and GPU-selected scalar loads supported upstream, two things still stopped these shaders:

  • The any-hit alpha test samples a T# loaded from a material table (S_BUFFER_LOAD_DWORDX8 at (material >> 4) << 5). Its SGPRs are reused for other data, so the T# words also reach Phis of those other register lifetimes, and the bindless table plan (which requires the T# reads to feed only image descriptors) was rejected.
  • 0xedc5bdc9a5687671 also queries the size of a material table texture (IMAGE_GET_RESINFO), and ImageQueryDimensions had no table path.

Change

  • A T# read whose other uses are only Phis now stays an ordinary scalar load for those uses (it is not marked planning-only), while its image uses take the table path.
  • The table element selection (entry = key & mask, slot lookup in the flattened SRT) moves into ImageTableElement, shared by sampling and by ImageQueryDimensions, which now queries the selected table element; materialization accepts ImageQueryDimensions on table images.

Testing

  • Grand Theft Auto V (PPSA04263): in Fidelity and Performance RT modes the ray tracing dispatches run and ray-traced reflections and shadows are drawn; played in my fork with this change.
  • resource_tracking_tests: new TestIndirectScalarReads, TestGpuDependentAddressReads, TestBindlessImageTableQuery and TestBindlessImageTableSharedRegisters cases; passes.
  • shader_recompiler_compute_tests: new ScalarLoadsGpuSelectedDescriptors GPU case (--indirect-buffer-only); --indirect-buffer-only and the default run pass.
  • resource_materialization_tests, memory_tracker_tests, page_manager_tests, shader_cfg_tests and virtual_memory_allocation_tests pass.
  • 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-10-08 20:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258) `pr/gtav-ray-tracing-dispatches` → `main` · +1282 −127 · 27 files · 2 commits · closed without merging **Depends on #1257** (bindless T# tables). This branch contains that PR's commit; only the last commit, `shader: run GTA V's ray tracing dispatches`, belongs to this PR. ## Summary Lets Grand Theft Auto V (PPSA04263) run its ray tracing compute shaders instead of failing on them: `0xfa8b1616fddc203b`, `0x6db33a2bcb077bc3`, `0xca313cf56ef25496` and `0x651da332bc4a3f98` in Fidelity mode and `0xedc5bdc9a5687671` in Performance RT mode. Without them, ray-traced reflections and shadows are missing and Franklin's house had dark, wrong indirect lighting in Fidelity. ## Problem With BVH intersections and GPU-selected scalar loads supported upstream, two things still stopped these shaders: - The any-hit alpha test samples a T# loaded from a material table (`S_BUFFER_LOAD_DWORDX8` at `(material >> 4) << 5`). Its SGPRs are reused for other data, so the T# words also reach Phis of those other register lifetimes, and the bindless table plan (which requires the T# reads to feed only image descriptors) was rejected. - `0xedc5bdc9a5687671` also queries the size of a material table texture (`IMAGE_GET_RESINFO`), and `ImageQueryDimensions` had no table path. ## Change - A T# read whose other uses are only Phis now stays an ordinary scalar load for those uses (it is not marked planning-only), while its image uses take the table path. - The table element selection (`entry = key & mask`, slot lookup in the flattened SRT) moves into `ImageTableElement`, shared by sampling and by `ImageQueryDimensions`, which now queries the selected table element; materialization accepts `ImageQueryDimensions` on table images. ## Testing - Grand Theft Auto V (PPSA04263): in Fidelity and Performance RT modes the ray tracing dispatches run and ray-traced reflections and shadows are drawn; played in my fork with this change. - `resource_tracking_tests`: new `TestIndirectScalarReads`, `TestGpuDependentAddressReads`, `TestBindlessImageTableQuery` and `TestBindlessImageTableSharedRegisters` cases; passes. - `shader_recompiler_compute_tests`: new `ScalarLoadsGpuSelectedDescriptors` GPU case (`--indirect-buffer-only`); `--indirect-buffer-only` and the default run pass. - `resource_materialization_tests`, `memory_tracker_tests`, `page_manager_tests`, `shader_cfg_tests` and `virtual_memory_allocation_tests` pass. - 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 (PPSA04263) CS 0xc6c91cf1882cdc3b shades ray hits by sampling
material textures whose T#s it reads from a 65536-entry descriptor heap
at an index taken from GPU-written material records. Indirect images
could only probe host-readable material keys and bind at most 64
candidates through a switch, so the shader was unsupported.

When the key is not a probeable material word, resource tracking now
keeps the table itself (also through a masked table offset, and when
several image instructions share one T# load). Materialization reads
the table, deduplicates its valid T#s into slots (reusing them while
the table is unchanged) and appends an entry-to-slot mapping to the
flattened SRT. The slots follow the resources of the root's image
binding, sized to a power-of-two capacity; the shader computes entry
= key & mask, loads its slot and samples the element with NonUniform
indexing. The host resolves each slot through the texture cache and
binds T#s the root's view cannot read, or whose guest memory is gone,
as null images. A pipeline whose sampled images exceed the device's
per-set or per-stage limits or the descriptor pool exits with a message
instead of creating an invalid layout.

Slot resolution runs under a Common::SoftExitScope, which turns a fatal
error of the current thread into a Common::SoftExitError, so a T# the
texture cache cannot use binds a null image instead of terminating
(WriteBacking is no longer noexcept, so its failure reaches the scope
too). Table elements resolve through TextureCache::FindImageSpeculative,
which declines depth/color recreations (a few heap T#s alias depth
buffers the frame renders to, and converting them cost two recreations
per frame).

The shader binds five roots of 4096 elements each; resolving all of them
on every dispatch took 17% of the GPU thread. RenderExecutor keeps each
element's resolution by T#, shared by roots with the same view, and
resolves it again only when an image overlapping its memory was
registered or unregistered (a per-page epoch in the texture cache, and a
global image-set epoch that skips the per-range check while no image
changed), when the guest backing changed (kernel BackingEpoch), or
always when it has DCC metadata. Elements declined by the texture cache
are revalidated against the guest range the lookup examined. The table
words are read into a reused buffer.

Upstream (cd066010) replaced the probing of material keys with a direct
image-table lookup that makes every distinct T# of a bounded table its own
specialized image. On GTA V's ray tracing heaps it took ~9800 table words
for candidate T#s and failed ("sampled image descriptor 9813 uses
unsupported format 60"). Scalar 32-byte T# tables that are not indexed by
the workgroup, including those whose key is a plain material word (the
four roots of c6c9 that used to probe their keys), take the table path
above; the direct lookup keeps the other tables.
With BVH intersections and GPU-selected scalar loads supported, GTA V
(PPSA04263) still could not run its ray tracing compute shaders:
0xfa8b1616fddc203b, 0x6db33a2bcb077bc3, 0xca313cf56ef25496 and
0x651da332bc4a3f98 in Fidelity mode and 0xedc5bdc9a5687671 in Performance
RT mode. Skipping them left Franklin's house with dark, wrong indirect
lighting in Fidelity.

- The any-hit alpha test samples a T# loaded from a material table
  (S_BUFFER_LOAD_DWORDX8 at (material >> 4) << 5). Its SGPRs are reused
  for other data, so the T# words also reach Phis of those other
  register lifetimes and the bindless table plan was rejected. A T# read
  whose other uses are only Phis now stays an ordinary scalar load for
  them while its image uses take the table path.
- 0xedc5bdc9a5687671 also queries the size of a material table texture
  (IMAGE_GET_RESINFO); ImageQueryDimensions now selects the table
  descriptor like sampling does.

Tests: ResourceTrackingTests (indirect scalar reads, GPU-dependent
address reads, bindless image table query and shared registers) and
ScalarLoadsGpuSelectedDescriptors (--indirect-buffer-only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:50:23 +00:00
github-bot closed this pull request 2026-11-26 09:50:23 +00:00
Author
Owner

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

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4958ee29-d7ea-4771-84ec-eebfc49c59e9
📥 Commits

Reviewing files that changed from the base of the PR and between d634aea1aa95c58af70c3dc0c4df76a26853c4f5 and e44da01aa8.

📒 Files selected for processing (5)
  • src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptorHeap.h
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp
  • src/kernel/memory.cpp
  • src/kernel/memory.h
📝 Walkthrough

Walkthrough

The change adds bindless image-table support across resource tracking, materialization, SPIR-V emission, and host renderer descriptor binding. It also adds speculative texture lookup, image and backing-store epochs, backing-readability checks, and scoped soft-exit exceptions. Vulkan feature configuration and sampled-image descriptor-pool capacity are updated. Tests cover image-table tracking and materialization, dimension queries, shared register uses, and GPU-selected scalar descriptor reads.

Suggested reviewers: nmzik, senaxx

Priority: ➖ Normal

Change: Feature

Merge Risk: 🟡 Moderate · up to d634a

Bindless texture tables enable GTA V ray-traced effects. However, a failed guest-memory write while a table texture is being resolved can crash the emulator instead of falling back to a null image. Very large tables can also exceed descriptor capacity. Fix the crash path before merging.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ❓ Inconclusive Docstring coverage is 15.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 100 functions across 22 files. (3 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: enabling GTA V ray-tracing dispatches.
Description check ✅ Passed The description directly explains the GTA V ray-tracing support, technical changes, dependencies, and testing results.
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 15.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 100 functions across 22 files. (3 skipped: 2 unsupported, 1 too large.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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-10-08 21:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#issuecomment-6068973836) · edited 2026-10-08 21:41 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/1258?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: rate limited by coderabbit.ai --> > [!WARNING] > ## Review limit reached > > You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. > > **Next included review available in 7 minutes.** > > [Check out review usage here](https://app.coderabbit.ai/dashboard/review-capacity?orgId=d7cf2749-f181-4119-ba0c-ad79606afdfe). > > <details> > <summary>View limit details</summary> > > **Limit details:** You’ve used all 8 included reviews currently available. > > [Learn how review limits work](https://docs.coderabbit.ai/management/plans#rate-limits). > > **Review configuration:** > > <details> > <summary>⚙️ Run configuration</summary> > > - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml > - **Review profile**: CHILL > - **Plan**: Advanced > - **Run ID**: `4958ee29-d7ea-4771-84ec-eebfc49c59e9` > > </details> > > <details> > <summary>📥 Commits</summary> > > Reviewing files that changed from the base of the PR and between d634aea1aa95c58af70c3dc0c4df76a26853c4f5 and e44da01aa88ac99ac863b19bbc620b92278e848d. > > </details> > > <details> > <summary>📒 Files selected for processing (5)</summary> > > * `src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp` > * `src/graphics/host_gpu/renderer/pipeline/descriptorHeap.h` > * `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` > * `src/kernel/memory.cpp` > * `src/kernel/memory.h` > > </details> > > </details> <!-- end of auto-generated comment: rate limited by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The change adds bindless image-table support across resource tracking, materialization, SPIR-V emission, and host renderer descriptor binding. It also adds speculative texture lookup, image and backing-store epochs, backing-readability checks, and scoped soft-exit exceptions. Vulkan feature configuration and sampled-image descriptor-pool capacity are updated. Tests cover image-table tracking and materialization, dimension queries, shared register uses, and GPU-selected scalar descriptor reads. **Suggested reviewers:** `nmzik`, `senaxx` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"d634aea1aa95c58af70c3dc0c4df76a26853c4f5" --> **Change:** Feature <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **🟡 Moderate** · up to `d634a` <!-- final_review_risk_coverage:{"sourceCommitId":"d634aea1aa95c58af70c3dc0c4df76a26853c4f5","coveredCommitId":"d634aea1aa95c58af70c3dc0c4df76a26853c4f5","kind":"reviewed"} --> Bindless texture tables enable GTA V ray-traced effects. However, a failed guest-memory write while a table texture is being resolved can crash the emulator instead of falling back to a null image. Very large tables can also exceed descriptor capacity. Fix the crash path before merging. <!-- final_review_risk_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 15.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 100 functions across 22 files. (3 skipped… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :--------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main change: enabling GTA V ray-tracing dispatches. | | Description check | ✅ Passed | The description directly explains the GTA V ray-tracing support, technical changes, dependencies, and testing results. | | 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 15.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 100 functions across 22 files. (3 skipped: 2 unsupported, 1 too large.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1258)! 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 -->
@ -14,0 +30,4 @@
throw SoftExitError(fmt::format("{} ({}:{})", text, file, line));
}
}
Author
Owner

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -eu
printf '%s\n' '--- assert.cpp ---'
nl -ba src/common/assert.cpp | sed -n '1,140p'
printf '%s\n' '--- named symbols ---'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'ResolveTableTexture' -e 'ResolveTexture' -e 'FindImageSpeculative' -e 'WriteBacking' -e 'SoftExitScope' -e 'ThrowIfSoft' src
printf '%s\n' '--- EXIT definitions and uses near named files ---'
rg -n -F --glob '*.{cpp,h,hpp}' -- 'EXIT(' src | head -200

Repository: KytyPS5/KytyPS5

Length of output: 29348


🏁 Script executed:

set -eu
pwd
nl -ba src/common/assert.cpp | sed -n '1,140p'
rg -n -F --glob '*.{cpp,h,hpp}' -e 'ResolveTableTexture' -e 'ResolveTexture' -e 'FindImageSpeculative' -e 'WriteBacking' -e 'SoftExitScope' -e 'ThrowIfSoft' src

Repository: KytyPS5/KytyPS5

Length of output: 7163


🏁 Script executed:

set -eu
printf '%s\n' '--- EXIT macro and exception type ---'
nl -ba src/common/assert.h | sed -n '1,90p'
printf '%s\n' '--- ResolveTexture and ResolveTableTexture ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '520,780p'
printf '%s\n' '--- FindImageSpeculative ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1260,1375p'
printf '%s\n' '--- WriteBacking and TryWriteBacking ---'
nl -ba src/kernel/memory.cpp | sed -n '860,935p'
printf '%s\n' '--- texture cache lock declarations/usages ---'
rg -n -F --glob 'src/graphics/host_gpu/renderer/cache/textureCache.{h,cpp}' -e 'm_lock' -e 'scoped_lock' -e 'unique_lock' -e 'lock_guard'

Repository: KytyPS5/KytyPS5

Length of output: 28870


🏁 Script executed:

set -eu
printf '%s\n' '--- FindImageImpl remainder and nearby helpers ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1200,1425p'
printf '%s\n' '--- writeback call context ---'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1180,1260p'
nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1880,1950p'
printf '%s\n' '--- EXIT sites in textureCache.cpp ---'
rg -n -F -- 'EXIT(' src/graphics/host_gpu/renderer/cache/textureCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 20011


Do not let the soft-exit path call noexcept WriteBacking.

ResolveTableTexture enables SoftExitScope before ResolveTexture. That path calls FindImageSpeculative, which inserts an image and then calls MaterializeColorClear. MaterializeColorClear can call LibKernel::Memory::WriteBacking. If the write fails, WriteBacking calls EXIT; ThrowIfSoft throws SoftExitError, but WriteBacking is noexcept, so the process terminates before ResolveTableTexture can catch the error.

Remove noexcept from WriteBacking so this failure reaches the existing soft-exit handler.

🐛 Suggested fix
-void                   WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept;
+void                   WriteBacking(uint64_t vaddr, const void* data, uint64_t size);

-void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept {
+void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) {

FindImageImpl also publishes the inserted image before MaterializeColorClear runs. If materialization raises a caught SoftExitError, the image remains cached although materialization did not complete. Roll back speculative inserts, or publish the entry only after materialization succeeds. The lock is released before materialization, so this is a cache-state issue rather than a leaked lock.

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224091277) · edited 2026-10-08 21:15 UTC **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash set -eu printf '%s\n' '--- assert.cpp ---' nl -ba src/common/assert.cpp | sed -n '1,140p' printf '%s\n' '--- named symbols ---' rg -n -F --glob '*.{cpp,h,hpp}' -e 'ResolveTableTexture' -e 'ResolveTexture' -e 'FindImageSpeculative' -e 'WriteBacking' -e 'SoftExitScope' -e 'ThrowIfSoft' src printf '%s\n' '--- EXIT definitions and uses near named files ---' rg -n -F --glob '*.{cpp,h,hpp}' -- 'EXIT(' src | head -200 ``` Repository: KytyPS5/KytyPS5 Length of output: 29348 --- 🏁 Script executed: ```bash set -eu pwd nl -ba src/common/assert.cpp | sed -n '1,140p' rg -n -F --glob '*.{cpp,h,hpp}' -e 'ResolveTableTexture' -e 'ResolveTexture' -e 'FindImageSpeculative' -e 'WriteBacking' -e 'SoftExitScope' -e 'ThrowIfSoft' src ``` Repository: KytyPS5/KytyPS5 Length of output: 7163 --- 🏁 Script executed: ```bash set -eu printf '%s\n' '--- EXIT macro and exception type ---' nl -ba src/common/assert.h | sed -n '1,90p' printf '%s\n' '--- ResolveTexture and ResolveTableTexture ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '520,780p' printf '%s\n' '--- FindImageSpeculative ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1260,1375p' printf '%s\n' '--- WriteBacking and TryWriteBacking ---' nl -ba src/kernel/memory.cpp | sed -n '860,935p' printf '%s\n' '--- texture cache lock declarations/usages ---' rg -n -F --glob 'src/graphics/host_gpu/renderer/cache/textureCache.{h,cpp}' -e 'm_lock' -e 'scoped_lock' -e 'unique_lock' -e 'lock_guard' ``` Repository: KytyPS5/KytyPS5 Length of output: 28870 --- 🏁 Script executed: ```bash set -eu printf '%s\n' '--- FindImageImpl remainder and nearby helpers ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1200,1425p' printf '%s\n' '--- writeback call context ---' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1180,1260p' nl -ba src/graphics/host_gpu/renderer/cache/textureCache.cpp | sed -n '1880,1950p' printf '%s\n' '--- EXIT sites in textureCache.cpp ---' rg -n -F -- 'EXIT(' src/graphics/host_gpu/renderer/cache/textureCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 20011 --- </details> **Do not let the soft-exit path call `noexcept` `WriteBacking`.** `ResolveTableTexture` enables `SoftExitScope` before `ResolveTexture`. That path calls `FindImageSpeculative`, which inserts an image and then calls `MaterializeColorClear`. `MaterializeColorClear` can call `LibKernel::Memory::WriteBacking`. If the write fails, `WriteBacking` calls `EXIT`; `ThrowIfSoft` throws `SoftExitError`, but `WriteBacking` is `noexcept`, so the process terminates before `ResolveTableTexture` can catch the error. Remove `noexcept` from `WriteBacking` so this failure reaches the existing soft-exit handler. <details> <summary>🐛 Suggested fix</summary> ```diff -void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept; +void WriteBacking(uint64_t vaddr, const void* data, uint64_t size); -void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) noexcept { +void WriteBacking(uint64_t vaddr, const void* data, uint64_t size) { ``` </details> `FindImageImpl` also publishes the inserted image before `MaterializeColorClear` runs. If materialization raises a caught `SoftExitError`, the image remains cached although materialization did not complete. Roll back speculative inserts, or publish the entry only after materialization succeeds. The lock is released before materialization, so this is a cache-state issue rather than a leaked lock. <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:408faaef35370a540f9173d3 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated comment by CodeRabbit -->
@ -510,0 +514,4 @@
supported_features2.features.shaderSampledImageArrayDynamicIndexing != VK_TRUE) {
LOGF("WARNING: non-uniform sampled image indexing is not supported; bindless image "
"tables will not work\n");
}
Author
Owner

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

The device can be created without non-uniform indexing, and table shaders then use undeclared features.

This change copies the device's reported support into features12. Device creation therefore no longer fails when shaderSampledImageArrayNonUniformIndexing is unsupported. Device selection still rejects such a device, because VulkanFindPhysicalDevice checks this feature as required. A selected device therefore always has support, and the new fallback branch is unreachable. If shaderSampledImageArrayDynamicIndexing is unsupported, however, the emitter still requires SampledImageArrayDynamicIndexing for table bindings. Pipeline creation then fails, and the only signal is the warning in the log. Add shaderSampledImageArrayDynamicIndexing to the device-selection checks, or disable the bindless table path when the feature is missing.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224091288) · edited 2026-10-08 21:14 UTC **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** **The device can be created without non-uniform indexing, and table shaders then use undeclared features.** This change copies the device's reported support into `features12`. Device creation therefore no longer fails when `shaderSampledImageArrayNonUniformIndexing` is unsupported. Device selection still rejects such a device, because `VulkanFindPhysicalDevice` checks this feature as required. A selected device therefore always has support, and the new fallback branch is unreachable. If `shaderSampledImageArrayDynamicIndexing` is unsupported, however, the emitter still requires `SampledImageArrayDynamicIndexing` for table bindings. Pipeline creation then fails, and the only signal is the warning in the log. Add `shaderSampledImageArrayDynamicIndexing` to the device-selection checks, or disable the bindless table path when the feature is missing. <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:b4c03ed4236353fae3b1648e --> <!-- This is an auto-generated reply by CodeRabbit -->
@ -457,0 +495,4 @@
const auto entry_mask = indirect.table_mask >> 5u;
const auto entries = std::min<uint64_t>(
{size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
Author
Owner

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

🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

set -e
printf '%s\n' '--- relevant symbols ---'
rg -n -F --glob 'src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp' \
  -e 'MaxIndirectDescriptorProbes' \
  -e 'FindTableResolution' \
  -e 'ImageTableCapacity' \
  -e 'entry_mask' \
  -e 'table_mask' \
  -e 'MaxElements' \
  -e 'descriptor' \
  src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp || true
printf '%s\n' '--- declarations and uses repository-wide ---'
rg -n -F --glob '*.{cpp,h,hpp,cc}' \
  -e 'FindTableResolution' \
  -e 'ImageTableCapacity' \
  -e 'MaxIndirectDescriptorProbes' \
  -e 'MaxElements' \
  -e 'descriptor_pool' \
  src/graphics/shader/recompiler src/graphics | head -n 240
printf '%s\n' '--- changed function region ---'
nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p'

Repository: KytyPS5/KytyPS5

Length of output: 21290


🏁 Script executed:

set -e
printf '%s\n' '--- relevant symbols ---'
rg -n -F --glob 'ResourceMaterialization.cpp' \
  -e 'MaxIndirectDescriptorProbes' -e 'FindTableResolution' -e 'ImageTableCapacity' \
  -e 'entry_mask' -e 'table_mask' -e 'MaxElements' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp || true
printf '%s\n' '--- declarations and uses repository-wide ---'
rg -n -F --glob '*.{cpp,h,hpp,cc}' \
  -e 'FindTableResolution' -e 'ImageTableCapacity' -e 'MaxIndirectDescriptorProbes' \
  -e 'MaxElements' -e 'descriptor_pool' src/graphics/shader/recompiler src/graphics | head -n 260
printf '%s\n' '--- changed function region ---'
nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p'

Repository: KytyPS5/KytyPS5

Length of output: 13585


🏁 Script executed:

set -e
rg -n -F --glob 'src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp' \
  -e 'MaxIndirectDescriptorProbes' -e 'FindTableResolution' -e 'ImageTableCapacity' \
  -e 'entry_mask' -e 'table_mask' -e 'MaxElements' || true
rg -n -F --glob '*.{cpp,h,hpp,cc}' \
  -e 'FindTableResolution' -e 'ImageTableCapacity' -e 'MaxIndirectDescriptorProbes' \
  -e 'MaxElements' src/graphics/shader/recompiler src/graphics | head -n 260
nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p'

Repository: KytyPS5/KytyPS5

Length of output: 14379


🏁 Script executed:

set -e
printf '%s\n' '--- FindTableResolution ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '730,835p'
printf '%s\n' '--- table resolution caller and descriptor-array path ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '880,980p'
printf '%s\n' '--- related table types and allocation declarations ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'struct TableResolution' -e 'class TableResolution' -e 'table_capacity' \
  -e 'table_mapping_offset' -e 'table_entry_mask' -e 'elements.resize' \
  src/graphics/host_gpu src/graphics/shader | head -n 260

Repository: KytyPS5/KytyPS5

Length of output: 14088


🏁 Script executed:

set -e
printf '%s\n' '--- FindTableResolution ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '730,835p'
printf '%s\n' '--- table resolution caller and descriptor-array path ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '880,980p'
printf '%s\n' '--- related table types and allocation declarations ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'struct TableResolution' -e 'class TableResolution' -e 'table_capacity' \
  -e 'table_mapping_offset' -e 'table_entry_mask' -e 'elements.resize' \
  src/graphics/host_gpu src/graphics/shader | head -n 260

Repository: KytyPS5/KytyPS5

Length of output: 14088


🏁 Script executed:

set -e
printf '%s\n' '--- TableResolution and prepared binding declarations ---'
nl -ba src/graphics/host_gpu/renderer/render.h | sed -n '180,230p'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'table_images' -e 'table_sources' -e 'table_roots' \
  -e 'PreparedBindings' -e 'VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER' \
  src/graphics/host_gpu/renderer | head -n 320
printf '%s\n' '--- all descriptor-array/table binding consumers ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'prepared.table_images' -e 'prepared.table_sources' -e 'prepared.table_roots' \
  -e 'range.capacity' -e 'descriptorCount' \
  src/graphics/host_gpu src/graphics/shader | head -n 320

Repository: KytyPS5/KytyPS5

Length of output: 11387


🏁 Script executed:

set -e
printf '%s\n' '--- TableResolution and prepared binding declarations ---'
nl -ba src/graphics/host_gpu/renderer/render.h | sed -n '180,230p'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'table_images' -e 'table_sources' -e 'table_roots' \
  -e 'PreparedBindings' -e 'VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER' \
  src/graphics/host_gpu/renderer | head -n 320
printf '%s\n' '--- all descriptor-array/table binding consumers ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'prepared.table_images' -e 'prepared.table_sources' -e 'prepared.table_roots' \
  -e 'range.capacity' -e 'descriptorCount' \
  src/graphics/host_gpu src/graphics/shader | head -n 320

Repository: KytyPS5/KytyPS5

Length of output: 11387


🏁 Script executed:

set -e
printf '%s\n' '--- descriptor preparation and writes ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1120,1340p'
printf '%s\n' '--- descriptor layout count calculations ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '150,215p'
nl -ba src/graphics/shader/recompiler/ir/ShaderIR.h | sed -n '430,475p'
printf '%s\n' '--- descriptor pool/layout limits ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'maxDescriptorSetSampledImages' -e 'maxPerStageDescriptorSampledImages' \
  -e 'descriptorPoolSize' -e 'maxSets' -e 'NativeDescriptorCount' \
  src/graphics/host_gpu | head -n 260

Repository: KytyPS5/KytyPS5

Length of output: 18716


🏁 Script executed:

set -e
printf '%s\n' '--- descriptor preparation and writes ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1120,1340p'
printf '%s\n' '--- descriptor layout count calculations ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '150,215p'
nl -ba src/graphics/shader/recompiler/ir/ShaderIR.h | sed -n '430,475p'
printf '%s\n' '--- descriptor pool/layout limits ---'
rg -n -F --glob '*.{cpp,h,hpp}' \
  -e 'maxDescriptorSetSampledImages' -e 'maxPerStageDescriptorSampledImages' \
  -e 'descriptorPoolSize' -e 'maxSets' -e 'NativeDescriptorCount' \
  src/graphics/host_gpu | head -n 260

Repository: KytyPS5/KytyPS5

Length of output: 18716


🏁 Script executed:

set -e
printf '%s\n' '--- descriptor count and commit completion ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '60,95p'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1290,1395p'
printf '%s\n' '--- descriptor heap and graphics limits ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp | sed -n '1,125p'
rg -n -F --glob 'src/graphics/host_gpu/**/*.{cpp,h,hpp}' \
  -e 'max_push_descriptors' -e 'maxDescriptorSet' -e 'allocateDescriptorSets' \
  -e 'createDescriptorPool' -e 'descriptor_set_layout' \
  src/graphics/host_gpu | head -n 260

Repository: KytyPS5/KytyPS5

Length of output: 12008


Reject full-size image tables before materialization.

With table_mask == UINT32_MAX, this path can read 65,536 entries. If those entries are distinct and valid, the initial null slot increases found->slots.size() to 65,537, and ImageTableCapacity rounds that value to 131,072. The descriptor pool reserves only 65,536 sampled-image descriptors. The allocation can therefore fail.

MaxElements does not prevent this. FindTableResolution clears an already oversized cache only on a later lookup.

🐛 Suggested fix
--- "a/src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp"
+++ "b/src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp"
@@ -493,9 +493,10 @@
 	const auto base       = table.Base48();
 	const auto size       = table.GetSize();
 	const auto entry_mask = indirect.table_mask >> 5u;
 	const auto entries    = std::min<uint64_t>(
 	    {size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
 	     uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
+	if (entries == MaxIndirectDescriptorProbes) return false;
 	const auto& root = program.info.images[image_index];
 	const auto same_table = [&](const ImageTableSnapshot& candidate) {
 		return candidate.base == base && candidate.size == size &&
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	const auto entries    = std::min<uint64_t>(
	    {size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
	     uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
	if (entries == MaxIndirectDescriptorProbes) return false;

✅ Confirmed as addressed by @⁠TheCruZ

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224091296) · edited 2026-10-08 21:41 UTC **🚀 Performance & Scalability** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash set -e printf '%s\n' '--- relevant symbols ---' rg -n -F --glob 'src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp' \ -e 'MaxIndirectDescriptorProbes' \ -e 'FindTableResolution' \ -e 'ImageTableCapacity' \ -e 'entry_mask' \ -e 'table_mask' \ -e 'MaxElements' \ -e 'descriptor' \ src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp || true printf '%s\n' '--- declarations and uses repository-wide ---' rg -n -F --glob '*.{cpp,h,hpp,cc}' \ -e 'FindTableResolution' \ -e 'ImageTableCapacity' \ -e 'MaxIndirectDescriptorProbes' \ -e 'MaxElements' \ -e 'descriptor_pool' \ src/graphics/shader/recompiler src/graphics | head -n 240 printf '%s\n' '--- changed function region ---' nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p' ``` Repository: KytyPS5/KytyPS5 Length of output: 21290 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- relevant symbols ---' rg -n -F --glob 'ResourceMaterialization.cpp' \ -e 'MaxIndirectDescriptorProbes' -e 'FindTableResolution' -e 'ImageTableCapacity' \ -e 'entry_mask' -e 'table_mask' -e 'MaxElements' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp || true printf '%s\n' '--- declarations and uses repository-wide ---' rg -n -F --glob '*.{cpp,h,hpp,cc}' \ -e 'FindTableResolution' -e 'ImageTableCapacity' -e 'MaxIndirectDescriptorProbes' \ -e 'MaxElements' -e 'descriptor_pool' src/graphics/shader/recompiler src/graphics | head -n 260 printf '%s\n' '--- changed function region ---' nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p' ``` Repository: KytyPS5/KytyPS5 Length of output: 13585 --- 🏁 Script executed: ```bash set -e rg -n -F --glob 'src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp' \ -e 'MaxIndirectDescriptorProbes' -e 'FindTableResolution' -e 'ImageTableCapacity' \ -e 'entry_mask' -e 'table_mask' -e 'MaxElements' || true rg -n -F --glob '*.{cpp,h,hpp,cc}' \ -e 'FindTableResolution' -e 'ImageTableCapacity' -e 'MaxIndirectDescriptorProbes' \ -e 'MaxElements' src/graphics/shader/recompiler src/graphics | head -n 260 nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '400,590p' ``` Repository: KytyPS5/KytyPS5 Length of output: 14379 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- FindTableResolution ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '730,835p' printf '%s\n' '--- table resolution caller and descriptor-array path ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '880,980p' printf '%s\n' '--- related table types and allocation declarations ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'struct TableResolution' -e 'class TableResolution' -e 'table_capacity' \ -e 'table_mapping_offset' -e 'table_entry_mask' -e 'elements.resize' \ src/graphics/host_gpu src/graphics/shader | head -n 260 ``` Repository: KytyPS5/KytyPS5 Length of output: 14088 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- FindTableResolution ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '730,835p' printf '%s\n' '--- table resolution caller and descriptor-array path ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '880,980p' printf '%s\n' '--- related table types and allocation declarations ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'struct TableResolution' -e 'class TableResolution' -e 'table_capacity' \ -e 'table_mapping_offset' -e 'table_entry_mask' -e 'elements.resize' \ src/graphics/host_gpu src/graphics/shader | head -n 260 ``` Repository: KytyPS5/KytyPS5 Length of output: 14088 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- TableResolution and prepared binding declarations ---' nl -ba src/graphics/host_gpu/renderer/render.h | sed -n '180,230p' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'table_images' -e 'table_sources' -e 'table_roots' \ -e 'PreparedBindings' -e 'VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER' \ src/graphics/host_gpu/renderer | head -n 320 printf '%s\n' '--- all descriptor-array/table binding consumers ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'prepared.table_images' -e 'prepared.table_sources' -e 'prepared.table_roots' \ -e 'range.capacity' -e 'descriptorCount' \ src/graphics/host_gpu src/graphics/shader | head -n 320 ``` Repository: KytyPS5/KytyPS5 Length of output: 11387 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- TableResolution and prepared binding declarations ---' nl -ba src/graphics/host_gpu/renderer/render.h | sed -n '180,230p' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'table_images' -e 'table_sources' -e 'table_roots' \ -e 'PreparedBindings' -e 'VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER' \ src/graphics/host_gpu/renderer | head -n 320 printf '%s\n' '--- all descriptor-array/table binding consumers ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'prepared.table_images' -e 'prepared.table_sources' -e 'prepared.table_roots' \ -e 'range.capacity' -e 'descriptorCount' \ src/graphics/host_gpu src/graphics/shader | head -n 320 ``` Repository: KytyPS5/KytyPS5 Length of output: 11387 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- descriptor preparation and writes ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1120,1340p' printf '%s\n' '--- descriptor layout count calculations ---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '150,215p' nl -ba src/graphics/shader/recompiler/ir/ShaderIR.h | sed -n '430,475p' printf '%s\n' '--- descriptor pool/layout limits ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'maxDescriptorSetSampledImages' -e 'maxPerStageDescriptorSampledImages' \ -e 'descriptorPoolSize' -e 'maxSets' -e 'NativeDescriptorCount' \ src/graphics/host_gpu | head -n 260 ``` Repository: KytyPS5/KytyPS5 Length of output: 18716 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- descriptor preparation and writes ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1120,1340p' printf '%s\n' '--- descriptor layout count calculations ---' nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '150,215p' nl -ba src/graphics/shader/recompiler/ir/ShaderIR.h | sed -n '430,475p' printf '%s\n' '--- descriptor pool/layout limits ---' rg -n -F --glob '*.{cpp,h,hpp}' \ -e 'maxDescriptorSetSampledImages' -e 'maxPerStageDescriptorSampledImages' \ -e 'descriptorPoolSize' -e 'maxSets' -e 'NativeDescriptorCount' \ src/graphics/host_gpu | head -n 260 ``` Repository: KytyPS5/KytyPS5 Length of output: 18716 --- 🏁 Script executed: ```bash set -e printf '%s\n' '--- descriptor count and commit completion ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '60,95p' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '1290,1395p' printf '%s\n' '--- descriptor heap and graphics limits ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp | sed -n '1,125p' rg -n -F --glob 'src/graphics/host_gpu/**/*.{cpp,h,hpp}' \ -e 'max_push_descriptors' -e 'maxDescriptorSet' -e 'allocateDescriptorSets' \ -e 'createDescriptorPool' -e 'descriptor_set_layout' \ src/graphics/host_gpu | head -n 260 ``` Repository: KytyPS5/KytyPS5 Length of output: 12008 --- </details> **Reject full-size image tables before materialization.** With `table_mask == UINT32_MAX`, this path can read 65,536 entries. If those entries are distinct and valid, the initial null slot increases `found->slots.size()` to 65,537, and `ImageTableCapacity` rounds that value to 131,072. The descriptor pool reserves only 65,536 sampled-image descriptors. The allocation can therefore fail. `MaxElements` does not prevent this. `FindTableResolution` clears an already oversized cache only on a later lookup. <details> <summary>🐛 Suggested fix</summary> ```diff --- "a/src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp" +++ "b/src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp" @@ -493,9 +493,10 @@ const auto base = table.Base48(); const auto size = table.GetSize(); const auto entry_mask = indirect.table_mask >> 5u; const auto entries = std::min<uint64_t>( {size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u, uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes}); + if (entries == MaxIndirectDescriptorProbes) return false; const auto& root = program.info.images[image_index]; const auto same_table = [&](const ImageTableSnapshot& candidate) { return candidate.base == base && candidate.size == size && ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion const auto entries = std::min<uint64_t>( {size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u, uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes}); if (entries == MaxIndirectDescriptorProbes) return false; ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:bd1a27600a4befc64246db86 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠TheCruZ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 21:01 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: 206e0dbe-bcad-4f91-8adf-cd87651dc95e
📥 Commits

Reviewing files that changed from the base of the PR and between 2f4b8a335d and d634aea1aa95c58af70c3dc0c4df76a26853c4f5.

📒 Files selected for processing (25)
  • CMakeLists.txt
  • src/common/assert.cpp
  • src/common/assert.h
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptors.h
  • src/graphics/host_gpu/renderer/render.h
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
  • src/graphics/shader/recompiler/ir/ResourceSnapshot.h
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/BindingLayout.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • src/kernel/memory.cpp
  • src/kernel/memory.h
  • src/kernel/memoryAddressSpace.inc
  • 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; 5 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:01 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#pullrequestreview-5462798993) · **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**: `206e0dbe-bcad-4f91-8adf-cd87651dc95e` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 2f4b8a335d5e27a5153bdea670bd877a061e37b1 and d634aea1aa95c58af70c3dc0c4df76a26853c4f5. </details> <details> <summary>📒 Files selected for processing (25)</summary> * `CMakeLists.txt` * `src/common/assert.cpp` * `src/common/assert.h` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/pipeline/descriptors.h` * `src/graphics/host_gpu/renderer/render.h` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterAnalysis.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp` * `src/graphics/shader/recompiler/ir/ResourceSnapshot.h` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/BindingLayout.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.h` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `src/kernel/memory.cpp` * `src/kernel/memory.h` * `src/kernel/memoryAddressSpace.inc` * `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; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=7f35108e-1324-4063-b102-f09600c35470 attempt=e63918c3-1c47-4e21-b115-2095c4288ab5 batch=1/1 -->
@ -14,0 +30,4 @@
throw SoftExitError(fmt::format("{} ({}:{})", text, file, line));
}
}
Author
Owner

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

Fixed in f78d0ab (the #1257 commit this PR is based on; this branch is rebased on it as 772e21c): WriteBacking is no longer noexcept, so its failure under the soft-exit scope reaches ResolveTableTexture and binds a null image instead of terminating. As for the inserted image: I'm not rolling it back. Its clear failed because the guest backing is gone, and before this change that case terminated the emulator; the image stays an ordinary cache entry that the next unmap/overlap handling removes.

**@⁠TheCruZ** on GitHub · 2026-10-08 21:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224200640) Fixed in f78d0ab (the #1257 commit this PR is based on; this branch is rebased on it as 772e21c): `WriteBacking` is no longer `noexcept`, so its failure under the soft-exit scope reaches `ResolveTableTexture` and binds a null image instead of terminating. As for the inserted image: I'm not rolling it back. Its clear failed because the guest backing is gone, and before this change that case terminated the emulator; the image stays an ordinary cache entry that the next unmap/overlap handling removes.
@ -510,0 +514,4 @@
supported_features2.features.shaderSampledImageArrayDynamicIndexing != VK_TRUE) {
LOGF("WARNING: non-uniform sampled image indexing is not supported; bindless image "
"tables will not work\n");
}
Author
Owner

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

I'm leaving device selection as is. Making shaderSampledImageArrayDynamicIndexing a hard requirement would refuse devices that run every title without bindless tables; every desktop Vulkan 1.2 driver I know of reports it. When it is missing, only the table shaders fail, and the log line names the missing feature.

**@⁠TheCruZ** on GitHub · 2026-10-08 21:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224200877) I'm leaving device selection as is. Making `shaderSampledImageArrayDynamicIndexing` a hard requirement would refuse devices that run every title without bindless tables; every desktop Vulkan 1.2 driver I know of reports it. When it is missing, only the table shaders fail, and the log line names the missing feature.
@ -457,0 +495,4 @@
const auto entry_mask = indirect.table_mask >> 5u;
const auto entries = std::min<uint64_t>(
{size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
Author
Owner

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

Addressed in f78d0ab: a table that would need more sampled images than the pool provides (such as 65537 slots rounded to 131072) now stops at layout creation with a message giving the counts and limits, instead of failing the descriptor set allocation. In practice the slots are the distinct valid T#s of the table (about 9800 in GTA V's 65536-entry heap).

**@⁠TheCruZ** on GitHub · 2026-10-08 21:14 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224201168) Addressed in f78d0ab: a table that would need more sampled images than the pool provides (such as 65537 slots rounded to 131072) now stops at layout creation with a message giving the counts and limits, instead of failing the descriptor set allocation. In practice the slots are the distinct valid T#s of the table (about 9800 in GTA V's 65536-entry heap).
@ -510,0 +514,4 @@
supported_features2.features.shaderSampledImageArrayDynamicIndexing != VK_TRUE) {
LOGF("WARNING: non-uniform sampled image indexing is not supported; bindless image "
"tables will not work\n");
}
Author
Owner

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

@TheCruZ, thanks for the guidance. Making shaderSampledImageArrayDynamicIndexing mandatory would reject devices that can run titles without bindless tables. I accept your decision to keep device selection unchanged and allow only table shaders to fail when the feature is unavailable.


✏️ Learnings added
Learnt from: TheCruZ
Repo: KytyPS5/KytyPS5 PR: 1258
File: src/graphics/presentation/window/vulkanWindow.cpp:510-517
Timestamp: 2026-10-08T21:15:00.228Z
Learning: In KytyPS5, do not recommend making shaderSampledImageArrayDynamicIndexing a hard requirement in VulkanFindPhysicalDevice in src/graphics/presentation/window/vulkanWindow.cpp. The maintainer intentionally preserves compatibility with titles that do not use bindless image tables. If the feature is unavailable, failure of table shaders with a warning is an accepted limitation.

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.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224204350) `@TheCruZ`, thanks for the guidance. Making `shaderSampledImageArrayDynamicIndexing` mandatory would reject devices that can run titles without bindless tables. I accept your decision to keep device selection unchanged and allow only table shaders to fail when the feature is unavailable. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: TheCruZ Repo: KytyPS5/KytyPS5 PR: 1258 File: src/graphics/presentation/window/vulkanWindow.cpp:510-517 Timestamp: 2026-10-08T21:15:00.228Z Learning: In KytyPS5, do not recommend making shaderSampledImageArrayDynamicIndexing a hard requirement in VulkanFindPhysicalDevice in src/graphics/presentation/window/vulkanWindow.cpp. The maintainer intentionally preserves compatibility with titles that do not use bindless image tables. If the feature is unavailable, failure of table shaders with a warning is an accepted limitation. ``` > 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> _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
@ -14,0 +30,4 @@
throw SoftExitError(fmt::format("{} ({}:{})", text, file, line));
}
}
Author
Owner

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

@TheCruZ Thanks for the fix and the clarification. Removing noexcept from WriteBacking addresses the termination issue.

I accept your decision to retain the inserted image for the existing unmap/overlap handling. I withdraw the rollback recommendation.


✏️ Learnings added
Learnt from: TheCruZ
Repo: KytyPS5/KytyPS5 PR: 1258
File: src/common/assert.cpp:14-33
Timestamp: 2026-10-08T21:14:58.382Z
Learning: In KytyPS5/KytyPS5, speculative image resolution in src/graphics/host_gpu/renderer/cache/textureCache.cpp intentionally retains an inserted image when MaterializeColorClear fails because guest backing is gone. The image remains an ordinary cache entry for subsequent unmap/overlap handling. Do not require rollback solely because this clear fails.

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-10-08 21:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224205103) `@TheCruZ` Thanks for the fix and the clarification. Removing `noexcept` from `WriteBacking` addresses the termination issue. I accept your decision to retain the inserted image for the existing unmap/overlap handling. I withdraw the rollback recommendation. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: TheCruZ Repo: KytyPS5/KytyPS5 PR: 1258 File: src/common/assert.cpp:14-33 Timestamp: 2026-10-08T21:14:58.382Z Learning: In KytyPS5/KytyPS5, speculative image resolution in src/graphics/host_gpu/renderer/cache/textureCache.cpp intentionally retains an inserted image when MaterializeColorClear fails because guest backing is gone. The image remains an ordinary cache entry for subsequent unmap/overlap handling. Do not require rollback solely because this clear fails. ``` > 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=A%20%60noexcept%60%20boundary%20can%20turn%20a%20recoverable%20GPU%20cache%20failure%20into%20process%20termination.%20Let%20soft-exit%20errors%20propagate%20and%20guard%20cache%20state%E2%80%94try%20%40coderabbitai%20for%20sharp%20code%20reviews%20%F0%9F%94%8D&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1258%23discussion_r4224091277)? 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 -->
@ -457,0 +495,4 @@
const auto entry_mask = indirect.table_mask >> 5u;
const auto entries = std::min<uint64_t>(
{size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
Author
Owner

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
git show --stat f78d0ab
git show --format=fuller --no-ext-diff f78d0ab -- src/graphics/host_gpu/renderer/pipeline/shaders.cpp src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Length of output: 25452


@TheCruZ, verified in f78d0ab. CreateDescriptorLayout now checks sampled-image counts against the descriptor-pool limit and the device’s per-set and per-stage limits. It reports the counts and limits before creating an oversized layout.

This addresses the allocation failure without rejecting a 65,536-entry table whose deduplicated slots fit the limits. Thanks for the clarification.


✏️ Learnings added
Learnt from: TheCruZ
Repo: KytyPS5/KytyPS5 PR: 1258
File: src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp:496-498
Timestamp: 2026-10-08T21:15:17.404Z
Learning: In KytyPS5's C++ bindless image-table implementation, MaterializeImageTable in src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp deduplicates valid T# descriptors into slots. Descriptor capacity depends on the distinct slots, including the null slot, rather than the raw table entry count. GTA V uses a 65,536-entry heap with about 9,800 distinct valid T# descriptors. Do not recommend rejecting such tables solely because their entry count reaches MaxIndirectDescriptorProbes; assess the resulting descriptor capacity and layout limits.

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-10-08 21:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224208608) <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail git show --stat f78d0ab git show --format=fuller --no-ext-diff f78d0ab -- src/graphics/host_gpu/renderer/pipeline/shaders.cpp src/graphics/host_gpu/renderer/pipeline/descriptorHeap.cpp src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Length of output: 25452 --- </details> `@TheCruZ`, verified in `f78d0ab`. `CreateDescriptorLayout` now checks sampled-image counts against the descriptor-pool limit and the device’s per-set and per-stage limits. It reports the counts and limits before creating an oversized layout. This addresses the allocation failure without rejecting a 65,536-entry table whose deduplicated slots fit the limits. Thanks for the clarification. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: TheCruZ Repo: KytyPS5/KytyPS5 PR: 1258 File: src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp:496-498 Timestamp: 2026-10-08T21:15:17.404Z Learning: In KytyPS5's C++ bindless image-table implementation, MaterializeImageTable in src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp deduplicates valid T# descriptors into slots. Descriptor capacity depends on the distinct slots, including the null slot, rather than the raw table entry count. GTA V uses a 65,536-entry heap with about 9,800 distinct valid T# descriptors. Do not recommend rejecting such tables solely because their entry count reaches MaxIndirectDescriptorProbes; assess the resulting descriptor capacity and layout limits. ``` > 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=Catch%20oversized%20GPU%20image%20tables%20before%20descriptor%20allocation%3A%2065%2C537%20slots%20can%20round%20to%20131%2C072%20and%20exceed%20pool%20limits.%20%40coderabbitai%20spots%20the%20risk%20early%E2%80%94try%20it%20on%20your%20PRs!%20%F0%9F%9A%80&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1258%23discussion_r4224091296)? 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 -->
@ -457,0 +495,4 @@
const auto entry_mask = indirect.table_mask >> 5u;
const auto entries = std::min<uint64_t>(
{size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
Author
Owner

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

Follow-up: the descriptor pool now holds 262144 sampled images (#1257, 4d0b7f2a), so a table that grows to 131072 entries still fits.

**@⁠TheCruZ** on GitHub · 2026-10-08 21:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224426848) Follow-up: the descriptor pool now holds 262144 sampled images (#1257, 4d0b7f2a), so a table that grows to 131072 entries still fits.
@ -457,0 +495,4 @@
const auto entry_mask = indirect.table_mask >> 5u;
const auto entries = std::min<uint64_t>(
{size > indirect.table_offset ? (size - indirect.table_offset) / 32u : 0u,
uint64_t {entry_mask} + 1u, MaxIndirectDescriptorProbes});
Author
Owner

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

@TheCruZ, thanks for the clarification. A rounded capacity of 131,072 sampled-image descriptors fits the 262,144-descriptor pool in #1257 (4d0b7f2a). The pool-overflow concern no longer applies to this case. The device’s per-set and per-stage limits still apply.


🧠 Learnings used
Learnt from: TheCruZ
Repo: KytyPS5/KytyPS5 PR: 1258
File: src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp:496-498
Timestamp: 2026-10-08T21:15:21.678Z
Learning: In KytyPS5's C++ bindless image-table implementation, MaterializeImageTable in src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp deduplicates valid T# descriptors into slots. Descriptor capacity depends on the distinct slots, including the null slot, rather than the raw table entry count. GTA V uses a 65,536-entry heap with about 9,800 distinct valid T# descriptors. Do not recommend rejecting such tables solely because their entry count reaches MaxIndirectDescriptorProbes; assess the resulting descriptor capacity and layout limits.

✅ Review thread resolved.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 21:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1258#discussion_r4224430454) `@TheCruZ`, thanks for the clarification. A rounded capacity of 131,072 sampled-image descriptors fits the 262,144-descriptor pool in `#1257` (`4d0b7f2a`). The pool-overflow concern no longer applies to this case. The device’s per-set and per-stage limits still apply. --- <details> <summary>🧠 Learnings used</summary> ``` Learnt from: TheCruZ Repo: KytyPS5/KytyPS5 PR: 1258 File: src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp:496-498 Timestamp: 2026-10-08T21:15:21.678Z Learning: In KytyPS5's C++ bindless image-table implementation, MaterializeImageTable in src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp deduplicates valid T# descriptors into slots. Descriptor capacity depends on the distinct slots, including the null slot, rather than the raw table entry count. GTA V uses a 65,536-entry heap with about 9,800 distinct valid T# descriptors. Do not recommend rejecting such tables solely because their entry count reaches MaxIndirectDescriptorProbes; assess the resulting descriptor capacity and layout limits. ``` </details> ✅ 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.