Repository navigation
fix(agc): store D16 depth with stencil as D24 or D32 where the device lacks it - #3846
Conversation
|
Checked: every use of the depth format (image, view, sampled textures, render pass, dynamic rendering, Added one commit: a TechnicalDebt line under Functional for the D24/D32 precision difference and the D32 bias throw (checklist: unverified choices get a line). Merging once CI is green. |
b738cd4 to
7f5cd94
Compare
|
Conflicts with main in |
|
Rebase handoff — rebased onto current Two conflicts, both resolved: (1) Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
To pick it up: Head is |
7f5cd94 to
c2160f0
Compare
|
Took @blawesom's rebase (thanks!) and rebased it on main 2a5eca1. Per @oneandonlydean: |
c2160f0 to
574d7ec
Compare
|
Rebased on main d539606 (574d7ec). The only conflict was |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
… lacks it A 16-bit depth target with stencil maps to VK_FORMAT_D16_UNORM_S8_UINT, which NVIDIA devices do not support as an attachment, so creating it threw. The surface, its views and the pipelines now use the first of D16_UNORM_S8_UINT, D24_UNORM_S8_UINT and D32_SFLOAT_S8_UINT the device can attach and sample. Guest-side choices (16-bit sampled views, bias units) still follow the guest format. A constant depth bias is scaled by 256 for D24 storage; on D32 float storage it throws, as its unit depends on the depth value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The depth image is created with the host format, so the sample locations check for the image and for the pipeline asks about that format too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Checked the new head: Added one commit: dropped the duplicated |
574d7ec to
9387da4
Compare
What
A 16-bit depth target with stencil decodes to
VK_FORMAT_D16_UNORM_S8_UINT(State.cpp,zFormat == 1with stencil). NVIDIA devices do not offer that format as a depth/stencil attachment, soDepthSurfacethrewdepth/stencil format 128 cannot be an attachment on this device.The depth surface lives only on the host: it is cleared at creation and sampled through views, never copied from or to guest memory. So the host image can use a wider format:
HostDepthFormat(context, format): forD16_UNORM_S8_UINTit returns the first ofD16_UNORM_S8_UINT,D24_UNORM_S8_UINT,D32_SFLOAT_S8_UINTthat the device can attach and sample (cached per physical device). Every other format is returned unchanged.DepthSurfacecreates its image, view and sampled textures with it, and the pipeline uses it for the render pass attachment, the dynamic rendering formats and theBegindepth format.R16_UNORMor 16 depth bits) of the plane, the depth-bias units check indecodeDepthBias, and the pipeline keys.HostDepthBiasConstantscales it by 256 for D24 storage. For D32 float storage the unit depends on the depth value, so a non-zero constant there throws (not implemented). The slope factor needs no change.Tested
Windows 11, RTX 3070 (no
D16_UNORM_S8_UINTattachment support), GCC 15.2.0 UCRT, Release, on maina11c8f7f7.agc_driver_graphics(DepthSurfaceReuse.cpp,TestD16StencilFallback, mocked format properties): a device with D16S8 keeps it and its bias; a device without it creates the surface as D24S8, its R16 depth view and R8 stencil view still sample, and a bias of 2 becomes 512; a device with only D32S8 uses it, and a constant bias there throws.guest_kernel_sys,windows_exceptions,guest_filesystem,agc_driver_emulated_color_compare) fail the same way on main on this machine.agc_driver_prepared_shaders_debugfailed once under-j8and once in 3 runs alone. It then passed 6/6 here and 6/6 on main. It also failed once under-j8today on a branch that only changesApr.cpp, so it looks like an existing intermittent failure.tools/check_conventions.pypasses.buffer attributes are in use by a pending flip).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code