4 Commits

Author SHA1 Message Date
b17397f0dd tests: derive every test's scratch folder from test_temp_dir::temp_dir, not GetTempPath (TEST-TEMPDIR-STRIPPED-ENV)
With TMP, TEMP and USERPROFILE all unset, GetTempPathW returns C:\Windows\, and the throwing create_directories/copy_file/ofstream on C:\Windows\leonida_* aborts with 0xc0000409 before the test body runs. runtime/test/test_temp_dir.h grows one entry, testfiles::temp_dir(): LEONIDA_TEST_DIR when set, the current directory when the temp environment is stripped (Windows), else the standard temp resolution. Fifty-two test files and the tiny_game fixture that called GetTempPathA/W or temp_directory_path directly now use it; d3d12_queue_handover_test.cpp also checks the _sopen_s result in capture_stderr instead of silently returning empty stderr. One runtime source function needed the same fallback because tests exercise it: tls_host_clone_dir in runtime/src/pe_loader.cpp (the loader_tls tests). Rebased onto current main after its D3D-448 additions to d3d12_mesh_test.cpp (3-way; the mesh test keeps both). Verification on a Windows VM: stripped environment - the previously crashing d3d12 tests exit 77 (no usable Vulkan device) instead of aborting, file_system_test runs all 505 checks and loader_test all 95 with zero failures; normal environment - identical outcomes; LEONIDA_TEST_DIR honored under a fully stripped environment (the scratch folder observed mid-run inside it, cleaned up after the pass). The finding is whoalin1's (coordination issue #14, 02:37:44Z).

AI-assisted.
2026-11-28 19:01:06 +00:00
10f7fc21c7 d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept
PC D3D12 runtimes disagree on five ExecuteIndirect cases. Older Windows 11
builds bound max_count * stride and check the argument offset at a zero
count; newer ones (D3D12Core 10.0.26100.9818 on Windows 11 26300, WARP and
NVIDIA alike) bound (max_count - 1) * stride + record_size and check
nothing at a zero count. e1ec785b2 moved the layer to the older rule, so
d3d12_execute_indirect_validation failed on every newer host, as it had
failed on older ones before.

The layer takes the wider rule again, in recording (d3d12_com.cpp) and in
replay (vulkan_replay.h): it is the rule vkCmdDraw*Indirect states, no byte
outside the buffer is read, and a refusal drops the whole command list for
a call a shipping runtime runs.

The test marks the five cases host_varies: the layer has to accept them and
a live host may answer either way, so the test stops failing on one group
of machines or the other. Two cases that neither rule accepts are added,
and the positive GPU path replays both disputed shapes with validation on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 17:38:44 +00:00
e1ec785b2d d3d12: ExecuteIndirect bounds the span max_count * stride, and checks the offset at max_count 0
d3d12_execute_indirect_validation reports five host-parity mismatches on the RTX 5060 and on
WARP: the layer accepts an argument buffer range the host refuses. Both live hosts bound the
bytes the signature can walk, max_count * stride, so a record that fits at the end of the
buffer while its stride runs past it is refused (offset 240 with stride 20 in a 256-byte
buffer), and both check the offset itself when max_count is 0, which the layer skipped
entirely.

The layer validated with (max_count - 1) * stride + record_size and only when max_count was
non-zero. It now uses the same span as the host and validates every call, in d3d12_com.cpp
(recording, so Close fails as the host's does) and in vulkan_replay.h (replay, which had its
own copy of the old arithmetic).

The test's positive GPU path recorded the same out-of-range calls the parity table marks as
refused, so it moves to an exact-fit range (244 + 12 == 256) and a max_count 0 no-op at the
buffer's end (offset 256), and the five parity rows take the verdict both hosts give here.
2026-11-24 03:55:56 +08:00
9a9ca1ec14 d3d12: match Windows recording-time ExecuteIndirect validation (#6830)
Squash-merged after diff review of PR #6830 - d3d12: match Windows recording-time ExecuteIndirect validation
2026-11-23 09:53:12 -06:00