AGC: depth EQUAL misses 187 D16 values after a storage write to a D16S8 plane held as D24S8 #28611
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by zeezey on 2026-12-02T01:24:40Z.
What happens
Depth EQUAL fails for 187 of the 65,536 D16 values after a storage write to the depth plane of a D16_UNORM_S8_UINT surface held as D24_UNORM_S8_UINT. Low priority: no title is known to hit it.
Title, test or build step
A local execution test (not in the tree; I can open it as a PR if wanted). No title.
AnyPS5 commit
mainat7d3d015fee, nothing on top.System
Windows 11, RTX 4090, driver 621.24, MinGW-w64 GCC, Release.
Host report
The host depth format for D16S8 is D24_UNORM_S8_UINT (the fallback from #18185).
Steps to reproduce
float(id) / 65535for every id 0..65535 into the D16 depth plane through a storage image, one texel per id. The plane is held as D24, sod16ToD24inGraphics/shaders/DepthConvert.compconverts it.z = id / 65535, the same value written asid * (1/65535)orfloat(id) / 65535, over that texel, and the covered count is read back.z = id / 65535, then a compute reads the plane as 16 bits and compares it withid.The run takes about 60 s.
Log
id * 16777215 / 65535sits close to x.5.d16ToD24and a model of the rasterizer'sround(z * 16777215)give the same D24 for these ids.(S + d) / 16777215for d = -2..2 around the modelled value S also cover nothing.So the plane does not seem to hold the value either model predicts, or the draw's z doesn't quantize the way I modelled it. I have not found which. The reverse direction (D24 to D16) is exact for every id.
A possibly simpler conversion: map the 16-bit code straight to D24 in integer arithmetic,
id * 256 + ((id + 128) >> 8), which roundsid * 16777215 / 65535to nearest, ties up. That would avoid the float step. I have not tested it against the rasterizer.AI-assisted: yes.