graphics: bind a texture with no mapped byte as null (Uncharted: Legacy of Thieves Collection) #2409
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2409
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2409"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Nawid3333 on GitHub · 2026-11-19 15:00 UTC · original
Nawid3333:fix/unmapped-texture-null→main· +117 −1 · 7 files · 4 commits · openUncharted: Legacy of Thieves Collection (PPSA05389, #2385) stops after starting a new game:
A diagnostic build printed the texture at that check: T# dwords
00000006,caf00000,001fc01f,d0970324,00000000,00700070,00000000,00000000, base address 0x600 (Base40 field 6), 128x128, 8 levels, 64 KiB with 64 KiB alignment, not a heap texture. Nothing is mapped at 0x600, so the alignment condition fails.ResolveTexturealready binds a null texture when the base field is 0, and for a heap texture that is not mapped.Change
RenderContext::IsAnyMapped(any byte of the range mapped).ResolveTexturebinds a null texture when a non-heap texture with a size has no mapped byte. A texture with at least one mapped byte takes the existing path.RebindImagesskips a re-resolve that returns null,TryConsumeComputeFilldeclines the fill, andProcessPssrexits on a missing PSSR image.Test
--unmapped-texture-only(new CTestunmapped_texture):descriptors.cpp:623.IsAnyMappedchanged to require the whole range, this case fails.--compute-meta-clear-onlygets a stencil fill whose destination is unmapped; the fill is declined.Windows 11, RX 9070 XT, clang-cl. The compute test cases need the robust-buffer harness change of #2038 on this GPU. Fork CI run 44538705191: Windows passes (the CI runners have no GPU, so the GPU tests run only locally); Linux and macOS fail only in
VirtualMemoryAllocationTests(AmmRemapIntoPrt failed: submit AMM commands returned 0x80020016), which fails the same way on main5ad27cdd1.Game
@Crispy81 ran a fork build with this change (#2385): Uncharted 4: A Thief's End now gets past this stop and runs until a different texture cache stop (
unresolvable equal-address image overlap), handled separately.Written with Claude Code (AI): Claude Code found the cause from the tester's log line, wrote the change and the tests, and ran them.
@coderabbitai[bot] on GitHub · 2026-11-19 15:07 UTC · original · edited 2026-11-23 23:46 UTC
No actionable comments were generated in the recent review.
Walkthrough
Texture resolution now checks whether nonempty texture ranges contain mapped bytes and returns an empty binding when none are mapped. Renderer paths stop processing bindings without an image ID. Compute tests cover fully unmapped and partially mapped textures and an unmapped stencil-image case. A new command-line option and CTest entry run the unmapped-texture check.
Suggested reviewers:
nmzik,shadowbeat070Change: Bug fix
Merge Risk:
Minimal · up to
edea7This change makes the renderer bind a null texture when no byte in its range is mapped, instead of stopping the game. The consumers that use the binding's image now handle a null result. No merge-blocking risk was found in the supplied evidence.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the main change: binding a texture that has no mapped bytes as a null binding. It also names the affected game. The raw summary and objectives confirm that ResolveTexture now returns a null binding for unmapped non-heap textures, with matching caller updates and tests.
Full details: Description check
Explanation
The description states the reported crash, the diagnostic texture details, the cause (no mapped bytes at the base address, failing the alignment check), and the change to ResolveTexture, IsAnyMapped, and the caller updates. It also lists the new tests and the CI results. This matches the summaries and objectives.
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
f9e1e889-53d6-4973-a536-611127d3f419Reviewing files that changed from the base of the PR and between
3c8a1818c7andedea795b58.tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -134,6 +134,7 @@ void RenderExecutor::ProcessPssr(CommandBuffer& buffer, const Pssr::Request& reqstd::copy_n(words, 8, value.dwords.begin());value.dword_count = 8;auto binding = ResolveTexture(resource, value);EXIT_IF(!binding.image_id);@coderabbitai[bot] on GitHub · 2026-11-19 15:07 UTC · original · edited 2026-11-19 15:30 UTC
Handle missing PSSR images without terminating.
If a PSSR texture has no mapped bytes,
ResolveTexturereturns an empty binding.EXIT_IFterminates non-final builds; inKYTY_FINALbuilds it compiles out, andacquirelater passes the invalid ID toGetImage.Return from
ProcessPssrsafely instead. Reset any images already bound before the failure.@coderabbitai[bot] on GitHub · 2026-11-19 15:07 UTC · original · reviewed
Actionable comments posted: 1
36459105-0d8f-46d5-8310-ef4bc57fb0abReviewing files that changed from the base of the PR and between
5ad27cdd1aandae87cb58da.CMakeLists.txtsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/host_gpu/renderer/renderContext.cppsrc/graphics/host_gpu/renderer/renderContext.hsrc/graphics/host_gpu/renderer/renderPssr.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@ -134,6 +134,7 @@ void RenderExecutor::ProcessPssr(CommandBuffer& buffer, const Pssr::Request& reqstd::copy_n(words, 8, value.dwords.begin());value.dword_count = 8;auto binding = ResolveTexture(resource, value);EXIT_IF(!binding.image_id);@Nawid3333 on GitHub · 2026-11-19 15:30 UTC · original
@coderabbitai
KYTY_FINALcomes only from#cmakedefine KYTY_FINALinsrc/cmake_config.h.in, and no CMake file or CI workflow sets it, soEXIT_IFstops every build that is built today.ProcessPssrchecks its other preconditions the same way (the descriptor shape, the request size, the input/output overlap, depth and sample counts). Returning early instead would leave the output image unwritten with no message, and no game has reached PSSR with an unmapped image yet; until one does, a stop that names the line is the more useful result.@ -134,6 +134,7 @@ void RenderExecutor::ProcessPssr(CommandBuffer& buffer, const Pssr::Request& reqstd::copy_n(words, 8, value.dwords.begin());value.dword_count = 8;auto binding = ResolveTexture(resource, value);EXIT_IF(!binding.image_id);@coderabbitai[bot] on GitHub · 2026-11-19 15:32 UTC · original
Analysis chain
Script executed:
Length of output: 2638
Script executed:
Length of output: 1401
@Nawid3333Thanks for the context. I withdraw the request to return early.ProcessPssrusesEXIT_IFfor other invalid requests, and a silent return would leave the output unwritten.I found no repository configuration that sets
KYTY_FINAL. My concern about the guard compiling out applies if that setting is enabled.Review thread resolved.
You are interacting with an AI system.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.