build: share the D3D12 device object across two test targets #1745
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1752"
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 tedin7 on 2026-11-24T18:08:18Z.
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.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T18:16:38Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
8a07e81ℹ️ About Codex in GitHub
Your 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.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T18:27:53Z.
Checked the two build changes on Windows
At
8a07e812, MSVC 14.44.35207, Windows 11 build 26300.9974:A. The flag reaches the linker.
build.ninjacarriesdebug:fastlink948 times after configuring, and a forced relinkof
offscreen_check.exe(deleted the exe, rebuilt) produced noLNKor other warning, and the re-linked binary stillpasses
offscreen_warp./debug:fastlinktogether with/INCREMENTALis what the PR claims, and the toolchain is quietabout it.
B. The shared object library is in effect.
build.ninjahas ad3d12_xs_device_objtarget, andd3d12_xs_device.cpp.objappears as a compile input in both configurations — once through the object library foroffscreen_check, and separately ford3d12_xs_shimas the PR says it keeps its own copy. Both consumers of the sharedobject build and run.
One question about scope
CMakePresets.jsonhaspr(both the configure preset and the test preset) deriving fromdev:so CI gets
/debug:fastlinktoo, not just local dev builds. Two consequences worth a line in the PR body or docs:.objfiles and the absolute build directory, so it is nota self-contained artifact. Anyone who downloads a CI build to inspect a crash will find the PDB unusable once the
workspace is gone — the opposite of what
/debugnormally gives./debug:fastlinkis documented as not supported together with/DEBUG:FULLpost-processing tools that expect acomplete PDB (for example
link /DEBUG:FULLre-runs), and/Ziedit-and-continue needs a full PDB as well.Neither is a defect in this change; it is a question of whether CI is the intended holder of reference PDBs. If the intent
is local-only, setting the flags on a
dev-specific cache variable and leavingpralone would say that in the filerather than in a PR comment. If CI is fine with reference PDBs, one sentence saying so is enough for the next reader.
Otherwise
The header/definition reasoning for sharing the object (no
FFX_*,DXC_VERSION_STRINGorOFFSCREEN_AGILITY_620dependency, and the
OFFSCREEN_AGILITY_620_DIRbranch keeping the old behaviour) matches what the CMake code does, and theshim's separate copy is preserved. Both targets that consume the shared object compile and their tests pass.
Verdict
Reviewed
8a07e812. Both changes do what they say on this machine, with no linker warning and no test change. The only openpoint is whether
prshould inherit fastlink.Notes
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:36:35Z.
Thanks for testing both changes on Windows 11 and confirming zero linker warnings and
3/3pass!Good catch on
prinheritingdev(and therefore/debug:fastlink): that is intentional for CI, becausewindows.ymldoes not publish or archive PDBs as build artifacts (it only builds and runs CTest in the ephemeral runner workspace, where/debug:fastlinkspeeds up the ~940 test links), while thereleasepreset keeps full PDBs unchanged. I will also add a brief note to the PR description so this scope is explicit for future readers.AI-assisted.
[PR #1752] build: use /debug:fastlink in dev preset and share d3d12_xs_device objto [PR #1752] build: share the D3D12 device object across two test targetsImported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T21:41:26Z.
Both claims verified on a Windows build
Windows 11 build 26300.9974, MSVC 19.44,
devpreset.A.
/debug:fastlinkreally reaches the linker948 occurrences in the generated build, i.e. every Debug link line, and the
releasepreset keeps its own flags. So this isnot a preset key that CMake silently ignores — the flag is on the command line that runs.
B. One compile of
d3d12_xs_device.cpp, shared by both targetsWith
--clean-first, buildingoffscreen_checkandcpu_placed_dxr_providertogether compiles the file exactly once:and
offscreen_warpstill passes (100% tests passed). The dependency-sensitive part of the description — that the file readsnone of the per-target definitions — is consistent with that single compile succeeding for both consumers; if it did read
OFFSCREEN_AGILITY_620or anFFX_*define, one of the two would now be built with the wrong value and the fixture wouldnotice.
What I did not verify
warm and single-config, so a timing number from it would be meaningless.
OFFSCREEN_AGILITY_620_DIRis unset here, so theelse()branch (no OBJECT library, each target keepsits own copy) never ran. If you want that branch exercised in CI, it needs its own job.
One question
set_property(SOURCE ... APPEND PROPERTY COMPILE_OPTIONS /bigobj)still applies to the source; it now reaches the OBJECTlibrary rather than the two targets. Since the property is source-scoped, the object built once inherits it — worth a word in
the description so nobody re-adds a per-target
/bigobjlater and quietly creates a second compile.Verdict
Reviewed. Both changes do what the description says on this machine, the release preset is untouched, and the fixture still
passes. No objections.
Notes
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T21:43:46Z.
MSVC 14.51 on Visual Studio 2026 reports LNK4315 for
/DEBUG:FASTLINK. Microsoft documents its removal. I dropped only the preset override. The remaining object-library sharing buildsoffscreen_checkandcpu_placed_dxr_providerin Debug with one shared object.desktop_root_signatureandoffscreen_warpboth pass.