A Game About Digging A Hole: fix crash, GPU hang and grey image on AMD (Windows) #2302
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!2302
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2302"
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?
@Oskie5802 on GitHub · 2026-11-16 17:15 UTC · original
Oskie5802:digging-hole-amd-mesh→main· +518 −365 · 7 files · 4 commits · openGame:
A Game About Digging A Hole (PPSA30552, 01.100.000)
Problem:
On an AMD Radeon RX 6600 (Windows 11, Adrenalin 26.10.1) the game never showed a correct image:
vkCreateGraphicsPipelineson the first mesh shader.VK_ERROR_DEVICE_LOST).On NVIDIA the game renders in colour (see #2249), so all three are specific to AMD's Windows driver.
Changes:
One commit per problem:
Layeroutput is declared as aBlockmember, the way glslangdeclares
gl_MeshPrimitivesEXT. A barePerPrimitiveEXTLayer array crashes the driver.of a task shader.
DrawIndirectMultinow reads the records back from the GPU first, because thegame writes them there.
Linto layerL mod 8, so the game's 32-layer colour-grading LUT had only 8 layers filled.All three workarounds are limited to vendor
0x1002on Windows.Evidence
Before:

After:
Standalone repro of the Layer bug outside the emulator: layer
ilands in slicei mod 8.Testing
resource_materializationfails on unmodifiedmaintoo.Known remaining issue
Black 128x128 px squares appear during the intro and cutscene on this card (motion blur). reported in #2303 .
Formatting
The clang-format hook reformatted the touched files, which is most of the line count.
AI use
The investigation and the code were done with Claude Fable 5.2. I reviewed the changes and
tested them on my own hardware as described, this description are writted by human - Me :) and corrected by AI
Fixes #2249
@coderabbitai[bot] on GitHub · 2026-11-16 17:27 UTC · original · edited 2026-11-17 13:41 UTC
Walkthrough
The change adds chunked layered mesh rendering for eligible non-task mesh draws. It updates pipeline setup and SPIR-V generation to pass a layer-chunk index, filter mesh primitives, and adjust pixel-stage Layer inputs. It also changes Windows AMD indirect mesh draws to avoid the task-shader path. Separately, the CPU indirect-draw fallback reads its records through the buffer cache.
Suggested reviewers:
nmzik,senaxxChange: Bug fix
Merge Risk:
Moderate · up to
7124aThe change fixes the crash, GPU hang and grey image on AMD Windows. Layered mesh draws that write buffers can double-apply those writes, and a pixel shader that reads Layer without user data or buffers can fail pipeline creation. Both are narrow, but they should be fixed or explicitly accepted before merge.
Pre-merge checks:
4
Full details: Title check
Explanation
The title names the game, the three problems fixed (crash, GPU hang, grey image), and the AMD/Windows scope. The changeset adds AMD/Windows-specific workarounds for each of these: a Layer block-member declaration fix in the mesh emitter, CPU-path routing for indirect mesh draws with a buffer read-back, and per-8-layer chunked mesh draws. The title is a single sentence and matches the main change. It is somewhat long at 81 characters, but it is clear and specific.
Full details: Description check
Explanation
The description states a concrete problem (crash in vkCreateGraphicsPipelines, GPU hang, grey image on an AMD Radeon RX 6600 under Windows), lists three specific changes (Layer declared as a Block member, CPU path for indirect mesh draws with readback, layered mesh draws run per 8 layers), and gives testing notes and a known remaining issue. These map directly onto the changeset in the shader, graphics, pipeline, and render files. The description is related to the changes and not off-topic, so the check passes.
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
@ -639,0 +638,4 @@const uint64_t extent =resource.OutOfBounds() == 2? resource.Base48() - buffer.addr +ShaderRecompiler::Format::GetFormatInfo(resource.Format()).byte_size@coderabbitai[bot] on GitHub · 2026-11-16 17:27 UTC · original · edited 2026-11-16 18:44 UTC
Preserve the existing vertex-format fallbacks when sizing buffers.
For
stride=0,NumRecords=16,OutOfBounds()==2, and raw format113,GetFormatInfo(resource.Format()).byte_sizeis zero. With no address offset, this makesAcquireVertexBuffersbind a zero-length null buffer. However,InputFormatexplicitly accepts format113through itsR32G32B32A32Sfloatfallback. The previous size was 16 bytes. Derive the extent from the effective host format, including these fallbacks. (raw.githubusercontent.com)@coderabbitai[bot] on GitHub · 2026-11-16 17:27 UTC · original · edited 2026-11-16 18:43 UTC
On
src/graphics/host_gpu/renderer/renderDraw.cppline 1214 (outdated):Initialize the chunk slot even when the mesh shader has no Layer output.
On Windows AMD, pipeline setup reserves this slot and enables the pixel-stage adjustment for every mesh draw. This block initializes the slot only when the mesh shader exports
Layer.After a 32-layer draw leaves chunk
3in the slot, a mesh draw without that output can reuse the value. A pixel shader that readsLayerthen receives24instead of0. Initialize every reserved chunk slot to zero before the output check. Vulkan uses the first layer when the mesh interface has noLayeroutput. (docs.vulkan.org)✅ Confirmed as addressed by @Oskie5802
@ -1225,0 +1271,4 @@vk_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline.pipeline);// Each chunk counts its own samples; the dump adds the queries up.const int32_t chunk_query = occlusion_queries.Begin(vk_buffer);vk_buffer.drawMeshTasksEXT(mesh_groups, draw.instance_count, 1);@coderabbitai[bot] on GitHub · 2026-11-16 17:27 UTC · original · edited 2026-11-16 18:43 UTC
Preserve mesh shader side effects across chunk replays.
A 32-layer draw executes the complete guest mesh program four times. If that program increments a buffer counter once per workgroup, the counter increments four times. The chunk filter cannot prevent this:
EmitMeshEntryPointcallsmesh_guest_funcbefore it applies primitive culling. Preserve one execution of guest side effects, or use a separate path for side-effecting mesh programs. Adding barriers alone does not correct the duplicate writes. (raw.githubusercontent.com)Count occlusion samples from every chunk.
The native occlusion query ends before this loop. If a 16-layer draw has visible geometry only in Layer
9, chunk zero contributes no samples. Chunk one renders that geometry outside any query, so the guest receives zero samples.Begin and end a query inside each chunk's rendering scope. Let
OcclusionQueriesaggregate those results through its existing dump path. (raw.githubusercontent.com)@coderabbitai[bot] on GitHub · 2026-11-16 17:27 UTC · original · reviewed
Actionable comments posted: 4
d2fe9d0a-1563-4531-9e2e-bccfdef62234Reviewing files that changed from the base of the PR and between
41e2147c07and 0cbda940517908cbd16b4a518202ab9b621b2868.src/graphics/guest_gpu/graphicsRun.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterFlow.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMesh.cppsrc/graphics/shader/shader.cppsrc/graphics/shader/shader.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
@Oskie5802 on GitHub · 2026-11-16 18:43 UTC · original
On
src/graphics/host_gpu/renderer/renderDraw.cppline 1214 (outdated):Fixed in 8e5e654a. The chunk is now reset to 0 for every draw that has the slot, not only for mesh shaders with a Layer output.
@ -1225,0 +1271,4 @@vk_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline.pipeline);// Each chunk counts its own samples; the dump adds the queries up.const int32_t chunk_query = occlusion_queries.Begin(vk_buffer);vk_buffer.drawMeshTasksEXT(mesh_groups, draw.instance_count, 1);@Oskie5802 on GitHub · 2026-11-16 18:43 UTC · original
fixed in 8e5e654a, each chunk now runs inside its own query and the existing dump sums them.
Side effects: you're right that the guest mesh program runs once per chunk. I left it as is for now. The only layered mesh draw I've seen in this game is the colour grading LUT and that shader doesn't write to any buffer. Doing it properly would need a separate path for mesh programs with buffer writes, which felt too big for this PR. Happy to add a guard if the maintainers prefer.
@ -639,0 +638,4 @@const uint64_t extent =resource.OutOfBounds() == 2? resource.Base48() - buffer.addr +ShaderRecompiler::Format::GetFormatInfo(resource.Format()).byte_size@Oskie5802 on GitHub · 2026-11-16 18:43 UTC · original
I didn't change this code, it only shows up in the diff because the clang-format hook reformatted the whole file. Behaviour here is the same as on main.
@ -639,0 +638,4 @@const uint64_t extent =resource.OutOfBounds() == 2? resource.Base48() - buffer.addr +ShaderRecompiler::Format::GetFormatInfo(resource.Format()).byte_size@coderabbitai[bot] on GitHub · 2026-11-16 18:44 UTC · original
@Oskie5802 You’re right. The diff only reformats the expression; it does not change the buffer size calculation. My statement that the previous size was 16 bytes was incorrect.
I’m withdrawing the finding for this PR. Sorry for the confusion.
Review thread resolved.
You are interacting with an AI system.
@ -1225,0 +1271,4 @@vk_buffer.bindPipeline(vk::PipelineBindPoint::eGraphics, pipeline.pipeline);// Each chunk counts its own samples; the dump adds the queries up.const int32_t chunk_query = occlusion_queries.Begin(vk_buffer);vk_buffer.drawMeshTasksEXT(mesh_groups, draw.instance_count, 1);@coderabbitai[bot] on GitHub · 2026-11-16 18:44 UTC · original
Analysis chain
Script executed:
Length of output: 8743
@Oskie5802Thanks for the fix and the context. Each chunk now has its own query, andOcclusionQueries::PublishDumpsadds the results to the running counter.I understand the decision to defer the mesh side-effects path. The reported colour-grading LUT has no buffer writes, but other mesh shaders can still repeat side effects. I won’t mark this thread as addressed while that concern remains.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
You are interacting with an AI system.
@virgil48YT on GitHub · 2026-11-16 18:48 UTC · original
This PR fixes Stray and gets it ingame for RDNA2 cards, before it was crashing with error code 0x4 with vkCreateGraphicsPipelines. Nice work!


@coderabbitai[bot] on GitHub · 2026-11-16 19:51 UTC · original · reviewed
daa72b5b-692c-475f-aeb3-f539447c7d3fReviewing files that changed from the base of the PR and between 8e5e654a0b0e5991fccf406cc311d672834d4037 and
7124af1870.src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/shader/recompiler/backend/spirv/spirvEmitterMesh.cppsrc/graphics/shader/shader.cppsrc/graphics/shader/shader.hIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
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.