runtime: compile test shaders through an ASCII-cwd glslang wrapper #2104

Open
github-bot wants to merge 1 commit from github-bot/gh-2104 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-25 20:48 UTC · original
whoalin1:glslang-nonascii-relative → main · +130 −2 · 2 files · 1 commits · open

Claimed in the coordination issue: #1608 (BUILD-GLSLANG-NONASCII-RELATIVE-FIXTURE, from alexandersato0830's finding at #1608).

What

Windows glslang (16.6.0 standalone) fast-fails with 0xC0000409 in a non-ASCII working directory, whatever its arguments say: the CRT resolves files through the narrow (ANSI codepage) current directory, and a character the codepage cannot represent crashes the runtime before main. A CMake build tree under a non-ASCII directory (a user name, a desktop folder) hits this for every shader the test build compiles.

This runs the validator through runtime/test/glslang_ascii_cwd.py, which keeps every byte glslang sees ASCII:

  • the working directory is the output directory's 8.3 short form (pure ASCII by construction on the system volume),
  • the output is written there under its relative name,
  • non-ASCII input files are hard-linked or copied in under plain ASCII names — the input's own 8.3 short form cannot be used because 8.3 truncates the extension to three letters (.comp → .com) and glslang classifies the shader stage from the extension.

Off Windows, without Python3, or in an already-ASCII tree the wrapper is a plain pass-through and nothing changes. When a path has no 8.3 short form (short names disabled on the volume) the validator runs exactly as it would without the wrapper — no regression — with a warning saying why.

Evidence (Windows 11, system codepage 1252, glslang 11:16.6.0 from VulkanSDK 1.4.363.0)

Failure reproduced on unmodified main — configure + cmake --build --target vk_null_descriptor_test in a build dir whose name holds CJK characters outside cp1252:

ninja: build stopped: subcommand failed.
Exit code 0xc0000409

the exact exit code alexandersato0830 reported (-1073740791). ninja's own log line shows the mechanism: cmd.exe /C "cd /D <unicode-build-dir> && glslangValidator ...".

Mechanism isolated: run directly, glslang crashes with 0xC0000409 whenever its cwd is non-ASCII — even with --stdin and no file arguments at all — while an ASCII cwd with Unicode absolute paths only fails to open the input (rc 1). The cwd is the deciding variable.

With this PR: the same configure + build in a CJK build directory succeeds; generated/cs_null_descriptors.spv is byte-identical to the ASCII-tree build (15036 bytes, valid SPIR-V magic). Wrapper-level checks: Unicode input + Unicode output + Unicode cwd, ASCII input + Unicode output/cwd (the reported scenario), and the all-ASCII pass-through all produce byte-identical output; staged input copies are cleaned up after the run.

Test plan

  • Control (unmodified main) fails in a CJK build dir with 0xC0000409
  • This branch builds vk_null_descriptor_test in a CJK build dir; SPIR-V byte-identical to ASCII build
  • ASCII-tree pass-through unchanged
  • CI

