renderer: do not treat leftover depth-view write disables as a bound … #443

Closed
github-bot wants to merge 1 commit from gh-pr/443/head into gh-pr/443/base
Owner

@⁠MehmetCambaz on GitHub · 2026-09-01 18:44 UTC · original
MehmetCambaz:ai/work/depth-view-write-disable → main · +7 −4 · 1 files · 1 commits · closed without merging

Summary

Teardown (PPSA15246) exits about a second into boot with:

Depth target fatal: unsupported depth register state
in src/graphics/host_gpu/renderer/depthRenderTarget.cpp:37

ResolveRenderDepthTarget decides an attachment is unbound only when every field of the
depth-target register block reads back at its reset value. Two of the fields it requires
to be clear are DB_DEPTH_VIEW's Z_WRITE_DISABLE and STENCIL_WRITE_DISABLE. Those bits say
how an attachment is used, not whether one is bound, and they survive an unbind like the
rest of the register.

Dumped with --graphics-debug-dump, the register block at the failing draw is empty apart
from exactly those two bits:

  • z_info.format = kInvalid, stencil_info.format = kInvalid, num_samples = 0
  • z_read, z_write, stencil_read, stencil_write and htile_data base addresses all 0
  • size.x_max = 0, size.y_max = 0, shading_rate_encoding = 0
  • depth_view.depth_write_disable = true, depth_view.stencil_write_disable = true

There is no depth attachment: no format, no address, no extent. Because the two
write-disable bits are set, attachment_unbound is false, the early return is skipped, and
the compound check below it trips on z_read_base_addr == 0, which reports as "unsupported
depth register state" and ends the process.

The draw itself is a small depth-less render-to-texture pass, 4 indices into a 42x42
target at mip view 1, issued after a read-only depth pass.

Dropping the two bits cannot mask a real attachment. A read-only depth target still has a
valid z_info.format and a non-zero z_read_base_addr, and both are separate terms in the
same predicate, so it still fails attachment_unbound and is handled by the read-only
paths from 6f9ed6f and 1190d5d.

