Repository navigation
d3d12: GetCopyableFootprints aligns from BaseOffset - #2498
iasmitionsalvatore wants to merge 1 commit into
Conversation
|
Independent Windows 11 build 26300 / RTX 5070 / driver 621.24 check of 750cf45. The stock I added a temporary comparison for the same 8×6×16 RGBA8 volume, asking for three subresources starting at index 1. For each of Reversing only the footprint implementation hunk left the same test running and produced 512/513 mismatches per method. Only residue zero matched. The CTest then failed at the expected footprint gate. I restored the temporary compatibility, probe, and reversal changes. Synthetic descriptors only. AI-assisted review. |
|
Heads-up on overlap: the second commit here (the A4B4G4R4 / |
|
Tested
In a separate build I kept the PR tests and restored the old runtime implementation. The footprint comparison failed as expected: for the first subresource of the 8×6×16 Synthetic tests only. AI-assisted (Codex). |
|
Tested 750cf45 (merged on current main) on RTX 3090, driver 616.56, Windows 11 23H2 (22631, in-box What the gates fix here: What still fails:
The
AI-assisted test run. |
|
Tested 750cf45 (merged onto main 4947579) on NVIDIA GeForce RTX 4060 Ti, driver 610.88 (32.0.16.1088), Windows 11 26200, MSVC 14.51.36231 (VS 2026), Vulkan SDK 1.4.363.0: pass
AI-assisted (Claude). |
|
Tested 750cf45 (on
AI-assisted (Claude Code). |
GetCopyableFootprints started the layout at BaseOffset and aligned every subresource to D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT as an absolute address. The PC runtime lays the subresources out from 0 and adds the base afterwards: with base 513 the host returns offset 513 for subresource 0, ours returned 1024, and the totals differed by the gap. GetCopyableFootprints1 wraps the same function. compare_footprints now also runs bases 513 and 2^32 + 1 (both unaligned) next to 0 and 1024. Against the hardware host device on an AMD Radeon RX 7600, on main 561b65a, the old code gives 652 mismatching fields (offsets and totals), all at the two new bases: with only 0 and 1024 it gives none, which is why this went unnoticed. With the fix there are none at any base. No caller in the runtime passes an unaligned base (the only internal caller is GetCopyableFootprints1). AI-assisted. Tested on AMD Radeon RX 7600, driver 26.11.2 (LLPC), Windows 10 22H2 (in-box d3d12core 10.0.19041), MSVC 14.44. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
750cf45 to
0a08dbb
Compare
|
Tested 0a08dbb on NVIDIA GeForce RTX 4080, driver 617.42: d3d12_vulkan_device_test exits 0 with the device line "Vulkan device: NVIDIA GeForce RTX 4080 (maxPushConstantsSize: 256 bytes)". The new GetCopyableFootprints comparison (bases 513 and 2^32+1 against the host) prints no line on a pass, so exit 0 is the only signal for it. I did not run the base. AI-assisted. |
…Offset Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claimed in the coordination issue as: #2300 (comment)
What and why
Problem.
GetCopyableFootprintsreturns the wrong offsets and total whenBaseOffsetis not a multiple ofD3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT(512). Against the PC runtime on an RX 7600:mainAn application that sizes an upload buffer from the total and writes at the returned offsets writes past its allocation whenever the base is not a multiple of 512.
Cause. The layout started at
BaseOffset, and every subresource was aligned to 512 as an absolute address. The PC runtime lays the subresources out from 0 and then adds the base, so the whole layout moves by the base and the total does not depend on it. Offsets wrap past 2^64, as the host's do.Fix. Lay out from 0, add
baseto eachOffset, and return the total without the base.GetCopyableFootprints1wraps the same function and needs no separate change.compare_footprintsnow also runs bases 513 and 2^32 + 1 next to 0 and 1024: with only 0 and 1024, the old code passes, which is why this went unnoticed.docs/d3d12_vulkan.mdrecords the rule.Scope change since the first version. This PR is now one commit.
new_format_round_tripshost gate (the former third commit) landed in d3d12_vulkan_device_test: compare A4B4G4R4 with the host only where the host has the format #2438 with the same logic. Thanks @MeNoSkills for spotting the duplicate.heap: HARDWARE_PROTECTEDgate (the former second and third commits) only adapted host comparisons to a Windows 10 runtime. They are not BaseOffset, so they are left out.Tested (this version)
AMD Radeon RX 7600 (gfx1102, 8 GB), driver 26.11.2 (LLPC, Vulkan 1.4.359), Windows 10 22H2 (in-box d3d12core 10.0.19041), Ryzen 5 5600, MSVC 14.44, RelWithDebInfo.
main561b65a8against this branch on the same machine and in the same build tree. The "before" build only reverts the runtime hunk.compare_footprints: 652 mismatching fields before, 0 after. Onmain, with only bases 0 and 1024, it passes with the same runtime, so all 652 are at the two unaligned bases.Local comparison program (described below): 5140 of 6204 calls differ from the host before, 0 after, also with
LEONIDA_VK_VALIDATION=1. Every texture case differs at 514 of 517 bases before; the buffer never does. AtUINT64_MAX - 255, before gives0, 6144and the host gives18446744073709551360, 5888; after gives the host's values.Runtime tests that call
GetCopyableFootprints, with and without validation:d3d12_vulkan_devicegets pastcompare_footprints.mainand on this branch alike. The one failure,d3d12_clear, is the WARP host lackingID3D12Device10on Windows 10.Local comparison program (not part of this PR):
GetCopyableFootprintsandGetCopyableFootprints1on our device and on the native D3D12 device.UINT64_MAX - 255.Not changed by this PR, and known. On a Windows 10 host,
d3d12_vulkan_device_testonmainstops incompare_invalid_argumentson cases that have nothing to do with this PR:0x80000000;RENDER_TARGET | UNORDERED_ACCESS;R9G9B9E5render target.compare_footprintsruns before that, so it runs here. On Windows 11 23H2, the+device10gates ofHARDWARE_PROTECTED, resource flag0x400and the 2049-sampler heap are not enough, as @CharlyRien reported. Those cases are onmainand are not touched here.Reviews of the previous head (750cf45, on older main)
Thank you, everyone who tested the first version. These results are for
750cf457, not this rebased commit. The runtime change is identical.UINT64_MAX - 255through both methods: 513/513 match the host. With the runtime hunk reverted, 512/513 differ.d3d12_vulkan_device20/20, 0 validation messages.+device10gates above, which are outside this PR.AI-assisted (Claude Code).
Checklist
docs/design.md, with how it was confirmed. (Not a translator change.)🤖 Generated with Claude Code