Skip to content

build: apply the shader-compiler /W4 /WX ratchet to MSVC only - #3855

Merged
R0Y00 merged 4 commits into
R0Y00:mainfrom
triggered02:fix/3853-clang-warning-ratchet
Dec 2, 2026
Merged

R0Y00 merged 4 commits into
R0Y00:mainfrom
triggered02:fix/3853-clang-warning-ratchet

Conversation

@triggered02

Copy link
Copy Markdown
Contributor

Fixes #3853.

What changed. The /W4 /permissive- + /WX ratchet d654ad80 added for the shader compiler is now inside

if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")

MSVC is true for clang-cl as well, because clang-cl presents the MSVC command line, so the ratchet reached a compiler with a different warning set and made src/gfx1013_vertex_id.cpp fail at /WX (7 × -Wmissing-field-initializers). Real MSVC keeps exactly the flags and the per-source /WX it had before; nothing else in the block moved.

Why this and not a suppression. The commit's own message is "raise MSVC warnings for the shader compiler", so applying it to MSVC matches the stated intent, and it leaves docs/non-windows-hosts.md's clang-cl route working instead of needing a clang-specific exemption for one warning class. If you would rather keep /W4 /WX active for clang-cl, the alternative is -Wno-missing-field-initializers for clang only — say so and I will switch; either way the 7 initializers in that file stay as they are, since they are your file and not this change's subject.

Verification — Debian, clang-cl 19.1.1, xwin SDK 10.0.26100 splat, Release, the toolchain file from the clang-cl section of docs/non-windows-hosts.md:

# before this change (5770f14e)
cmake --build out/build/clang --target d3d12_xs_shim -j 8
FAILED: CMakeFiles/x2w_shader_compiler.dir/src/gfx1013_vertex_id.cpp.obj
  src/gfx1013_vertex_id.cpp(117,79): error: missing field 'value' initializer [-Werror,-Wmissing-field-initializers]
  ... 7 errors generated.

# after this change
cmake --build out/build/clang --target x2w_shader_compiler -j 8   -> x2w_shader_compiler.lib (20 MB)
cmake --build out/build/clang --target d3d12_xs_shim     -j 8     -> d3d12_xs.dll (15.4 MB)

Not established. No MSVC, no Windows host and no GPU here, so the MSVC side is unchanged-by-inspection, not re-measured. The Windows CI job is the check for that. The pure-Python checks are unaffected — this touches only a CMake condition.

CMake sets MSVC for clang-cl, because clang-cl presents the MSVC command line,
so the ratchet d654ad8 added reached a compiler it was not written for: clang
warns where MSVC does not, and src/gfx1013_vertex_id.cpp fails at /WX with
-Wmissing-field-initializers (7 sites). That broke the clang-cl cross-compile
documented in docs/non-windows-hosts.md for any target that depends on
x2w_shader_compiler.

Guard the block with CMAKE_CXX_COMPILER_ID so real MSVC keeps /W4 /permissive-
and /WX unchanged, and clang-cl builds the target again.

Verified on Debian with clang-cl 19.1.1 and an xwin SDK 10.0.26100 splat,
Release:
  before: cmake --build out/build/clang --target d3d12_xs_shim
          -> FAILED on x2w_shader_compiler.dir/src/gfx1013_vertex_id.cpp.obj,
             7 x 'missing field value initializer [-Werror,-Wmissing-field-initializers]'
  after:  same target -> builds; x2w_shader_compiler.lib (20 MB) and
          d3d12_xs.dll (15.4 MB) link.
The MSVC side is unchanged by inspection only: no MSVC or Windows host here.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T13:27:59.385367Z 4f299d4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@triggered02

Copy link
Copy Markdown
Contributor Author

Windows CI on this PR failed, but not because of this change — the only failing test is native_direct_mesh, and it fails identically on #2773, #3852 and #1536, none of which touch a warning-flag condition. Filed as #3856 with the four job links and the error line (native compute +0x34: unmapped graphics export).

This change only moves a if(MSVC) condition, so it cannot alter the shader-compiler's runtime behaviour; the MSVC warning flags and the per-source /WX are unchanged. Linux Python checks and the gfx1013 job pass on this head, matching the local before/after I recorded.

