build: raise MSVC warnings for the shader compiler #3796

Manually merged
github merged 3 commits from github-bot/gh-3794 into main 2026-12-02 01:54:23 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-01 22:54 UTC · original
Leyukaka:quality/msvc-warnings-cpp20 → main · +62 −38 · 8 files · 3 commits · merged 2026-12-02 01:50 UTC

Problem

x2w_shader_compiler and compile_dxil build at the default MSVC warning level in permissive mode. Shadowed locals, uninitialized aggregate members and non-conforming code in the translator are not reported, and nothing keeps a translation unit clean once it is.

Change

  • Build both targets with /W4 and /permissive-. Apply /WX to the ISA decoder and the vertex-ID translator when they are built into the shader compiler; other translation units can be added as they become clean. Standalone fixture builds of the same sources are unaffected.
  • Build both targets as C++20. The library's public requirement stays C++17.
  • Give five shader aggregates member defaults equal to their existing brace-initialized values.
  • Rename a few shadowing locals and one constructor parameter.
  • Keep the UTF-8 bytes of paths in refusal reports now that u8string() returns char8_t.
  • Suppress C4996 at the three read-only CRT environment lookups.

No lowering logic changes; translator output is expected to be identical, and the corpus comparison below confirms it.

Validation

Windows, MSVC, dev preset. The CTest selection below passes on both main (158ef7942) and this branch (11bf403e7).

cmake --preset dev
cmake --build --preset dev --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay native_raw_buffer_view_check offscreen_check gfx1013_compute_ir_check gfx1013_rect_geometry_check gfx1013_isa_check gfx1013_vertex_id_check
ctest --preset dev --no-tests=error -j1 -R '^(native_.*_(ir|dxil|controls)|native_direct_(container|mesh)|native_compute_(clear|raw_root)|native_fixed_graphics_psi1|native_compile_dxil_(refusals|rekey|watch)|native_dxil_llvm_ident_(warp|hardware)|gfx1013_(compute_ir|rect_geometry|isa|vertex_id)_all)$'

Translator corpus (DXIL fingerprints and refusal reasons), produced with the same corpus script, MSVC and DXC for both commits: the TSV is byte-identical between 158ef7942 and 11bf403e7 (same SHA-256). The corpus script is tests/translator_corpus_hash.py from the translator corpus PR.

This touches lines also changed by #3793 (tools/startup/compile_dxil.cpp) and #3794 (src/gfx1013_direct_compute.inl). I will rebase after whichever merges first.

**@⁠Leyukaka** on GitHub · 2026-12-01 22:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3794) `Leyukaka:quality/msvc-warnings-cpp20` → `main` · +62 −38 · 8 files · 3 commits · merged 2026-12-02 01:50 UTC ## Problem `x2w_shader_compiler` and `compile_dxil` build at the default MSVC warning level in permissive mode. Shadowed locals, uninitialized aggregate members and non-conforming code in the translator are not reported, and nothing keeps a translation unit clean once it is. ## Change - Build both targets with `/W4` and `/permissive-`. Apply `/WX` to the ISA decoder and the vertex-ID translator when they are built into the shader compiler; other translation units can be added as they become clean. Standalone fixture builds of the same sources are unaffected. - Build both targets as C++20. The library's public requirement stays C++17. - Give five shader aggregates member defaults equal to their existing brace-initialized values. - Rename a few shadowing locals and one constructor parameter. - Keep the UTF-8 bytes of paths in refusal reports now that `u8string()` returns `char8_t`. - Suppress C4996 at the three read-only CRT environment lookups. No lowering logic changes; translator output is expected to be identical, and the corpus comparison below confirms it. ## Validation Windows, MSVC, `dev` preset. The CTest selection below passes on both `main` (`158ef7942`) and this branch (`11bf403e7`). ```powershell cmake --preset dev cmake --build --preset dev --target compile_dxil native_compute_ir_dump native_pixel_ir_dump native_store_replay native_raw_buffer_view_check offscreen_check gfx1013_compute_ir_check gfx1013_rect_geometry_check gfx1013_isa_check gfx1013_vertex_id_check ctest --preset dev --no-tests=error -j1 -R '^(native_.*_(ir|dxil|controls)|native_direct_(container|mesh)|native_compute_(clear|raw_root)|native_fixed_graphics_psi1|native_compile_dxil_(refusals|rekey|watch)|native_dxil_llvm_ident_(warp|hardware)|gfx1013_(compute_ir|rect_geometry|isa|vertex_id)_all)$' ``` Translator corpus (DXIL fingerprints and refusal reasons), produced with the same corpus script, MSVC and DXC for both commits: the TSV is byte-identical between `158ef7942` and `11bf403e7` (same SHA-256). The corpus script is `tests/translator_corpus_hash.py` from the translator corpus PR. This touches lines also changed by #3793 (`tools/startup/compile_dxil.cpp`) and #3794 (`src/gfx1013_direct_compute.inl`). I will rebase after whichever merges first.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 22:55:34 +00:00
github manually merged commit aa76f3ae9f into main 2026-12-02 01:54:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.