No game files involved; the shader is the synthetic GLSL test fixture. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-25 20:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2104) `whoalin1:glslang-nonascii-relative` → `main` · +130 −2 · 2 files · 1 commits · open Claimed in the coordination issue: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608 (BUILD-GLSLANG-NONASCII-RELATIVE-FIXTURE, from alexandersato0830's finding at https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). ## What Windows glslang (16.6.0 standalone) fast-fails with `0xC0000409` in a non-ASCII working directory, whatever its arguments say: the CRT resolves files through the narrow (ANSI codepage) current directory, and a character the codepage cannot represent crashes the runtime before `main`. A CMake build tree under a non-ASCII directory (a user name, a desktop folder) hits this for every shader the test build compiles. This runs the validator through `runtime/test/glslang_ascii_cwd.py`, which keeps every byte glslang sees ASCII: - the working directory is the output directory's **8.3 short form** (pure ASCII by construction on the system volume), - the output is written there under its relative name, - non-ASCII input files are hard-linked or copied in under plain ASCII names — the input's own 8.3 short form cannot be used because 8.3 truncates the extension to three letters (`.comp` → `.com`) and glslang classifies the shader stage from the extension. Off Windows, without Python3, or in an already-ASCII tree the wrapper is a plain pass-through and nothing changes. When a path has no 8.3 short form (short names disabled on the volume) the validator runs exactly as it would without the wrapper — no regression — with a warning saying why. ## Evidence (Windows 11, system codepage 1252, glslang 11:16.6.0 from VulkanSDK 1.4.363.0) **Failure reproduced on unmodified main** — configure + `cmake --build --target vk_null_descriptor_test` in a build dir whose name holds CJK characters outside cp1252: ``` ninja: build stopped: subcommand failed. Exit code 0xc0000409 ``` the exact exit code alexandersato0830 reported (-1073740791). ninja's own log line shows the mechanism: `cmd.exe /C "cd /D <unicode-build-dir> && glslangValidator ..."`. **Mechanism isolated**: run directly, glslang crashes with `0xC0000409` whenever its cwd is non-ASCII — even with `--stdin` and no file arguments at all — while an ASCII cwd with Unicode absolute paths only fails to open the input (rc 1). The cwd is the deciding variable. **With this PR**: the same configure + build in a CJK build directory succeeds; `generated/cs_null_descriptors.spv` is byte-identical to the ASCII-tree build (15036 bytes, valid SPIR-V magic). Wrapper-level checks: Unicode input + Unicode output + Unicode cwd, ASCII input + Unicode output/cwd (the reported scenario), and the all-ASCII pass-through all produce byte-identical output; staged input copies are cleaned up after the run. ## Test plan - [x] Control (unmodified main) fails in a CJK build dir with `0xC0000409` - [x] This branch builds `vk_null_descriptor_test` in a CJK build dir; SPIR-V byte-identical to ASCII build - [x] ASCII-tree pass-through unchanged - [ ] CI No game files involved; the shader is the synthetic GLSL test fixture. AI-assisted with Devin.
Windows glslang fast-fails (0xC0000409) in a non-ASCII working directory
whatever its arguments say: the CRT resolves files through the narrow
(ANSI codepage) current directory, and a character the codepage cannot
represent crashes the runtime before main. A build tree under a non-ASCII
directory hits this for every shader the test build compiles. Run the
validator through test/glslang_ascii_cwd.py, which re-runs it with the
output directory's 8.3 short form as the working directory, the output
written under its relative name, and non-ASCII inputs hard-linked or
copied in under ASCII ones (the input's own short form truncates the
extension glslang classifies the stage from). Off Windows, without
Python3, or in an already-ASCII tree nothing changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:18:02 +00:00
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 20:53 UTC · original

Broader compile evidence in the same CJK build directory (system codepage 1252, glslang 16.6.0): built vk_overlapping_occlusion_test, vk_binary_occlusion_test and d3d12_descriptor_test on top of vk_null_descriptor_test — together these exercise the quoted-then-unquoted vulkan1.0 foreach sites, the vulkan1.2 site and the descriptor_test_shader function helper with its -D variant flags. 12 SPIR-V outputs across the four call-site patterns, all with valid magic, zero leftover staged inputs. Everything links and the two occlusion tests' unquoted list expansion works as intended. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-25 20:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2104#issuecomment-7174318361) Broader compile evidence in the same CJK build directory (system codepage 1252, glslang 16.6.0): built `vk_overlapping_occlusion_test`, `vk_binary_occlusion_test` and `d3d12_descriptor_test` on top of `vk_null_descriptor_test` — together these exercise the quoted-then-unquoted `vulkan1.0` foreach sites, the `vulkan1.2` site and the `descriptor_test_shader` function helper with its `-D` variant flags. 12 SPIR-V outputs across the four call-site patterns, all with valid magic, zero leftover staged inputs. Everything links and the two occlusion tests' unquoted list expansion works as intended. AI-assisted with Devin.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2104/head:github-bot/gh-2104'
git switch 'github-bot/gh-2104'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2104'
git switch 'github-bot/gh-2104'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2104'
git switch 'github-bot/gh-2104'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2104'
git switch 'main'
git merge --squash 'github-bot/gh-2104'
git switch 'main'
git merge --ff-only 'github-bot/gh-2104'
git switch 'main'
git merge 'github-bot/gh-2104'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.