Repository navigation
Conversation
…the block-padded mip Resource::region() checked a block-compressed box against the unpadded mip size and let a right or bottom edge that isn't a whole block through when it equalled the mip edge. The host runtime and WARP do the reverse: every edge of a caller's box is in whole blocks and may reach the block-padded edge (0,0)-(8,8) on a 6x6 BC1 mip, while (0,0)-(6,6) is refused. The box is now checked against the padded size, and right/bottom are clamped to the mip edge for the copy. d3d12_subresource_probe_test runs the same writes and reads on the Vulkan device and on the host (PROBE_WARP=1: WARP) and compares every HRESULT and a hash of every block row: 3 cases differ on main, 0 with the fix. AI-assisted: yes
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Independent Windows review (commit caa1b6be3f19c1be42336c1d88583076226b0280)
What changed:
runtime/shims/d3d12_vulkan_device.cpp:- In
Resource::region(), validates block-compressed (BC) copy boxes against block-padded mip dimensions(width + k - 1) / k * k. - Rejects partial-block unaligned box boundaries with
E_INVALIDARG, matching D3D12/WARP host behavior, while safely clamping underlying Vulkan copy extents to unpadded mip limits.
- In
runtime/test/d3d12_subresource_probe_test.cpp:- 155-line test suite verifying odd-sized BC1/BC7 mip boundaries against native D3D12 behavior.
Verification:
- Verified on Windows host: matches D3D12 specification.
- Clean diff: no game files.
Ready for merge.
|
Verified head
AI-assisted. |
|
Additional padded-box readback for caa1b6be on native Windows 11, RTX 3080 Ti (621.35), MSVC 19.44, Vulkan SDK 1.4.363. I ran the three stock valid BC1 boxes plus two valid BC7 edge boxes, one on a 10×6 mip padded to 12×8 and one on a 5×3 mip padded to 8×4. With both native D3D12 and Microsoft WARP as references, all five writes and immediate reads returned Both focused runs passed with zero skips or Vulkan core or synchronization validation messages. Only the temporary fixture changed to add the BC7 cases and compare bytes directly. Synthetic inputs only. AI-assisted. |
al3xar
left a comment
There was a problem hiding this comment.
AI-assisted review and test.
Independent Windows MSVC + Vulkan validation verification of caa1b6be3 on Windows 11 x64 (es-ES), MSVC 19.44.35230.0 (RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON), NVIDIA GeForce RTX 3060 (driver 621.24, Vulkan SDK 1.4.363.0 with LEONIDA_VK_VALIDATION=1), no game files used: pass.
- Merge & hygiene: Merges cleanly with
upstream/main(867d922f0,git merge-treeexit 0);python -I scripts/check_no_game_data.pyclean;python -I tests/test_ctest_registration.py4/4 OK. - Tests (
LEONIDA_VK_VALIDATION=1):d3d12_subresource_probe_testvs NVIDIA GeForce RTX 3060 host: pass,0 cases differ, 0 Vulkan validation errors.PROBE_WARP=1 d3d12_subresource_probe_testvs WARP: pass,0 cases differ, 0 Vulkan validation errors.d3d12_subresource_copy_test(host image copy and staging copy paths): pass,109 steps compared, 0 mismatcheson both paths, 0 Vulkan validation errors.
- Negative control: Reverting
runtime/shims/d3d12_vulkan_device.cpptoupstream/maincausesd3d12_subresource_probe_testto fail withsubresource probe: 3 cases differ(exit 1). - Minor non-blocking note: MSVC
/W4emitsC4996: 'getenv'atruntime/test/d3d12_subresource_probe_test.cpp:105(could useGetEnvironmentVariableAor_dupenv_sto keep the target warning-free).
|
Tested
AI-assisted: yes. |
|
Tested on AMD Radeon RX 7700 XT (RDNA3), AMD Windows driver 32.0.32029.2010, Windows 11, MSVC 14.51 Release, at caa1b6b. Full No regression. The only failures are the same 5 as on AI-assisted (Claude Code). |
Claimed in the coordination issue: #9065 (comment)
What and why
Resource::region()(runtime/shims/d3d12_vulkan_device.cpp), used byWriteToSubresourceandReadFromSubresource, checked a block-compressed box against the unpadded mip size. It also allowed a right or bottom edge that isn't a whole block when that edge equalled the mip width or height. The host runtime does the reverse: every edge of a caller's box must be a whole block, and the box may reach the block-padded edge of the mip.BC1 12x12 with 3 mips (mip 1 is 6x6, mip 2 is 3x3). The NVIDIA host runtime and WARP agree with each other:
The same pattern shows on BC7 10x6 and on a 3D BC1 12x10 with depth. The fix checks the box against the padded size, requires whole blocks on every edge of a caller-supplied box, and then clamps right and bottom to the mip edge for the Vulkan copy. A null box is unchanged.
#8777 fixes block-compressed bounds only in the GPU footprint copy path (
vulkan_replay.h). This is the CPU path.Tested
Windows 11, RTX 5070 Ti (NVIDIA 621.14), MSVC 14.44, RelWithDebInfo, on main 867d922. No game files.
d3d12_subresource_probe_testruns the same writes and reads on the Vulkan device and on the host device, then compares every HRESULT and a hash of every block row read back.PROBE_WARP=1uses WARP as the host instead. It skips (77) when either device is missing.subresource probe: 3 cases differ, exit 1.0 cases differagainst the NVIDIA host and against WARP, exit 0.ctest -R "d3d12_subresource|resource_detile|d3d12_placed|d3d12_existing_heap|d3d12_buffer_tiles|d3d12_texture_tiles|d3d12_noop_copy": 8/8 pass, including the existingd3d12_subresource_copy(host-copy and staging paths).LEONIDA_VK_VALIDATION=1run.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (n/a, no translator change)