5 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
fc3fe314ab d3d12_shader_cache_test: skip SetDeleteOnDestroy on host MODE_MEMORY sessions 2026-11-22 21:21:34 +01:00
59bb784066 d3d12_shader_cache_test: avoid passing nullptr to SAL _In_ params on host D3D12 runtime
Windows 11 23H2 in-box d3d12.dll (10.0.22621.5415) AVs with 0xC0000005 when passed nullptr for SAL _In_/_Inout_ parameters (pDesc, pKey, pValue, pValueSize) without the debug layer (reported by @CharlyRien on #2167). Keep all null-pointer checks on the Vulkan layer, skip only raw nullptr _In_/_Inout_ calls on the host comparison, and disable stdout buffering so progress lines flush immediately.
2026-11-22 19:57:44 +01:00
e8602fdfae runtime: address shader-cache session review feedback (D3D-34 follow-up)
Follow-up on merged 2d848a33 (#2167) addressing @Flyander's 7 review items:
1. Enforce version mismatch on live sessions (DXGI_ERROR_ALREADY_EXISTS) and clear+recreate on reopen after all sessions close.
2. Discard MODE_MEMORY stores on final release (in-memory sessions do not persist across full teardown).
3. Return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE on FindValue/StoreValue while ShaderCacheControl DISABLE is active.
4. Make ShaderCacheControl CLEAR remove inactive default-directory disk cache files left by prior runs.
5. Bound disk-file deserialization against actual file_size and max_file_bytes before allocating or reading.
6. Apply documented zero-limit defaults (1 KiB value, 128 entries, 128 MiB file) and return DXGI_ERROR_CACHE_FULL when limits are exceeded.
7. Use unique per-writer temp filenames (<pid>.<tid>.<seq>.tmp) for atomic disk flushes.

Verified on Windows 11 + NVIDIA GeForce RTX 3060 (621.24, Vulkan 1.4.357, LEONIDA_VK_VALIDATION=1): d3d12_shader_cache_test passed (0 validation errors).
2026-11-22 19:11:35 +01:00
cfcc6c54a3 runtime: implement ID3D12Device9::CreateShaderCacheSession and ShaderCacheControl (D3D-34)
Add in-memory ID3D12ShaderCacheSession support (FindValue, StoreValue, SetDeleteOnDestroy, GetDesc) and ID3D12Device9::ShaderCacheControl on the Vulkan-backed D3D12 device, matching the Windows D3D12 host runtime's validation, size queries, duplicate rejection, cross-session sharing, and delete-on-destroy lifecycle.

Verified with synthetic test d3d12_shader_cache_test comparing the Vulkan layer against the host Windows D3D12 runtime under LEONIDA_VK_VALIDATION=1.
2026-11-22 17:24:30 +01:00