Repository navigation
build: share the D3D12 device object across two test targets - #1752
Conversation
…e file once for two test targets The dev preset links Debug binaries with /debug:fastlink (the default /INCREMENTAL stays), so the many test DLLs and EXEs no longer build a full PDB. The release preset is unchanged. offscreen_check and cpu_placed_dxr_provider compile src/startup_stubs/d3d12_xs_device.cpp with the same flags, so they now link one OBJECT library. With OFFSCREEN_AGILITY_620_DIR the fixture uses the Agility headers and both targets keep compiling their own copy. d3d12_xs_shim uses the static CRT and is not shared. No target or CTest name changes.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Checked the two build changes on WindowsAt cmake --preset dev
cmake --build --preset dev --target offscreen_check cpu_placed_dxr_provider
ctest --preset dev -R '^offscreen_warp$|^cpu_placed_dxr'A. The flag reaches the linker. B. The shared object library is in effect. One question about scope
{ "name": "pr", "configurePreset": "dev", ... }
{ "name": "pr", "inherits": "dev", "displayName": "Windows pull request smoke tests", ... }so CI gets
Neither is a defect in this change; it is a question of whether CI is the intended holder of reference PDBs. If the intent OtherwiseThe header/definition reasoning for sharing the object (no VerdictReviewed Notes
|
|
Thanks for testing both changes on Windows 11 and confirming zero linker warnings and Good catch on AI-assisted. |
Both claims verified on a Windows buildWindows 11 build 26300.9974, MSVC 19.44, A.
|
|
MSVC 14.51 on Visual Studio 2026 reports LNK4315 for |
Current scope: shared D3D12 device object only. The earlier FASTLINK proposal was removed after reproducing LNK4315 with Visual Studio 2026. The original comparison is preserved below.
Two build-time changes, no test or target name changes.
A. dev preset links with
/debug:fastlink.CMakePresets.jsonsets the Debug linker flags of thedevconfigure preset to/debug:fastlink /INCREMENTAL(the CMake default was/debug /INCREMENTAL) for EXE, DLL and module links. Thereleasepreset is untouched. Only the PDB content changes; the binaries and their unwind tables are the same.B. One compile of
src/startup_stubs/d3d12_xs_device.cppfor two test targets.offscreen_checkandcpu_placed_dxr_providercompiled the file with the same flags (default CRT, desktop SDK headers; the file and its.inlincludes read none of the per-target definitions such asFFX_*,DXC_VERSION_STRINGorOFFSCREEN_AGILITY_620). They now link an OBJECT libraryd3d12_xs_device_obj.OFFSCREEN_AGILITY_620_DIRset, the fixture compiles against the Agility headers, so no library is created and both targets keep their own copy, as before.d3d12_xs_shimuses the static CRT and still compiles its own copy.Checks run locally (Linux)
git diff --check origin/main...HEAD,python3 -m json.tool CMakePresets.json,python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py: pass.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
8a07e812fda488e26cd2c1aad45c68a0a46b3575--preset dev):cmake --build --preset dev --target offscreen_check cpu_placed_dxr_provider cpu_placed_dxr cpu_placed_dxr_lifted pe_map cpu_exe_io d3d12_xs_shim -- -j 8):21.49s(configure1.64s);d3d12_xs_device_objcompiled once and shared byoffscreen_checkandcpu_placed_dxr_provider, whiled3d12_xs_shimcompiled its own static-CRT copy.ctest --preset dev -R '^(offscreen_warp|dxr_placed_build_warp|sampler_index_control_warp|dual_uav_warp|descriptor_heap_paging_warp|cpu_placed_dxr_warp)$' --parallel 6 --no-tests=error --output-on-failure): 6/6 passed (2.51s:dual_uav_warp0.06s,offscreen_warp0.06s,descriptor_heap_paging_warp0.05s,sampler_index_control_warp0.05s,dxr_placed_build_warp0.07s,cpu_placed_dxr_warp2.43s)./O2(--preset release):cmake --build --preset release --target offscreen_check cpu_placed_dxr_provider cpu_placed_dxr cpu_placed_dxr_lifted pe_map cpu_exe_io d3d12_xs_shim -- -j 8):42.41s(configure1.73s).ctest --preset release -R '^(offscreen_warp|dxr_placed_build_warp|sampler_index_control_warp|dual_uav_warp|descriptor_heap_paging_warp|cpu_placed_dxr_warp)$' --parallel 6 --no-tests=error --output-on-failure): 6/6 passed (2.79s:offscreen_warp0.05s,sampler_index_control_warp0.08s,dxr_placed_build_warp0.10s,dual_uav_warp0.07s,descriptor_heap_paging_warp0.05s,cpu_placed_dxr_warp2.70s).sccache: 11/16 hits, 0 errors; total wall78.5s.AI-assisted; commands listed were executed locally.
Note on
prpreset scope:prinheritsdev(and therefore/debug:fastlink) intentionally —windows.ymldoes not publish PDB artifacts, so reference PDBs keep CI link times faster whilereleasepreserves full PDBs.