[PR #2104] runtime: compile test shaders through an ASCII-cwd glslang wrapper #2110

Open
opened 2026-11-26 21:20:04 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2104
Author: @whoalin1
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: glslang-nonascii-relative


📝 Commits (1)

  • 3e3b8b7 runtime: compile test shaders through an ASCII-cwd glslang wrapper

📊 Changes

2 files changed (+130 additions, -2 deletions)

View changed files

📝 runtime/CMakeLists.txt (+13 -2)
➕ runtime/test/glslang_ascii_cwd.py (+117 -0)

📄 Description

Claimed in the coordination issue: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173272902 (BUILD-GLSLANG-NONASCII-RELATIVE-FIXTURE, from alexandersato0830's finding at https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172499920).

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2104 **Author:** [@whoalin1](https://github.com/whoalin1) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `glslang-nonascii-relative` --- ### 📝 Commits (1) - [`3e3b8b7`](https://github.com/ubiquitarianism/leonida/commit/3e3b8b7526cd8b3edd5499a3339a5453004a90f6) runtime: compile test shaders through an ASCII-cwd glslang wrapper ### 📊 Changes **2 files changed** (+130 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `runtime/CMakeLists.txt` (+13 -2) ➕ `runtime/test/glslang_ascii_cwd.py` (+117 -0) </details> ### 📄 Description Claimed in the coordination issue: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7173272902 (BUILD-GLSLANG-NONASCII-RELATIVE-FIXTURE, from alexandersato0830's finding at https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172499920). ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#2110
No description provided.