Repository navigation
Runtime: WriteToSubresource and ReadFromSubresource answer their arguments as the host does - #2736
Conversation
…ime does d3d12_subresource_copy_test runs the same 117 steps on the Vulkan-backed device and on the host runtime: textures in write-back and write-combine custom heaps, a volume, an array, BC1 blocks, a buffer, an upload-heap buffer, a default-heap texture and a multisampled one; whole and boxed copies, boxes outside, empty, inverted or cutting a block, subresources past the last, pitches too small or 0, and copies before Map. It records every HRESULT and a hash of the whole destination of every read, once per copy path (host image copy and staging). On main 17 steps differed (RTX 3060, driver 610.88); now none do. The host's rules: - a box is refused only when its right, bottom or back edge lies past the mip's, or it cuts a compressed block; an empty or inverted box that passes those checks is S_OK and copies nothing (the layer refused it); - the row and depth pitches are not checked: rows or slices that overlap are copied in order (the layer refused a pitch smaller than a row or slice). Not compared, and reported as such: null data (the host faults; the layer still answers E_INVALIDARG), which bytes win when a read's rows overlap (the driver's copy order, tiled on NVIDIA), and a default-heap texture, which the host refuses and the layer copies on purpose, as docs/d3d12_vulkan.md says. d3d12_vulkan_device_test's cpu_copies expected the old refusals for an empty box and overlapping slices, and now expects S_OK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Not executable on this machine (Bazzite 45 / Linux 7.3.4, GCC 16.2.1): this is the Windows D3D12 layer. and the shared Linux binaries cannot call Code review of the change (base
What the review cannot establish: the actual HRESULTs and the whole-destination hashes of the 117 steps, across BC1, write-back/write-combine heaps, the volume, the array, the multisample texture and the default-heap case; nor the validation-layer result. That is exactly what the description says was run on an RTX 3060, and I cannot confirm it here. No defect found in the review. Verdict: LGTM (review only; no execution possible on this machine). AI-assisted review. |
|
Tested c226964 on Windows 11, RTX 3060 (driver 616.64), Vulkan SDK 1.4.363.1, built with clang-cl + xwin (RelWithDebInfo).
Thanks for the reviews on #2214 and #2215. Glad to return the favour. |
|
Tested
AI-assisted (Claude Code). No game files. |
|
Tested c226964 merged onto
|
|
Tested on Windows 11 with two GPUs on one machine (runtime built from this PR's head, MSVC 14.51): pass. |
|
Tested Windows 11 Pro 26300, MSVC 19.44 (VS 2022 Build Tools), Ninja RelWithDebInfo via
|
New D3D item, claimed in #2516 (claim). No dependencies. It touches
cpu_copiesind3d12_vulkan_device_test.cppin one spot (four expectations), away from the lines #2462/#2242/#2297 change.What was wrong
WriteToSubresource/ReadFromSubresourcewere only checked against hand-written expectations, and two of those didn't match what D3D12 does:left == right,top == bottomorfront == back), or an inverted one that passes those checks, isS_OKand copies nothing. That includes one that starts past the right edge and ends inside. A read leaves the destination untouched. The layer answeredE_INVALIDARG.The change
region()checks the far edges, then block alignment, and then treats an empty box as no copy.cpu_copyreturnsS_OKfor it and no longer checks the pitches. The order is the host's: an empty box past the edge, or one that cuts a BC block, is stillE_INVALIDARG.d3d12_subresource_copy_testruns the same 117 steps on the Vulkan-backed device and on the host runtime, once per copy path (host image copy where the GPU has it, and the staging submit). The resources: textures in write-back and write-combine custom heaps, a volume, a 2-layer array, BC1 blocks, a buffer, an upload-heap buffer, a default-heap texture and a 4-sample one. The steps: whole and boxed copies, boxes outside, empty, inverted or cutting a block, subresources past the last, pitches too small or 0, and copies beforeMap. Every HRESULT is recorded, and every read records a hash of its whole 4 KiB destination, so a byte written outside the region counts too. Reads right after the empty and inverted boxes check that nothing was written.E_INVALIDARG.docs/d3d12_vulkan.mdalready says.cpu_copiesexpected the old refusals for an empty box and overlapping slices; it now expectsS_OK.docs/d3d12_vulkan.mdlists the rules.Tested
Windows 11 Pro 26300, MSVC 19.52 (VS 18 Build Tools, Ninja, RelWithDebInfo), NVIDIA GeForce RTX 3060, driver 610.88, Vulkan headers/loader 1.4.357:
d3d12_subresource_copy_testwithLEONIDA_VK_VALIDATION=1: on each path, 109 steps compared, 8 not compared, 0 mismatches, validation clean.main's layer gives 17 mismatches on the first path.d3d12_vulkan_device_testwith validation: pass (bothcpu_copiespaths).ctest: 125/125 passed (glslang and the validation layer installed;LEONIDA_GAME_DIRset, so the package-gated tests ran too).No game files involved. AI-assisted (Claude Code).
🤖 Generated with Claude Code