Skip to content

build: raise MSVC warnings for the shader compiler - #3794

Merged
R0Y00 merged 3 commits into
R0Y00:mainfrom
Leyukaka:quality/msvc-warnings-cpp20
Dec 2, 2026
Merged

R0Y00 merged 3 commits into
R0Y00:mainfrom
Leyukaka:quality/msvc-warnings-cpp20

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants