shader: fix MSVC lambda capture in the direct mesh VCC check (build fix for #3841) #3854

Manually merged
github merged 2 commits from github-bot/gh-3852 into gh-pr/3852/base 2026-12-02 15:37:11 +00:00 AGit
Owner

@⁠SimSalabimse on GitHub · 2026-12-02 12:45 UTC · original
SimSalabimse:local/fix-msvc-vcc-changed → main · +1 −1 · 1 files · 2 commits · merged 2026-12-02 15:32 UTC

#3843 added a captureless vcc_changed lambda in src/gfx1013_direct_mesh.inl that reads the function-local constexpr values vcc_words and vcc_nonempty. That is accepted by g++ and clang++, but MSVC 19.44 rejects it, so main has not been building on Windows since that merge.

Exact errors from the Windows test PC and from Build on Windows / Build and test on Windows at /O2 on main:

src/gfx1013_direct_mesh.inl(880): error C3493: 'vcc_words' cannot be implicitly captured because no default capture mode has been specified
src/gfx1013_direct_mesh.inl(880): error C3493: 'vcc_nonempty' cannot be implicitly captured because no default capture mode has been specified
src/gfx1013_direct_mesh.inl(1208): error C2064: term does not evaluate to a function taking 2 arguments
src/gfx1013_direct_mesh.inl(1260): error C2064: term does not evaluate to a function taking 2 arguments

This marks those two constants static constexpr so they have static storage and the lambda can stay captureless. Behaviour is unchanged.

Tested on Windows 11 Pro (build 26200), RTX 4070 Ti, MSVC 19.44.35230 (Visual Studio 2022 17.14.45):

  • cmake --preset dev and cmake --build --preset dev completed with no C3493/C2064.
  • ctest --preset dev -R 'mesh' -E 'startup_audio_(output|pacing|provider)': 230 passed, 1 failed out of 231. The failure is the known native_direct_mesh fixture issue (native compute +0x34: unmapped graphics export), which is already fixed separately in #3853.

g++ 14.2.0 and clang++ 19.1.7 compiled a translation unit with the same static constexpr plus captureless lambda at -std=c++17 -Werror=narrowing. A full compile of gfx1013_compute_native.cpp was not set up on that Linux host (the repo has no Linux cmake preset).

AI-assisted (Cursor)

**@⁠SimSalabimse** on GitHub · 2026-12-02 12:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3852) `SimSalabimse:local/fix-msvc-vcc-changed` → `main` · +1 −1 · 1 files · 2 commits · merged 2026-12-02 15:32 UTC #3843 added a captureless `vcc_changed` lambda in `src/gfx1013_direct_mesh.inl` that reads the function-local `constexpr` values `vcc_words` and `vcc_nonempty`. That is accepted by g++ and clang++, but MSVC 19.44 rejects it, so `main` has not been building on Windows since that merge. Exact errors from the Windows test PC and from `Build on Windows` / `Build and test on Windows at /O2` on `main`: ``` src/gfx1013_direct_mesh.inl(880): error C3493: 'vcc_words' cannot be implicitly captured because no default capture mode has been specified src/gfx1013_direct_mesh.inl(880): error C3493: 'vcc_nonempty' cannot be implicitly captured because no default capture mode has been specified src/gfx1013_direct_mesh.inl(1208): error C2064: term does not evaluate to a function taking 2 arguments src/gfx1013_direct_mesh.inl(1260): error C2064: term does not evaluate to a function taking 2 arguments ``` This marks those two constants `static constexpr` so they have static storage and the lambda can stay captureless. Behaviour is unchanged. Tested on Windows 11 Pro (build 26200), RTX 4070 Ti, MSVC 19.44.35230 (Visual Studio 2022 17.14.45): - `cmake --preset dev` and `cmake --build --preset dev` completed with no C3493/C2064. - `ctest --preset dev -R 'mesh' -E 'startup_audio_(output|pacing|provider)'`: 230 passed, 1 failed out of 231. The failure is the known `native_direct_mesh` fixture issue (`native compute +0x34: unmapped graphics export`), which is already fixed separately in #3853. g++ 14.2.0 and clang++ 19.1.7 compiled a translation unit with the same `static constexpr` plus captureless lambda at `-std=c++17 -Werror=narrowing`. A full compile of `gfx1013_compute_native.cpp` was not set up on that Linux host (the repo has no Linux cmake preset). AI-assisted (Cursor)
Give vcc_words and vcc_nonempty static storage so the captureless
vcc_changed lambda can use them under MSVC (C3493/C2064).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 12:49:43 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 13:02 UTC · original · approved these changes

I reviewed the one-line storage change on c49abb4b. The two integral values and all uses stay the same, and static storage permits the captureless lambda to refer to them. The trial combination with #3853 is clean.

I built compile_dxil and ran ctest --preset dev --no-tests=error -j 1 -V -R '^native_mesh_packed_rows_vcc_ir$' on the exact head. The IR regression passed 1/1 on Windows 11 26300.9974, MSVC 19.51 and SDK 10.0.26100. That is separate from the author's full MSVC 19.44 run. The required PR Windows job compiled and reached CTest, then failed at native_direct_mesh with +0x34: unmapped graphics export. Please rerun Windows after #3853 lands.

**@⁠R0Y00** on GitHub · 2026-12-02 13:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3852#pullrequestreview-6151256398) · **approved these changes** I reviewed the one-line storage change on `c49abb4b`. The two integral values and all uses stay the same, and static storage permits the captureless lambda to refer to them. The trial combination with #3853 is clean. I built `compile_dxil` and ran `ctest --preset dev --no-tests=error -j 1 -V -R '^native_mesh_packed_rows_vcc_ir$'` on the exact head. The IR regression passed 1/1 on Windows 11 26300.9974, MSVC 19.51 and SDK 10.0.26100. That is separate from the author's full MSVC 19.44 run. The required PR Windows job compiled and reached CTest, then failed at `native_direct_mesh` with `+0x34: unmapped graphics export`. Please rerun Windows after #3853 lands.
github-bot changed target branch from main to gh-pr/3852/base 2026-12-02 15:37:08 +00:00
github manually merged commit 79357f29cf into gh-pr/3852/base 2026-12-02 15:37:11 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.