build(windows): Mesa's spirv_to_dxil.dll in the third-party build tools, its licenses beside it #2362

Closed
nyannoying wants to merge 1 commit from nyannoying/Longshot:build/mesa-third-party into main
Contributor

Summary

The Direct3D 12 back end (#2040) translates the game's shaders with Mesa's spirv_to_dxil.dll, which it loads at run
time from the game folder. Today a Windows builder has no copy of that DLL: whoever builds longshot_d3d12.dll fetches
it by hand. This puts the DLL into the Windows builders' third-party archive, with the licenses of the Mesa sources it
is built from beside it, so every builder has the same bytes.

#2295 overlaps this. It is a WIP pull request that drops the third-party archive and tools.py assemble. Tools are
built from their sources instead, and the release uploads them. This PR is for main as it is today. If #2295 lands
first, Mesa becomes one more tool line in its scheme. The license file, headers and provenance note stay as they are,
and I will rebase onto it. If this lands first, #2295 carries the Mesa DLL along.

  • scripts/tools.py assemble third-party --mesa <dll>: the DLL goes in at third_party/mesa-spirv-to-dxil/bin/ only
    with the size and SHA-256 that third_party/mesa-spirv-to-dxil/PROVENANCE.md pins (mesa-dist-win's Mesa 26.2.6);
    other bytes are refused.
  • tools.lock: third-party hookshot-v2.1.0-mesa-26.2.6, the current archive's files with the DLL added. Assembling
    is deterministic: the same command gives the same SHA-256 (2d16ebe2…, 27,925,805 bytes).
  • third_party/mesa-spirv-to-dxil/: the interface headers (spirv_to_dxil.h, dxil_versions.h), the provenance note,
    and LICENSE: MIT for most of Mesa, Berkeley SoftFloat's BSD-3-Clause, xxHash's BSD-2-Clause, BSL-1.0, and two
    public-domain files, taken from the SPDX lines and notices of the sources the DLL is built from (spirv_to_dxil,
    microsoft/compiler, nir, spirv, util, c11). The DLL imports only KERNEL32.
  • docs/dev/reference/releases.md: the archive's new contents.

A maintainer uploads the archive before this merges: the new tools.lock line names a file that is not in the store
yet, and a Windows builder would fail to fetch it. I have the archive and can hand it over.

Read first: scripts/tools.py (mesa_pinned, mesa_file), then tests/test_tools_mesa.py.

Testing

Tested: Windows 11, on my own PC.

  • tests/test_tools_mesa.py: 7 checks pass. They cover four things:

    • the pinned bytes go in, and no DLL is added without --mesa;
    • other bytes are refused and no archive is written;
    • the lock names the archive with Mesa;
    • LICENSE holds every license the note names.

    Two broken variants each fail one check: mesa_file's size and hash test removed (test_other_bytes_refused), and
    the SoftFloat notice taken out of LICENSE (test_the_licenses_are_beside_it).

  • Assembled the archive twice and got the same SHA-256. Compared it file by file with the current archive
    (hookshot-v2.1.0, 8 files): the 8 are byte for byte the same, and the DLL is the only new one. The licenses are in
    the repository, not in the archive.

  • On the D3D12 branch, the Windows game build took the DLL from third_party/mesa-spirv-to-dxil/bin/ and put it, with
    spirv_to_dxil-LICENSE.txt, beside longshot_d3d12.dll. That is the same DLL every D3D12 run uses.

  • The game on main does not load this DLL, so nothing here runs in the game.

  • mise run test (Windows, --no-skip): 898 passed, 45 failed, 15 skipped. All but one also fail on main at
    0e32bc10, from this PC's setup. The one is tests/test_coverage_run.py: scripts/coverage/cover.py decodes
    tasklist's output as cp1252, which fails on this PC's German Windows depending on the processes running. It also
    fails on another branch of mine, and this PR does not touch coverage.

    The 44 that also fail on main

    nx2/test_bc_storage_views.py, nx2/test_dll.py, nx2/test_insn.py, nx2/test_leaf.py, test_auto_handheld.py, test_build_long_paths.py, test_crash_dialog.py, test_dev_ab.py, test_dev_build.py, test_dev_migrate.py, test_dev_packs.py, test_discover.py, test_driver_cache_folder.py, test_driver_env_choose.py, test_game_layout.py, test_game_menu_mouse_buttons.py, test_input_movie.py, test_job_queue.py, test_lift_lookups.py, test_linux_deps_pins.py, test_linux_driver_fault_guard.py, test_linux_preflight.py, test_linux_tools.py, test_linux_update.py, test_log_open_failure.py, test_longshot_launch.py, test_longshot_saves.py, test_make_game_cache.py, test_menu_save_atomic.py, test_pads_after_menu.py, test_perf_report.py, test_pipeline_state_computes.py, test_pipeline_tour.py, test_posix_cv_wake.py, test_prompt_cache_errors.py, test_readback_wait_bounded.py, test_sampler_admission.py, test_saveload_warm_cache.py, test_sdiv_overflow.py, test_tracy_funcs.py, test_udmabuf_limit_unreadable.py, test_udmabuf_warning.py, test_walk.py, test_wayland_libdecor_hint.py

Still to test:

  • Once the archive is uploaded: a Windows CI build fetches third-party hookshot-v2.1.0-mesa-26.2.6 and builds as before.
    By hand: I run CI on this PR again after the upload and post the result.

Measurements

Nothing to measure: build tooling only. The game and the renderers are unchanged.

Risks

  • If it merges before the archive is uploaded, Windows builders cannot fetch third-party. Upload first.
  • The archive grows from 26.6 MB to 27.9 MB, downloaded once per builder.
  • Players notice nothing: main does not ship or load the DLL.
  • It conflicts with #2295 in tools.lock and scripts/tools.py. Whichever lands second carries Mesa along, as the
    Summary says.
  • A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.
    No existing part changes: the 4 files are all new, in a new part third_party/mesa-spirv-to-dxil/ with its own
    PROVENANCE.md and tree-sha256, as XeSS (#459), Tracy (#1543) and ReShade (#1861) were added.
    scripts/check_third_party.py: 18 parts as their notes say.

When it applies

  • Docs updated.
  • A check under tests/ that reads changed source is updated, not weakened. The checks that read
    scripts/tools.py and tools.lock pass unchanged. tests/test_tools_mesa.py is new.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary The Direct3D 12 back end (#2040) translates the game's shaders with Mesa's `spirv_to_dxil.dll`, which it loads at run time from the game folder. Today a Windows builder has no copy of that DLL: whoever builds `longshot_d3d12.dll` fetches it by hand. This puts the DLL into the Windows builders' `third-party` archive, with the licenses of the Mesa sources it is built from beside it, so every builder has the same bytes. **#2295 overlaps this.** It is a WIP pull request that drops the `third-party` archive and `tools.py assemble`. Tools are built from their sources instead, and the release uploads them. This PR is for `main` as it is today. If #2295 lands first, Mesa becomes one more tool line in its scheme. The license file, headers and provenance note stay as they are, and I will rebase onto it. If this lands first, #2295 carries the Mesa DLL along. - `scripts/tools.py assemble third-party --mesa <dll>`: the DLL goes in at `third_party/mesa-spirv-to-dxil/bin/` only with the size and SHA-256 that `third_party/mesa-spirv-to-dxil/PROVENANCE.md` pins (mesa-dist-win's Mesa 26.2.6); other bytes are refused. - `tools.lock`: `third-party hookshot-v2.1.0-mesa-26.2.6`, the current archive's files with the DLL added. Assembling is deterministic: the same command gives the same SHA-256 (`2d16ebe2…`, 27,925,805 bytes). - `third_party/mesa-spirv-to-dxil/`: the interface headers (`spirv_to_dxil.h`, `dxil_versions.h`), the provenance note, and `LICENSE`: MIT for most of Mesa, Berkeley SoftFloat's BSD-3-Clause, xxHash's BSD-2-Clause, BSL-1.0, and two public-domain files, taken from the SPDX lines and notices of the sources the DLL is built from (`spirv_to_dxil`, `microsoft/compiler`, `nir`, `spirv`, `util`, `c11`). The DLL imports only `KERNEL32`. - `docs/dev/reference/releases.md`: the archive's new contents. **A maintainer uploads the archive before this merges**: the new `tools.lock` line names a file that is not in the store yet, and a Windows builder would fail to fetch it. I have the archive and can hand it over. Read first: `scripts/tools.py` (`mesa_pinned`, `mesa_file`), then `tests/test_tools_mesa.py`. ## Testing **Tested:** Windows 11, on my own PC. - `tests/test_tools_mesa.py`: 7 checks pass. They cover four things: - the pinned bytes go in, and no DLL is added without `--mesa`; - other bytes are refused and no archive is written; - the lock names the archive with Mesa; - `LICENSE` holds every license the note names. Two broken variants each fail one check: `mesa_file`'s size and hash test removed (`test_other_bytes_refused`), and the SoftFloat notice taken out of `LICENSE` (`test_the_licenses_are_beside_it`). - Assembled the archive twice and got the same SHA-256. Compared it file by file with the current archive (`hookshot-v2.1.0`, 8 files): the 8 are byte for byte the same, and the DLL is the only new one. The licenses are in the repository, not in the archive. - On the D3D12 branch, the Windows game build took the DLL from `third_party/mesa-spirv-to-dxil/bin/` and put it, with `spirv_to_dxil-LICENSE.txt`, beside `longshot_d3d12.dll`. That is the same DLL every D3D12 run uses. - The game on `main` does not load this DLL, so nothing here runs in the game. - `mise run test` (Windows, `--no-skip`): 898 passed, 45 failed, 15 skipped. All but one also fail on `main` at 0e32bc10, from this PC's setup. The one is `tests/test_coverage_run.py`: `scripts/coverage/cover.py` decodes `tasklist`'s output as cp1252, which fails on this PC's German Windows depending on the processes running. It also fails on another branch of mine, and this PR does not touch coverage. <details><summary>The 44 that also fail on main</summary> `nx2/test_bc_storage_views.py`, `nx2/test_dll.py`, `nx2/test_insn.py`, `nx2/test_leaf.py`, `test_auto_handheld.py`, `test_build_long_paths.py`, `test_crash_dialog.py`, `test_dev_ab.py`, `test_dev_build.py`, `test_dev_migrate.py`, `test_dev_packs.py`, `test_discover.py`, `test_driver_cache_folder.py`, `test_driver_env_choose.py`, `test_game_layout.py`, `test_game_menu_mouse_buttons.py`, `test_input_movie.py`, `test_job_queue.py`, `test_lift_lookups.py`, `test_linux_deps_pins.py`, `test_linux_driver_fault_guard.py`, `test_linux_preflight.py`, `test_linux_tools.py`, `test_linux_update.py`, `test_log_open_failure.py`, `test_longshot_launch.py`, `test_longshot_saves.py`, `test_make_game_cache.py`, `test_menu_save_atomic.py`, `test_pads_after_menu.py`, `test_perf_report.py`, `test_pipeline_state_computes.py`, `test_pipeline_tour.py`, `test_posix_cv_wake.py`, `test_prompt_cache_errors.py`, `test_readback_wait_bounded.py`, `test_sampler_admission.py`, `test_saveload_warm_cache.py`, `test_sdiv_overflow.py`, `test_tracy_funcs.py`, `test_udmabuf_limit_unreadable.py`, `test_udmabuf_warning.py`, `test_walk.py`, `test_wayland_libdecor_hint.py` </details> **Still to test:** - Once the archive is uploaded: a Windows CI build fetches `third-party hookshot-v2.1.0-mesa-26.2.6` and builds as before. By hand: I run CI on this PR again after the upload and post the result. ## Measurements Nothing to measure: build tooling only. The game and the renderers are unchanged. ## Risks - If it merges before the archive is uploaded, Windows builders cannot fetch `third-party`. Upload first. - The archive grows from 26.6 MB to 27.9 MB, downloaded once per builder. - Players notice nothing: `main` does not ship or load the DLL. - It conflicts with #2295 in `tools.lock` and `scripts/tools.py`. Whichever lands second carries Mesa along, as the Summary says. - A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. No existing part changes: the 4 files are all new, in a new part `third_party/mesa-spirv-to-dxil/` with its own `PROVENANCE.md` and `tree-sha256`, as XeSS (#459), Tracy (#1543) and ReShade (#1861) were added. `scripts/check_third_party.py`: 18 parts as their notes say. ### When it applies - [x] Docs updated. - [x] A check under `tests/` that reads changed source is updated, not weakened. The checks that read `scripts/tools.py` and `tools.lock` pass unchanged. `tests/test_tools_mesa.py` is new. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
build(windows): Mesa's spirv_to_dxil.dll in the third-party build tools, its licenses beside it
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
fd2c709026
The Direct3D 12 back end (#2040) loads Mesa's spirv_to_dxil.dll at run time. This puts mesa-dist-win's build of Mesa
26.2.6 (the bytes third_party/mesa-spirv-to-dxil/PROVENANCE.md pins) into the Windows builders' third-party archive, at
third_party/mesa-spirv-to-dxil/bin/, so a builder has it without a download of its own:

- scripts/tools.py assemble third-party --mesa <dll>: the DLL goes in only with the pinned size and SHA-256.
- tools.lock: third-party hookshot-v2.1.0-mesa-26.2.6, the current archive's prebuilt files with the DLL added
  (deterministic: the same command gives the same SHA-256). Its copy is not in the store yet: a maintainer uploads it.
- third_party/mesa-spirv-to-dxil: the interface headers and the note, and LICENSE: the licenses of the Mesa sources the
  DLL is built from (MIT; Berkeley SoftFloat's BSD-3-Clause; xxHash's BSD-2-Clause; BSL-1.0; two public-domain files).

tests/test_tools_mesa.py: the pinned bytes go in, others are refused, the lock takes the archive with Mesa, the licenses
are beside it.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Not on main: main's game does not load it. The same DLL, byte for byte (Mesa 26.2.6, SHA-256 8c6e6f8e…, as PROVENANCE.md pins it), with these headers ran today in the Direct3D 12 back end (#2040): Intel Arc B580, driver 32.0.101.9175, Windows 11, a save's first load and Castle Town market, 6 runs, no device lost.

Tested in game: Not on main: main's game does not load it. The same DLL, byte for byte (Mesa 26.2.6, SHA-256 8c6e6f8e…, as PROVENANCE.md pins it), with these headers ran today in the Direct3D 12 back end (#2040): Intel Arc B580, driver 32.0.101.9175, Windows 11, a save's first load and Castle Town market, 6 runs, no device lost.
Member

Possibly related, for context:

  • issue #1619 Direct3D 12 back end (nyannoying's experiment): test results on an Intel Arc iGPU, and what a path to main needs — D3D12 issue records the runtime Mesa DLL dependency
Possibly related, for context: - issue #1619 Direct3D 12 back end (nyannoying's experiment): test results on an Intel Arc iGPU, and what a path to main needs — D3D12 issue records the runtime Mesa DLL dependency
nyannoying force-pushed build/mesa-third-party from fd2c709026
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 5e54525a22
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-23 15:18:27 +00:00
Compare
nyannoying changed title from WIP: build(windows): Mesa's spirv_to_dxil.dll in the third-party build tools, its licenses beside it to build(windows): Mesa's spirv_to_dxil.dll in the third-party build tools, its licenses beside it 2026-11-23 15:18:36 +00:00
Author
Contributor

Superseded by #2040, which carries Mesa's spirv_to_dxil.dll in the repository (third_party/mesa-spirv-to-dxil/bin, its bytes pinned by its PROVENANCE.md and checked), as asked. No archive upload needed.

Superseded by #2040, which carries Mesa's `spirv_to_dxil.dll` in the repository (`third_party/mesa-spirv-to-dxil/bin`, its bytes pinned by its `PROVENANCE.md` and checked), as asked. No archive upload needed.
nyannoying closed this pull request 2026-11-23 16:12:08 +00:00
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2362
No description provided.