Skip to content

Instantly share code, notes, and snippets.

@vjt
Created November 26, 2026 20:09
Show Gist options
  • Select an option

  • Save vjt/02083a604fa64e4d5b8d3ef0a84c25cf to your computer and use it in GitHub Desktop.

Select an option

Save vjt/02083a604fa64e4d5b8d3ef0a84c25cf to your computer and use it in GitHub Desktop.
shadPS4: Days Gone, cleared CMask read as expanded

Days Gone (CUSA09175): cleared CMask read back as expanded

The UI overlay is fast cleared and nothing is drawn on it. BufferCache::SynchronizeMemoryFromImage fills its CMask buffer with 0xFFFFFFFF anyway, so the game's compute pass composites the whole overlay, which still holds an older pass. Filling a cleared CMask with 0 removes the copies.

RenderDoc capture of one frame, intro cutscene:

event what
e109777 subsurface setup pass renders into image 22040 (R8G8B8A8Srgb 1920x1080 at 0x21e220000), 65% dynamic resolution
e110239 vkCmdFillBuffer 0xFFFFFFFF on the CMask at 0x21ea18000, from SynchronizeMemoryFromImage. All 5 fills of the frame come from there; no guest compute shader writes the CMask
e110244 guest CS decodes the CMask into a 240x135 R8Uint tile mask at 0x21ece4c00: 15 on every tile
e110249 guest CS composites binding 7 = image 22040 as the UI overlay on every tile the mask marks
file shows
overlay-e110249-binding7.png image 22040 as bound at e110249
before-120.png, before-180.png intro at 120 s and 180 s without the change
after-120.png, after-180.png same times with the change
Before After

Runs with the change: Days Gone intro 200 s, no copies, no assert. 120 s smoke of God of War, Miles Morales, Shadow of the Tomb Raider, LEGO Batman 3, Crash Bandicoot 4, Need for Speed Hot Pursuit, Minecraft, Cyberpunk 2077: all alive, 0 asserts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment