test: refuse a BC7 copy from an unreadable source #1739
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1746"
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 R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T18:03:58Z.
What
copy_bc7_4k_sinsrc/startup_stubs/xg_xs.cppprobes both buffers before copying:Nothing in
tests/startup_xg_bc7_layout_check.pyreached that probe. Its five refusal controls — wrong plane, wrongsubresource, short row, short slice, aliased source — are all answered by the earlier
E_INVALIDARGchecks, sodeleting the probe leaves the fixture green:
Change
One refusal passed an address that is not mapped, expecting the
E_FAILthe probe answers with, and the destinationstill untouched:
Tested at
origin/main=68969ed8Worth naming the failure mode: with the probe removed the fixture does not report a wrong HRESULT, it faults inside the
copy — that is the behaviour the probe exists to prevent, and the fixture failing either way is the point.
Scope
One test file, no behaviour change.
E_FAILrather thanE_INVALIDARGis deliberate: the arguments are well formed,the memory is not.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:24:52Z.
Review: COMMENTED
Verified at commit
360bbf3112b1b2e100f7cb1e78574ef8c38e749e(tests/startup_xg_bc7_layout_check.pyonly; no production/tooling/workflow changes; clean-room and title-neutral).Scope & Code Review
check_copypassing an unreadable source pointer (ctypes.cast(1, PTR)) toCopyIntoSubresource, assertingE_FAIL(0x80004005) and confirming the destination buffer and guard bytes remain untouched.!x2w_local::readable(source, source_bytes)guard incopy_bc7_4k_s(src/startup_stubs/xg_xs.cpp:143-144).Linux Checks
git diff --check origin/main...HEAD: passpython3 tests/docs_links_check.py: passpython3 tests/bidi_controls_check.py: passpython3 -m py_compile tests/startup_xg_bc7_layout_check.py: passWindows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)
--preset dev):cmake --build --preset dev --target startup_stream_consumer startup_stub_xg_xs -- -j 8: pass (4.51s)ctest --preset dev -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure: 5/5 passed (7.75s;startup_xg_bc7_layout0.16s)/O2(--preset release):cmake --build --preset release --target startup_stream_consumer startup_stub_xg_xs -- -j 8: pass (1.18s)ctest --preset release -R '^(startup_xg_bc7_layout|startup_xg_bc_array_warp|startup_xg_bc_chain_warp|startup_xg_bc_tiling|startup_xg_tile64_tiling)$' --parallel 6 --no-tests=error --output-on-failure: 5/5 passed (7.87s;startup_xg_bc7_layout0.15s)Mutation Check (Win2025 Debug)
src/startup_stubs/xg_xs.cpp:143-144incopy_bc7_4k_sto returnE_INVALIDARG(0x80070057) instead ofE_FAIL(0x80004005) when!x2w_local::readable(source, source_bytes).startup_xg_bc7_layout(ctest --preset dev -R '^startup_xg_bc7_layout$' --output-on-failure): failed as expected (RuntimeError: BC7 81x69 unreadable source HRESULT: got 2147942487, expected 2147500037).Note: Competing open PRs (#1742, #1748) also modify
tests/startup_xg_bc7_layout_check.py.AI-assisted; commands listed were executed locally.