build(d3d12_x): compile the libraries with MSVC again #38

Manually merged
github merged 1 commit from gh-pr/38/head into gh-pr/38/base 2026-11-26 19:15:00 +00:00
Owner

@⁠CaseReed on GitHub · 2026-11-22 17:23 UTC · original
CaseReed:fix/msvc-d3d12x → main · +18 −5 · 4 files · 1 commits · merged 2026-11-22 20:48 UTC

What

main no longer builds with MSVC 2022, which docs/dev/BUILD.md lists as supported. Three causes, all in code added since #8:

  • vulkan/PipelineCompiler.cpp and vulkan/TitleBufferWindow.cpp call std::max( / std::min( after <windows.h>, whose min/max macros expand them (C2589). They now use the (std::min)(...) form already used in runtime/src/Runtime.cpp.
  • tests/ShaderStoreProbe.cpp has a local named small. The Windows SDK's rpcndr.h defines small as char; mingw-w64 only does so for the resource compiler. Renamed to undersized.
  • d3d12_x/include/Exports.hpp declares six exports that <d3d12.h> already declares without dllexport (D3D12CreateDevice, D3D12GetDebugInterface, the two serializers and the two deserializer creators). GCC merges the attributes; MSVC refuses the second declaration (C2375, "redefinition; different linkage"). The header now defines those six names to AbxSdk<Name> while it includes <d3d12.h> and undefines them right after, so the SDK's prototypes get another name and each export keeps its single ABX_API declaration. The PFN_D3D12_* types and everything else in the header are untouched, and __func__ in RootSignature.cpp still gives the real name for GetProcAddress.

No behaviour change. One thing to know about the rename: it relies on Exports.hpp being the first to include <d3d12.h> in a translation unit, which holds today (Inventory.cpp, RootSignature.cpp). If that stops holding, MSVC fails to compile again; nothing breaks silently.

Suggestion, your call: CI only builds with MSYS2 GCC, so this can come back with any PR. An MSVC job would be the same three cmake / ctest steps after ilammy/msvc-dev-cmd, with setup-python. I can send it as a separate PR if you want it.

Tested

Windows 11, MSVC 19.38 (VS 2022), Windows SDK 10.0.26100, Ninja, Release, clean build directory:

  • Full build: no error, no warning.
  • CTest: 60/60 passed; pipeline_probe skipped ("the Khronos validation layer is not installed" on this machine).
  • dumpbin /exports ab_d3d12_x.dll: the seven expected names, undecorated.
  • python tools/check_conventions.py and python tools/debt_fold.py --check pass.
  • The new Exports.hpp with definitions of three of the exports compiles with MinGW-w64 GCC 15.2 (UCRT) on Compiler Explorer, labels undecorated.

Not tested: a full MinGW build (no GCC on this machine); the Windows CI job is the check for it. Before the change, the same tree failed with the errors above.

Self-review: an independent pass over the diff (mingw-w64 and SDK headers, the tools that parse Exports.hpp, other bare std::min/std::max and macro-colliding names in the tree) found nothing blocking. vulkan/DescriptorTable.cpp has a bare std::max( that is fine today because that file never sees <windows.h>.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md (none changed)
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: n/a (build fix); Windows SDK and mingw-w64 public headers
  • AI-assisted: yes

🤖 Generated with Claude Code

**@⁠CaseReed** on GitHub · 2026-11-22 17:23 UTC · [original](https://github.com/Dark3581/AnyBox/pull/38) `CaseReed:fix/msvc-d3d12x` → `main` · +18 −5 · 4 files · 1 commits · merged 2026-11-22 20:48 UTC ### What `main` no longer builds with MSVC 2022, which `docs/dev/BUILD.md` lists as supported. Three causes, all in code added since #8: - `vulkan/PipelineCompiler.cpp` and `vulkan/TitleBufferWindow.cpp` call `std::max(` / `std::min(` after `<windows.h>`, whose `min`/`max` macros expand them (C2589). They now use the `(std::min)(...)` form already used in `runtime/src/Runtime.cpp`. - `tests/ShaderStoreProbe.cpp` has a local named `small`. The Windows SDK's `rpcndr.h` defines `small` as `char`; mingw-w64 only does so for the resource compiler. Renamed to `undersized`. - `d3d12_x/include/Exports.hpp` declares six exports that `<d3d12.h>` already declares without `dllexport` (`D3D12CreateDevice`, `D3D12GetDebugInterface`, the two serializers and the two deserializer creators). GCC merges the attributes; MSVC refuses the second declaration (C2375, "redefinition; different linkage"). The header now defines those six names to `AbxSdk<Name>` while it includes `<d3d12.h>` and undefines them right after, so the SDK's prototypes get another name and each export keeps its single `ABX_API` declaration. The `PFN_D3D12_*` types and everything else in the header are untouched, and `__func__` in `RootSignature.cpp` still gives the real name for `GetProcAddress`. No behaviour change. One thing to know about the rename: it relies on `Exports.hpp` being the first to include `<d3d12.h>` in a translation unit, which holds today (`Inventory.cpp`, `RootSignature.cpp`). If that stops holding, MSVC fails to compile again; nothing breaks silently. Suggestion, your call: CI only builds with MSYS2 GCC, so this can come back with any PR. An MSVC job would be the same three `cmake` / `ctest` steps after `ilammy/msvc-dev-cmd`, with `setup-python`. I can send it as a separate PR if you want it. ### Tested Windows 11, MSVC 19.38 (VS 2022), Windows SDK 10.0.26100, Ninja, Release, clean build directory: - Full build: no error, no warning. - CTest: 60/60 passed; `pipeline_probe` skipped ("the Khronos validation layer is not installed" on this machine). - `dumpbin /exports ab_d3d12_x.dll`: the seven expected names, undecorated. - `python tools/check_conventions.py` and `python tools/debt_fold.py --check` pass. - The new `Exports.hpp` with definitions of three of the exports compiles with MinGW-w64 GCC 15.2 (UCRT) on Compiler Explorer, labels undecorated. Not tested: a full MinGW build (no GCC on this machine); the Windows CI job is the check for it. Before the change, the same tree failed with the errors above. Self-review: an independent pass over the diff (mingw-w64 and SDK headers, the tools that parse `Exports.hpp`, other bare `std::min`/`std::max` and macro-colliding names in the tree) found nothing blocking. `vulkan/DescriptorTable.cpp` has a bare `std::max(` that is fine today because that file never sees `<windows.h>`. ### Checklist <!-- Rules behind each item: CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` (none changed) - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: n/a (build fix); Windows SDK and mingw-w64 public headers - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MSVC stopped on three things added since the last MSVC build: std::min and std::max called after windows.h without NOMINMAX, a local named small (a macro in the SDK's rpcndr.h), and the six D3D12 exports, which d3d12.h already declares without dllexport (C2375). Exports.hpp renames those six names while it includes d3d12.h, so each export keeps one ABX_API declaration.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:59 +00:00
github manually merged commit 87b0f65be4 into gh-pr/38/base 2026-11-26 19:15:00 +00:00
Author
Owner

@⁠Dark3581 on GitHub · 2026-11-22 20:48 UTC · original · approved these changes

Reviewed — looks good

All three causes are real and the fixes are the right shape; merging.

What I ran

Head 87b0f65, merged onto current main (with #41, #43 and #44). Windows 10, Release, Ninja, clean build directories:

  • MinGW: WinLibs GCC 15.2 UCRT.
  • MSVC: Visual Studio 2022 17.12 (MSVC 19.42), Windows SDK 10.0.22621.

Results

Check Result Note
MinGW full build pass no warning
MinGW CTest 61/61
MSVC build pass except ab_gameinput.dll that link needs gameinput.lib, which SDK 22621 does not ship; unrelated to this PR
MSVC CTest 61/61 with the follow-up below
check_conventions.py ok
debt_fold.py --check ok
CI pass

Findings

Blocking

None.

Non-blocking

  • main moved after this was opened: #43 added three more bare calls (std::min twice in vulkan/PipelineCompiler.cpp, std::max in tests/PsoProbe.cpp) that break MSVC the same way. That is my code, so I fix it in a follow-up commit on main with the (std::min)(...) form you used.
  • The MSVC CI job you suggest is worth having; yes please, as its own PR. It would have caught the follow-up above.

Not verified

The Exports.hpp rename with the Windows SDK 26100 headers (this machine has 22621).

Thanks — clear write-up, and the note about Exports.hpp having to be the first to include <d3d12.h> is exactly the kind of constraint that saves someone an hour later.

**@⁠Dark3581** on GitHub · 2026-11-22 20:48 UTC · [original](https://github.com/Dark3581/AnyBox/pull/38#pullrequestreview-6014455069) · **approved these changes** # Reviewed — looks good All three causes are real and the fixes are the right shape; merging. ## What I ran Head `87b0f65`, merged onto current `main` (with #41, #43 and #44). Windows 10, Release, Ninja, clean build directories: - MinGW: WinLibs GCC 15.2 UCRT. - MSVC: Visual Studio 2022 17.12 (MSVC 19.42), Windows SDK 10.0.22621. ## Results | Check | Result | Note | |---|---|---| | MinGW full build | pass | no warning | | MinGW CTest | 61/61 | | | MSVC build | pass except `ab_gameinput.dll` | that link needs `gameinput.lib`, which SDK 22621 does not ship; unrelated to this PR | | MSVC CTest | 61/61 | with the follow-up below | | `check_conventions.py` | ok | | | `debt_fold.py --check` | ok | | | CI | pass | | ## Findings ### Blocking None. ### Non-blocking - `main` moved after this was opened: #43 added three more bare calls (`std::min` twice in `vulkan/PipelineCompiler.cpp`, `std::max` in `tests/PsoProbe.cpp`) that break MSVC the same way. That is my code, so I fix it in a follow-up commit on `main` with the `(std::min)(...)` form you used. - The MSVC CI job you suggest is worth having; yes please, as its own PR. It would have caught the follow-up above. ## Not verified The `Exports.hpp` rename with the Windows SDK 26100 headers (this machine has 22621). Thanks — clear write-up, and the note about `Exports.hpp` having to be the first to include `<d3d12.h>` is exactly the kind of constraint that saves someone an hour later.
Author
Owner

@⁠Dark3581 on GitHub · 2026-11-22 20:57 UTC · original

Follow-up for the code that landed after this PR was opened: #45 puts the remaining bare std::min/std::max calls in the (std::min)(...) form, so main builds with MSVC 2022 again (all but ab_gameinput.dll, which needs a newer Windows SDK than my machine has) and passes 61/61.

**@⁠Dark3581** on GitHub · 2026-11-22 20:57 UTC · [original](https://github.com/Dark3581/AnyBox/pull/38#issuecomment-7085677874) Follow-up for the code that landed after this PR was opened: #45 puts the remaining bare `std::min`/`std::max` calls in the `(std::min)(...)` form, so `main` builds with MSVC 2022 again (all but `ab_gameinput.dll`, which needs a newer Windows SDK than my machine has) and passes 61/61.
This discussion has been locked. Commenting is limited to contributors.
No description provided.