vkback: D32_SFLOAT_S8_UINT where the device has no D16_UNORM_S8_UINT #170

Manually merged
github merged 1 commit from github-bot/gh-170 into gh-pr/170/base 2026-12-02 19:44:39 +00:00 AGit
Owner

@⁠360900 on GitHub · 2026-12-01 23:12 UTC · original
360900:feat/d16s8-stand-in → main · +82 −3 · 7 files · 1 commits · merged 2026-12-02 19:43 UTC

What

  • make_image refuses a format the device lacks instead of creating it (undefined; NVIDIA's driver divides by zero at the clear).
  • Where the device has no D16_UNORM_S8_UINT (DXGI 118 to 120), D32_SFLOAT_S8_UINT stands in. The depth bias keeps the console's 16-bit unit: VK_EXT_depth_bias_control with the UNORM representation forced and the constant factor times 256.
  • VKB_NO_D16S8=1 runs the stand-in on a device that has the format (rule 38). The log names the path.

The reference

vkd3d-proton vkd3d_get_depth_bias_representation (vkd3d_private.h) forces the UNORM representation for D16 and D24 the same way; its D24 on D32 stand-in is the same choice of format. The existing D24 mapping is left as it is.

Evidence

  • RTX 5080, NVIDIA 620.73.04, Linux 7.3, which has no D16_UNORM_S8_UINT: 2 such images in the world. Before, 19,392 draws in 300 s lost their depth target; with this none does, and the saved frames show the scene's depth-tested parts.
  • Validation run (layer 1.4.363, start to the first minutes in the world, 480 s): no depth format or depth bias error.
  • Unit test a_float_stand_in_for_16_bit_depth_keeps_the_bias_unit (the production pipejob::depth_bias).
  • docs/learnings/parity.md has the row.
  • Not shown: RADV (no AMD card here). It has the format, so nothing changes there unless VKB_NO_D16S8=1.
  • In-game and validation results are from the build with all nine NVIDIA pull requests: the title does not start on this driver without the umem one.

Checklist (docs/AGENTS.md)

  • One topic (rule 31); docs/TASKS.md not edited (rule 29)
  • "Allow edits by maintainers" on; after review, no force-push and no close-and-reopen
  • No fallback or second path for a case that can't happen (rule 33); unexpected input fails loudly (rule 9): a format the device lacks is refused loudly
  • Constants come from the console, the hardware or the title's data (rule 9b): the factor 256 is 2^24 / 2^16
  • Every switch is listed, read in one place, and a bad value stops the start (rule 2): VKB_NO_D16S8 (test)
  • Queues and other externally synchronized Vulkan objects are used under their lock (rule 35)
  • Every unsafe block has a // SAFETY: comment (rule 36): no new unsafe
  • Clippy clean; tests call the production code; TRANSLATOR_VERSION: the translator is not touched (rule 27)
  • Comments say what is true now and name functions, not line numbers (rule 3)
  • Nothing from the title, and no pointers to where non-free data can be found
**@⁠360900** on GitHub · 2026-12-01 23:12 UTC · [original](https://github.com/vktory6/VKtory/pull/170) `360900:feat/d16s8-stand-in` → `main` · +82 −3 · 7 files · 1 commits · merged 2026-12-02 19:43 UTC ## What - `make_image` refuses a format the device lacks instead of creating it (undefined; NVIDIA's driver divides by zero at the clear). - Where the device has no D16_UNORM_S8_UINT (DXGI 118 to 120), D32_SFLOAT_S8_UINT stands in. The depth bias keeps the console's 16-bit unit: `VK_EXT_depth_bias_control` with the UNORM representation forced and the constant factor times 256. - `VKB_NO_D16S8=1` runs the stand-in on a device that has the format (rule 38). The log names the path. ## The reference vkd3d-proton `vkd3d_get_depth_bias_representation` (vkd3d_private.h) forces the UNORM representation for D16 and D24 the same way; its D24 on D32 stand-in is the same choice of format. The existing D24 mapping is left as it is. ## Evidence - RTX 5080, NVIDIA 620.73.04, Linux 7.3, which has no D16_UNORM_S8_UINT: 2 such images in the world. Before, 19,392 draws in 300 s lost their depth target; with this none does, and the saved frames show the scene's depth-tested parts. - Validation run (layer 1.4.363, start to the first minutes in the world, 480 s): no depth format or depth bias error. - Unit test `a_float_stand_in_for_16_bit_depth_keeps_the_bias_unit` (the production `pipejob::depth_bias`). - docs/learnings/parity.md has the row. - Not shown: RADV (no AMD card here). It has the format, so nothing changes there unless `VKB_NO_D16S8=1`. - In-game and validation results are from the build with all nine NVIDIA pull requests: the title does not start on this driver without the umem one. ## Checklist (docs/AGENTS.md) - [x] One topic (rule 31); `docs/TASKS.md` not edited (rule 29) - [x] "Allow edits by maintainers" on; after review, no force-push and no close-and-reopen - [x] No fallback or second path for a case that can't happen (rule 33); unexpected input fails loudly (rule 9): a format the device lacks is refused loudly - [x] Constants come from the console, the hardware or the title's data (rule 9b): the factor 256 is 2^24 / 2^16 - [x] Every switch is listed, read in one place, and a bad value stops the start (rule 2): `VKB_NO_D16S8` (test) - [x] Queues and other externally synchronized Vulkan objects are used under their lock (rule 35) - [x] Every `unsafe` block has a `// SAFETY:` comment (rule 36): no new `unsafe` - [x] Clippy clean; tests call the production code; `TRANSLATOR_VERSION`: the translator is not touched (rule 27) - [x] Comments say what is true now and name functions, not line numbers (rule 3) - [x] Nothing from the title, and no pointers to where non-free data can be found
An image in a format the device lacks is refused. The stand-in's depth bias keeps the console's 16-bit unit (VK_EXT_depth_bias_control); VKB_NO_D16S8=1 runs it on a device that has the format.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 23:16:49 +00:00
github-bot changed target branch from main to gh-pr/170/base 2026-12-02 19:44:38 +00:00
github manually merged commit 8cc361e65a into gh-pr/170/base 2026-12-02 19:44:39 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 19:43 UTC · original

Merged, thanks. Checked together with the rest of the NVIDIA set on the reference card (RX 9070 XT): unit tests pass, and a house validation run with all six applied showed no new validation errors, no device loss and the expected counters.

One note for the record: the reference card has D16_UNORM_S8_UINT, so that run took the native path. The stand-in path (VKB_NO_D16S8=1, D32_SFLOAT_S8_UINT with the forced UNORM bias representation) is not tested on our card yet; your NVIDIA runs are its only evidence so far. A report from a run with VKB_NO_D16S8=1 on RADV is welcome.

**@⁠vktory6** on GitHub · 2026-12-02 19:43 UTC · [original](https://github.com/vktory6/VKtory/pull/170#issuecomment-7356620389) Merged, thanks. Checked together with the rest of the NVIDIA set on the reference card (RX 9070 XT): unit tests pass, and a house validation run with all six applied showed no new validation errors, no device loss and the expected counters. One note for the record: the reference card has D16_UNORM_S8_UINT, so that run took the native path. The stand-in path (`VKB_NO_D16S8=1`, D32_SFLOAT_S8_UINT with the forced UNORM bias representation) is not tested on our card yet; your NVIDIA runs are its only evidence so far. A report from a run with `VKB_NO_D16S8=1` on RADV is welcome.
This discussion has been locked. Commenting is limited to contributors.
No description provided.