build: raise MSVC warnings for the shader compiler #3794

Merged
Leyukaka merged 3 commits from upstream-pr/3794 into main 2026-12-02 01:50:30 +00:00
Leyukaka commented 2026-12-01 22:54:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T22:54:48Z.


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 #3791 (tools/startup/compile_dxil.cpp) and #3792 (src/gfx1013_direct_compute.inl). I will rebase after whichever merges first.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5596126460 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3794). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-01T22:54:48Z. --- ## 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 #3791 (`tools/startup/compile_dxil.cpp`) and #3792 (`src/gfx1013_direct_compute.inl`). I will rebase after whichever merges first.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!3794
No description provided.