Codex reviewed at 4f299d4b with no findings.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4f299d4b. The CMake-only change gates the shader compiler and CLI warning options together, keeping the per-source /WX list and MSVC options intact while excluding the Clang frontend used by the documented clang-cl/xwin build. The author tested that build with clang-cl 19.1.1. I checked the exact diff and verified the hosted Windows log reaches CTest, where the only failed test is the shared native_direct_mesh fixture (+0x34: unmapped graphics export, #3851). I did not rerun the clang-cl/xwin build locally.

…opped

5545de9 moved the sibling container cases onto tests/native_direct_container_check.mesh(),
which writes the attribute count at io+0x188, but left the packed-row case on the old
pack(body + code, ...) path and dropped the 'struct.pack_into("<I", body, io + 0x188, 1)'
line that path needed. The shared body bytearray stayed zero-filled, so the container
declared no output attributes.

read_guest_shader_container then produced stage.outputs empty with three OSG1 signature
rows (SV_Position, COLOR, TEXCOORD), and the export row at target 32 had nothing to map:
  native compute +0x34: unmapped graphics export
at src/gfx1013_direct_graphics.inl:456. This made native_direct_mesh fail on every PR,
because the Windows job runs the pr preset and the check is required (R0Y00#3856).

No translator change is involved: git diff e387678 5545de9 -- src/gfx1013_direct_graphics.inl
src/guest_shader_container.cpp is empty. The fixture was the only thing that changed.

Verified on Debian with clang-cl 19.1.1 and the Windows CPython in Wine, against a
compile_dxil built at 5770f14 (the failing tree):
  before: native_direct_mesh_check.py aborting at the integer-row case with
          'unmapped graphics export', stage.outputs=0
  after:  exit 0, 'mesh allocation, indexed outputs, group exchange and negative controls passed'
The Windows job itself is the check for the MSVC side.
@triggered02

Copy link
Copy Markdown
Contributor Author

Noting why this is still blocked after your approval, so it does not look like the change is failing on its own merits.

The required Build and test on Windows check is red on this head, and the only failing test is native_direct_mesh — the shared fixture breakage tracked in #3856, not anything this PR touches (it moves one CMake condition). It fails identically on #2773, #3852 and #1536.

PR #3861 fixes it and is green on all checks (Windows 9m4s, gfx1013 3m50s, Linux Python 5m26s). It is a one-line fixture restore.

One-step path to unblock this one: merge #3861, then I merge current main into this branch and re-run the checks — the diff here does not change, it just needs the fixed fixture underneath it. Re-running this PR's checks before then would reproduce the same failure, so it is not worth a re-run yet.

reviewDecision also reads empty for this PR despite your approval, which suggests the branch protection rule is not counting it as satisfying the review requirement. Worth a look on your side if you expected the merge button to be live once the check passes.

@triggered02

Copy link
Copy Markdown
Contributor Author

Merged the #3861 fixture fix into this branch so the approved change is no longer stuck behind an unrelated failure. Head is now 1d4e68fa.

Why here and not "wait for #3861 to merge". You approved this PR, and it was blocked only by the required Windows check failing on native_direct_mesh (#3856) — a broken fixture that 5545de92 introduced, nothing to do with this diff. Merging rather than re-running was the only way to get the check to pass; a re-run would have reproduced the same failure.

What is in the branch now, relative to current main:

CMakeLists.txt                    | 6 +++++-     this PR's change (the /W4 /WX guard)
tests/native_direct_mesh_check.py | 3 +++       #3861's one-line fixture restore

Verified on this head:

  • native_direct_mesh_check.py against a compile_dxil built here → exit 0, mesh allocation, indexed outputs, group exchange and negative controls passed. Before the merge it aborted with unmapped graphics export.
  • tests/standin_exports_check.py → 470 cases, 6/6 mutations killed, PASS.
  • The CMake change itself is unchanged from the head you approved.

If #3861 merges first, this merge becomes a no-op — the fixture commit is already in main, so this PR will show only its CMake diff again. Either order is safe; they do not conflict.

I have not merged anything, and I am not asking you to skip the check — it should now run green on its own.

@R0Y00
R0Y00 enabled auto-merge (squash) December 2, 2026 15:25
@R0Y00
R0Y00 merged commit 843b6e1 into R0Y00:main Dec 2, 2026
5 checks passed
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.

build: the clang-cl cross-compile fails on gfx1013_vertex_id.cpp after the /W4 /WX ratchet

2 participants