Skip to content

Classify D24 depth readback NaNs before floating-point rounding - #1247

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/d24-nan-readback
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
Vonsek:codex/d24-nan-readback

Conversation

@Vonsek

@Vonsek Vonsek commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #1218 (comment)

What and why

On Intel UHD 770 driver 32.0.101.6129, the existing compute readback test returned maximum D24 depth for NaN inputs, including 0x7fc00000. See the original reproduction.

Read the 32-bit input encoding before doing any floating-point comparisons. Unsigned encodings above positive infinity cover every negative input and every positive NaN. The remaining encodings at or above 1.0 saturate. The rounding path for finite depths in [0, 1) stays the same.

Tested

  • Windows, RTX 5080 (616.92, Vulkan 1.4.351) and AMD Radeon Graphics (32.0.21045.16010, Vulkan 1.4.315), Khronos validation enabled. Built and ran depth24_convert_test before and after. Both adapters passed every upload/round-trip depth word, the CPU-referenced float sample and pitched copies.
  • Added a GPU comparison for all 16,777,214 signed NaN encodings and both infinities. The expected word is zero except for positive infinity. Both adapters passed the added comparison on the merge base and the proposed change. The original reporter independently confirmed 23962cb6 on the same Intel UHD 770 / 32.0.101.6129. The all-payload check and existing reference checks passed, as they did on an RTX 4080 SUPER.
  • Negative control restricted the zero-return guard to negative inputs. Both devices reported exactly 8,388,607 mismatches, one for each positive NaN, starting at 0x7f800001.
  • Rebuilt the checked-in shader with glslc v2026.2, checked the included words against the compiled binary and validated it with spirv-val --target-env vulkan1.1.

Checklist

  • No game data, keys or decryption, including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. N/A for the runtime depth conversion pass.

AI-assisted implementation and testing.

Intel UHD 770 reports maximum depth for NaNs in the float comparison path. Check the input encoding before rounding finite values and exercise both signs of every NaN payload on the GPU.
@kapitche

Copy link
Copy Markdown
Contributor

Confirmed on the machine from the original report. Tested 23962cb on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51):

  • depth24_convert_test on the Intel UHD 770 (32.0.101.6129): depth24_convert_test: ok, including both infinities and all NaN payloads quantise correctly and 16777216 float patterns ... quantise like the reference. On main this GPU failed with f=7fc00000 got 16777215 want 0.
  • RTX 4080 SUPER (32.0.16.1714): ok, unchanged.
  • ctest: 61/61 on NVIDIA. On Intel, 59/61, where d3d12_vulkan_device (d3d12_vulkan_device_test: compare OPTIONS1 with the same GPU's host device, not the default adapter #962) and d3d12_descriptor (min-LOD truncation) also fail on main.

Thanks for picking it up.

@ItsNotRexed
ItsNotRexed merged commit 1302343 into ItsNotRexed:main Nov 22, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants