Hogwarts Legacy (PPSA01603): boot to gameplay, fix skin shading and the startup freeze #1297
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!1297
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1297"
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?
@netwarex on GitHub · 2026-10-09 11:50 UTC · original
netwarex:boot-hogwarts-legacy-PPSA01603→main· +377 −43 · 8 files · 7 commits · openHogwarts Legacy (PPSA01603, 01.000.005) stopped after the legal notice on
current main (compatibility list: "logo", issues #64 and #209). With this PR
it boots, passes the first-start screens, the main menu and character
creation, and plays the opening cutscenes and the first in-game areas.
Seven commits, one problem each, in the order the game hits them:
shader: support gathers from GPU-selected image descriptor tablesrenderer: accept HTILE depth textures with DCC block sizes or RT swizzletexture cache: skip out-of-range image clears instead of abortingshader: apply texel offsets of image_sample_*_o instructionsrenderer: apply recognized uniform buffer fills on the CPUshader: share runtime-value validation while extracting a resource planrenderer: release 64 KiB blocks on guest write faultsCommits 4 to 7 are not Hogwarts-specific; they change shared paths that
other games use too.
1. Gathers from GPU-selected image tables
Symptom: fatal error right after the legal notice:
image.indirect_root == memory.resource && inst.GetOpcode() != ValueOpcode::ImageSampleRawin
ResourceMaterialization.cpp(compute shader 0x67ae1be64bed0890).Cause: since
7804eef,TryMakeFiniteImageturns finite GPU-selected imagedescriptors into indirect images for both
ImageSampleRawandImageGatherRawusers, but only the sample path is materialized and emitted.Change: the gather emitter uses the same flattened-SRT lookup as indirect
samples and switches over the candidates (per-candidate coordinate, existing
dynamic-mip switch). Indirect 1D gathers fail the shader cleanly. The check
accepts gathers and names the opcode if anything else reaches it.
2. HTILE depth textures
Symptom: after the first-start screens:
unsupported sampled depth image: resource=1 encoding=0 view=1 ... dwords=...,91b00204,00000000,00700000,002b0000,...(64x64 D32 shadow texture, sampled with compare).
Cause:
IsSupportedDepthTextureEncodingrequires HTILE metadata control tobe exactly
0x280000and tile modekDepth. The game also sets the DCCblock-size fields (word 6 bits 15-18) and the 64 KiB render-target swizzle
(
0x1b).Change: ignore the DCC block-size bits and accept
kRenderTargetas well askDepth. Depth textures without HTILE are already accepted with any tilemode; the texture resolves to the host depth image that was rendered.
3. Out-of-range image clears
Symptom: the first seconds of the first in-game scene abort in
TextureCache::ClearImage(combined range check).Cause: the colour-metadata fast-clear path issues a colour clear, per
slice, on an 8x8 D32 cube depth image (shadow cube map) that the game also
reads as a colour texture.
Change: skip a clear whose aspect, mip or layer range does not fit the
image and log the first 32 (
TextureCache: skipped out-of-range clear: ...). An invalidcommand buffer or a stencil-association image stays fatal. This is
deliberately conservative; a narrower fix would be to not run the colour
fast-clear for depth images at all. Happy to change it to that if you prefer.
4. Texel offsets on image samples
Symptom: skin (faces, hands) renders pale grey-white; everything else is
correct.
Cause: the SPIR-V emitter ignored the offset of
image_sample*_o; onlygathers used it. UE4's checkerboard subsurface rendering stores diffuse and
specular on alternating pixels, and its recombine pass rebuilds the missing
half from four neighbours sampled with offsets. Without offsets all five
samples read the centre texel (verified with RenderDoc's shader debugger:
identical coordinates), half of the skin pixels kept raw diffuse lighting
without albedo, and TAA averaged the checkerboard into grey.
Change: Vulkan allows only constant
ConstOffseton sample instructions,so the offset is applied as
coord += offset / textureSize(lod)(percandidate for GPU-selected images; cube images unchanged). The size query
clamps the LOD to the last level and is decorated
NonUniformforruntime-selected descriptor slots, as
MakeSampledImagedoes. Exact forexplicit-LOD and level-zero samples; implicit-LOD samples use the level-0
texel size.
5. Uniform buffer fills on the CPU
Symptom: ~15 synchronous GPU readbacks per frame from
TextureCache::MaterializeColorClear.Cause: the game clears DCC/CMASK metadata with small compute fill shaders.
The uniform-fill fast path only handles fills that exactly cover an image, so
these ran on the GPU, left the metadata GPU-modified, and every colour target
lookup then read it back with a full GPU wait.
Change: a recognized uniform fill of plain, mapped buffer memory (no image
data overlaps, <= 4 MiB) is written to guest memory in command order
(
InvalidateMemory+WriteBacking, asMaterializeColorCleardoes) and thedispatch is skipped. Earlier GPU work still sees the old data because the
buffer cache uploads CPU changes at the next GPU use.
Measured: intro sequence 20.8 -> 23-24 FPS.
6. Shared validation in ExtractResourcePlan
Symptom: ~28 s freeze at frame ~469 on every launch while ~650 shaders are
prepared; picture and music stop.
Cause:
ExtractResourcePlancallsValidateRuntimeValuefor everyReadFirstLaneit clones, and each call built a freshRuntimeValidatorwithfresh hash sets over heavily overlapping subgraphs (profile: hash-set inserts
and malloc/free ~40% of the GPU thread). The game's RenderThread waits for
that thread in
RenderContext::UnmapMemory, which also blocked the audiostreaming thread.
Change:
RuntimeValidationSession(RAII, thread-local) lets allvalidations of one read-only program share one validator per value type,
which memoizes uniform verdicts per (instruction, EXEC mask) and valid
dependency verdicts. Cycles are cut as before (optimistically for dependency
checks, pessimistically for uniform checks); the validator tracks the
shallowest stack depth each cut reaches (Tarjan low-link), caches a verdict
only once its cycles are closed, and resolves pending dependency verdicts
when their cycle root finishes (kept if the root is valid, dropped if not).
A reused verdict is therefore the one a fresh validation would compute.
Clonememoizes its ReadConst/ReadFirstLane/Phi redirects. Passes thatrewrite IR do not use the session.
Measured: longest freeze 28.4 s -> 1.1 s; frame 700 after 20.6 s instead
of 51 s.
7. 64 KiB blocks on guest write faults
Symptom: in game ~64,000 write faults/s over ~13,000 distinct 4 KiB pages,
~90,000 mprotect calls/s, heavy TLB shootdowns on every core.
Change: on a write fault, release the whole aligned 64 KiB block in one
InvalidateMemorycall when it is mapped, holds no GPU-modified data and nocached image; otherwise per page as before.
Measured: write faults -> 8,000-20,000/s, TLB flushes halved or better.
In-game FPS is unchanged by this commit (~6-7 FPS in the first cave); the
remaining limit there is per-draw work on the GPU thread (~40 us x ~3,000
draws per frame, while the GPU itself needs ~33 ms per frame).
Platforms
no platform-specific parts. CI will need your approval to run.
Testing
7b9997b.resource_tracking,resource_materialization,memory_tracker,page_manager,scalar_provenance,shader_vertex_metadatapass;shader_recompiler_computepasses on an RX 7900 XTX (RADV, Mesa 26.1.6)except
GpuTilerCpuParity(detile bytes family=4 bpe=1), which fails thesame way on unpatched
7b9997b.tests/ResourceMaterializationTests.cppline 246 (
indirect_descriptor.emplace()) does not compile on main,because the nested
IndirectDescriptoris not default-constructible insidestd::optional::emplace()there. I assignedIndirectDescriptor {}locallyto run the suite; that edit is not part of this PR.
first-start screens, main menu, character creation, opening cutscenes and
the first playable area; skin shading verified against RenderDoc captures.
No fatal errors in the log.
.pre-commit-config.yaml.AI use
The investigation and the changes were developed with an AI assistant
(Claude): reproducing the crashes, RenderDoc and perf analysis, writing the
patches, and drafting this description.
With own words: Hogwarts Legacy crashed before right on the Disclaimer. Now the fixes went one by one, to reach the setup screen, then to reach main menu, after game scene. Skin tones which has been adressed. Also there was an initial stuck around 28s at frame 463-464, which has been reduced to 1s. All this has been hand tested.
The FPS is still low, but now the game boots at least and usable in game.
@coderabbitai[bot] on GitHub · 2026-10-09 11:56 UTC · original · edited 2026-10-09 12:56 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
ae8e5bfb-c600-4d70-80cc-4ea405e235be📥 Commits
Reviewing files that changed from the base of the PR and between c8f9d77f0e310ccf87821939e72191c3db67c109 and
90e8c1fec2.📒 Files selected for processing (1)
src/graphics/host_gpu/renderer/cache/textureCache.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
The renderer changes adjust depth metadata checks, invalid image-clear handling, eligible CPU buffer fills, and write-fault cache invalidation. The shader changes add non-cube sample offsets and indirect gather emission. The runtime validation changes add per-thread validation sessions, cycle-aware verdict caching, instruction-result reuse, and support for indirect images used by raw gathers.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
90e8cOut-of-range base-mip clears are skipped rather than aborting. No actionable merge-blocking risk remains from the reviewed changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-10-09 11:56 UTC · original
On
src/graphics/host_gpu/renderer/cache/textureCache.cppline 1606 (outdated):🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Include the base mip in the skipped-clear check.
Line 1601 still calls
EXIT_IFwhenrange.baseMipLevel >= image.info.resources.levels. An out-of-range base mip therefore aborts before the new diagnostic and return path runs. Move that check into the skip condition. Check the base mip before subtracting it fromresources.levels.@coderabbitai[bot] on GitHub · 2026-10-09 11:56 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
66fa6bf8-d5dc-4937-aa8d-08423d6d5766📥 Commits
Reviewing files that changed from the base of the PR and between
7b9997baeaand c8f9d77f0e310ccf87821939e72191c3db67c109.📒 Files selected for processing (8)
src/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/pipeline/descriptors.cppsrc/graphics/host_gpu/renderer/renderCompute.cppsrc/graphics/host_gpu/renderer/renderContext.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cppsrc/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.cppsrc/graphics/shader/recompiler/ir/passes/SrtWalker.hIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Nmzik on GitHub · 2026-10-11 16:58 UTC · original · edited 2026-10-11 17:05 UTC
@netwarex Thanks for contribution. Credited & pushed changes to main. I'll try to find general solution for
145ba3e1d1. Dont close PR984cfcebd1df0412afb5f28c0fccb24c87dbebb2@netwarex on GitHub · 2026-10-14 12:53 UTC · original
@Nmzik Thanks! I have tested. I have a stuck which as been fixed with my commits, and research showing this:
On main
9e41d83, Hogwarts Legacy (PPSA01603) stalls for 1+ minute around frame 513–556 while compiling a compute shader.1cfb952did not stall there.The GPU thread is stuck in:
Since
df08b83, each fold that changes an instruction re-queues the full transitive closure of its users, so the pass becomes roughly quadratic on large UE4 compute shaders.As a local test I folded each instruction once again, as before
df08b83: no re-queue after a change, and none in the PHI normalization loop. With that, the stall is gone and the game continues normally. That drops the late foldsdf08b83added, so I'm not proposing it as the fix. Could the re-queue be limited to direct users, or to a small depth for the nested pattern folds?View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.