Same class as 6453baf (#425), fb5ecec and 3005a21: leftover depth/stencil register state
must not be read as a binding.

Test plan

Windows 11, clang-cl 20.1.8, RTX 2060, Release. Baseline and candidate built from the
same tree on 0c4dfd5.

  • ctest 34/36, unchanged from the baseline. shader_recompiler_compute and
    texture_cache_image_overlap fail on pristine upstream/main as well, deterministically,
    both on RenderExecutorStencilBindingDiscovery "depth texture compatibility identity".
    Reported separately; this change does not affect them.
  • Teardown PPSA15246 (contentVersion 01.070.100): baseline stops at 3 compiled shaders
    with the fatal above. With this change the fatal is gone and it reaches 19 compiled
    shaders before stopping on an unrelated limitation, "storage buffer offset adjustment
    is unsupported" in descriptors.cpp. So this does not make Teardown boot, and none is
    claimed. It removes one blocker.
  • Regression, both checked against a screenshot rather than a frame counter:
    Tetris Forever PPSA25646, 60 fps in gameplay, rendering correct.
    PAC-MAN WORLD 2 Re-PAC PPSA18189 (with a local _umtx_op patch, since it does not boot
    without one), Pac-Village in 3D with occlusion, transparency, foliage layering and
    ground shadows all correct. That is the meaningful test here, as Tetris barely
    exercises depth targets.

Only one title is known to hit this. The predicate is on the universal draw path, so any
title issuing a depth-less draw after a read-only depth pass would hit it, but I have not
identified another by name.

AI use

Written with AI assistance (Claude). It found the failure, dumped the registers, isolated
which term of the compound check fired, made the change, and ran the builds, the tests
and the game runs described above on my machine. I reviewed the diff.

**@⁠MehmetCambaz** on GitHub · 2026-09-01 18:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/443) `MehmetCambaz:ai/work/depth-view-write-disable` → `main` · +7 −4 · 1 files · 1 commits · closed without merging Summary Teardown (PPSA15246) exits about a second into boot with: Depth target fatal: unsupported depth register state in src/graphics/host_gpu/renderer/depthRenderTarget.cpp:37 ResolveRenderDepthTarget decides an attachment is unbound only when every field of the depth-target register block reads back at its reset value. Two of the fields it requires to be clear are DB_DEPTH_VIEW's Z_WRITE_DISABLE and STENCIL_WRITE_DISABLE. Those bits say how an attachment is used, not whether one is bound, and they survive an unbind like the rest of the register. Dumped with --graphics-debug-dump, the register block at the failing draw is empty apart from exactly those two bits: - z_info.format = kInvalid, stencil_info.format = kInvalid, num_samples = 0 - z_read, z_write, stencil_read, stencil_write and htile_data base addresses all 0 - size.x_max = 0, size.y_max = 0, shading_rate_encoding = 0 - depth_view.depth_write_disable = true, depth_view.stencil_write_disable = true There is no depth attachment: no format, no address, no extent. Because the two write-disable bits are set, attachment_unbound is false, the early return is skipped, and the compound check below it trips on z_read_base_addr == 0, which reports as "unsupported depth register state" and ends the process. The draw itself is a small depth-less render-to-texture pass, 4 indices into a 42x42 target at mip view 1, issued after a read-only depth pass. Dropping the two bits cannot mask a real attachment. A read-only depth target still has a valid z_info.format and a non-zero z_read_base_addr, and both are separate terms in the same predicate, so it still fails attachment_unbound and is handled by the read-only paths from 6f9ed6f and 1190d5d. Same class as 6453baf (#425), fb5ecec and 3005a21: leftover depth/stencil register state must not be read as a binding. Test plan Windows 11, clang-cl 20.1.8, RTX 2060, Release. Baseline and candidate built from the same tree on 0c4dfd5. - ctest 34/36, unchanged from the baseline. shader_recompiler_compute and texture_cache_image_overlap fail on pristine upstream/main as well, deterministically, both on RenderExecutorStencilBindingDiscovery "depth texture compatibility identity". Reported separately; this change does not affect them. - Teardown PPSA15246 (contentVersion 01.070.100): baseline stops at 3 compiled shaders with the fatal above. With this change the fatal is gone and it reaches 19 compiled shaders before stopping on an unrelated limitation, "storage buffer offset adjustment is unsupported" in descriptors.cpp. So this does not make Teardown boot, and none is claimed. It removes one blocker. - Regression, both checked against a screenshot rather than a frame counter: Tetris Forever PPSA25646, 60 fps in gameplay, rendering correct. PAC-MAN WORLD 2 Re-PAC PPSA18189 (with a local _umtx_op patch, since it does not boot without one), Pac-Village in 3D with occlusion, transparency, foliage layering and ground shadows all correct. That is the meaningful test here, as Tetris barely exercises depth targets. Only one title is known to hit this. The predicate is on the universal draw path, so any title issuing a depth-less draw after a read-only depth pass would hit it, but I have not identified another by name. AI use Written with AI assistance (Claude). It found the failure, dumped the registers, isolated which term of the compound check fired, made the change, and ran the builds, the tests and the game runs described above on my machine. I reviewed the diff.
ResolveRenderDepthTarget decides an attachment is unbound only when every field of the
depth-target register block reads back at its reset value. Two of the fields it requires to be
clear are DB_DEPTH_VIEW's Z_WRITE_DISABLE and STENCIL_WRITE_DISABLE, which do not describe
whether an attachment exists -- they describe how one is used, and they persist across an unbind
exactly like the rest of the register.

A title that renders a depth-less pass after a read-only depth pass therefore reaches the
compound register check with no attachment at all, trips z_read_base_addr == 0, and the emulator
exits with "unsupported depth register state".

Teardown (PPSA15246) does this on its third shader, roughly one second into boot, and cannot
start. The depth register block at that draw is empty apart from the two write-disable bits:

  z_info.format = kInvalid, stencil_info.format = kInvalid, num_samples = 0,
  z_read/z_write/stencil_read/stencil_write/htile_data base addresses all 0,
  size.x_max = 0, size.y_max = 0, shading_rate_encoding = 0,
  depth_view.depth_write_disable = true, depth_view.stencil_write_disable = true

Dropping the two bits from the predicate cannot mask a real attachment: a read-only depth target
still carries a valid format and a non-zero read address, so it fails the format and address
terms and is handled by the paths added for read-only backing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:21:11 +00:00
github-bot closed this pull request 2026-11-26 09:21:11 +00:00

Pull request closed

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