Fix stencil synchronization and missing DOOM menu text #545

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

@⁠OldKrab on GitHub · 2026-09-09 14:05 UTC · original
OldKrab:shushakov/290-stencil-transfer → main · +309 −24 · 3 files · 3 commits · closed without merging

Related issue: #290.

DOOM + DOOM II displays white backgrounds around glyphs and loses menu letters. Stencil buffer contents were not uploaded into Vulkan images, and garbage collection could discard rendered glyph atlases when older buffer writes blocked readback.

This change:

  • Uploads stencil contents and refreshes them after guest writes.
  • Prevents pending uploads from undoing optimized stencil clears.
  • Preserves stencil contents when images are replaced or garbage-collected.
  • Retains potentially current atlas images while allowing GC to reach other reclaimable images.

Changed depth/stencil pairings remain unsupported: log once and continue, accepting possible rendering artifacts. Retained images may occupy GPU memory longer.

Validated on Linux/NVIDIA with DOOM startup and collection menus, the existing GPU cache suite, and new regressions for clear/rebind, stencil retirement, and GC progress. Each regression failed before its fix and passes afterward. Windows/AMD and long gameplay remain unverified.

Screenshots

DOOM + DOOM II startup screen on Linux/NVIDIA, without debugger overrides.

Before After
Before: white glyph backgrounds and missing options After: readable text and restored options
**@⁠OldKrab** on GitHub · 2026-09-09 14:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/545) `OldKrab:shushakov/290-stencil-transfer` → `main` · +309 −24 · 3 files · 3 commits · closed without merging Related issue: [#290](https://git.gtahub.st/github/KytyPS5--KytyPS5/issues/290). DOOM + DOOM II displays white backgrounds around glyphs and loses menu letters. Stencil buffer contents were not uploaded into Vulkan images, and garbage collection could discard rendered glyph atlases when older buffer writes blocked readback. This change: - Uploads stencil contents and refreshes them after guest writes. - Prevents pending uploads from undoing optimized stencil clears. - Preserves stencil contents when images are replaced or garbage-collected. - Retains potentially current atlas images while allowing GC to reach other reclaimable images. Changed depth/stencil pairings remain unsupported: log once and continue, accepting possible rendering artifacts. Retained images may occupy GPU memory longer. Validated on Linux/NVIDIA with DOOM startup and collection menus, the existing GPU cache suite, and new regressions for clear/rebind, stencil retirement, and GC progress. Each regression failed before its fix and passes afterward. Windows/AMD and long gameplay remain unverified. ### Screenshots DOOM + DOOM II startup screen on Linux/NVIDIA, without debugger overrides. | Before | After | | --- | --- | | ![Before: white glyph backgrounds and missing options](https://raw.githubusercontent.com/OldKrab/KytyPS5/88c32d04d7cea9d8b891ec92caa31c72c0b2b0ad/startup-before.png) | ![After: readable text and restored options](https://raw.githubusercontent.com/OldKrab/KytyPS5/88c32d04d7cea9d8b891ec92caa31c72c0b2b0ad/startup-after.png) |
Apply the project-pinned clang-format 22.1.3 to the texture cache source and header. No behavior changes.
Upload uncompressed single-sample stencil contents into Vulkan images and refresh them after guest writes. Optimized stencil clears supersede pending uploads; partial clears first preserve untouched subresources. Save stencil contents on replacement and pressure retirement.

Changed depth/stencil pairings remain unsupported: warn once and continue with the existing association behavior, accepting possible rendering artifacts.

Initialize the existing stencil fixture GPU worker and support the NV compute-derivatives extension on older drivers. GPU regressions cover CPU/GPU writes followed by full/partial stencil clears and depth rebinding, plus stencil contents after pressure retirement and recreation.

Validation: the new regression sequences fail before their fixes and pass afterward in the existing image-overlap GPU suite. The final build passes the suite and the DOOM startup screenshot check; startup and collection text render correctly on Linux/NVIDIA without debugger overrides. Windows/AMD and long gameplay remain unverified.
Retain potentially current image contents when older buffer dirty ranges block readback, fixing missing DOOM menu letters. Keep the existing guard against overwriting newer buffer contents.

Move retained entries to the end of the LRU list so bounded GC scans can reach unrelated reclaimable images. A regression places 40 retained images ahead of a clean one and checks collection progress under normal and critical pressure.

This conservative policy can retain ambiguous image contents longer until invalidation or safe readback.

Validation: the new regression sequences fail before their fixes and pass afterward in the existing image-overlap GPU suite. The final build passes the suite and the DOOM startup screenshot check; startup and collection text render correctly on Linux/NVIDIA without debugger overrides. Windows/AMD and long gameplay remain unverified.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:02 +00:00
github-bot closed this pull request 2026-11-26 09:25:02 +00:00
Author
Owner

@⁠Nmzik on GitHub · 2026-09-23 16:56 UTC · original

Credited

**@⁠Nmzik** on GitHub · 2026-09-23 16:56 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/545#issuecomment-5799055341) Credited

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.