Use UTF-8 for shader library module filenames (SHADER-LIBRARY-UTF8-MODULE-PATHS) #2043

Merged
alexandersato0830 merged 1 commit from upstream-pr/2043 into main 2026-11-29 13:21:12 +00:00
alexandersato0830 commented 2026-11-25 18:54:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by alexandersato0830 on 2026-11-25T18:54:17Z.


Claimed in the coordination issue as: SHADER-LIBRARY-UTF8-MODULE-PATHS

What and why

Index strings are decoded as UTF-8. spirv_bytes() and spirv() append those strings as narrow paths, which on Windows can use the system code page. A shader indexed as cs_\u00e9 can therefore be found in the metadata but missed on disk.

Use one path builder that appends the filename as UTF-8 for both the generated filename and the explicit spv fallback. A filename the host cannot decode is treated as unavailable, so a working fallback can still be used.

Tested

  • The synthetic Unicode module regression fails on 9f9a7c5f3 in spirv_bytes(). With the fix, the CMake shader_library test passes in RelWithDebInfo on Windows 11 using MSVC 19.51. It checks size and word reads through both filename forms and a malformed default name with a valid fallback.
  • git diff --check and the source-only check passed.

GPUs tested: n/a (CPU-only synthetic shader files)

AI-assisted: yes (Codex)

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5497279453 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2043). Originally posted by [alexandersato0830](https://github.com/alexandersato0830) on 2026-11-25T18:54:17Z. --- Claimed in the coordination issue as: [SHADER-LIBRARY-UTF8-MODULE-PATHS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171516110) ### What and why Index strings are decoded as UTF-8. `spirv_bytes()` and `spirv()` append those strings as narrow paths, which on Windows can use the system code page. A shader indexed as `cs_\u00e9` can therefore be found in the metadata but missed on disk. Use one path builder that appends the filename as UTF-8 for both the generated filename and the explicit `spv` fallback. A filename the host cannot decode is treated as unavailable, so a working fallback can still be used. ### Tested - The synthetic Unicode module regression fails on `9f9a7c5f3` in `spirv_bytes()`. With the fix, the CMake `shader_library` test passes in RelWithDebInfo on Windows 11 using MSVC 19.51. It checks size and word reads through both filename forms and a malformed default name with a valid fallback. - `git diff --check` and the source-only check passed. GPUs tested: n/a (CPU-only synthetic shader files) AI-assisted: yes (Codex) ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys or decryption.
zmasi commented 2026-11-28 12:24:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:24:16Z.


Verified on Windows 11 (10.0.26200.9974) with MSVC 19.44.35228 (x64, /std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) against main d48a957bb + 6198879899 (claim #2570#issuecomment-7239117859):

  • Line-by-line diff audit: Clean (runtime/src/shader_library.h, runtime/test/shader_library_test.cpp); builds module paths via std::u8string so Windows std::filesystem::path decodes JSON filenames as UTF-8 instead of the host narrow code page, and catches std::system_error on malformed UTF-8 so spirv_bytes / spirv fall back to entry.spv_file. check_no_game_data.py clean; also merges cleanly alongside #2045.
  • Red (d48a957bb + PR test): shader_library_test.exe fails on Windows 11 (rc=1, line 744: module && utf8.spirv_bytes(*module) == sizeof(words)).
  • Green (d48a957bb + 6198879899 merge): Auto-merges cleanly (rc=0), introduces 0 new compiler warnings, and passes (SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK, rc=0).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239203795 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2043#issuecomment-7239203795). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T12:24:16Z. --- Verified on Windows 11 (`10.0.26200.9974`) with MSVC `19.44.35228` (`x64`, `/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`) against `main` `d48a957bb` + `6198879899` (claim `#2570#issuecomment-7239117859`): - **Line-by-line diff audit**: Clean (`runtime/src/shader_library.h`, `runtime/test/shader_library_test.cpp`); builds module paths via `std::u8string` so Windows `std::filesystem::path` decodes JSON filenames as UTF-8 instead of the host narrow code page, and catches `std::system_error` on malformed UTF-8 so `spirv_bytes` / `spirv` fall back to `entry.spv_file`. `check_no_game_data.py` clean; also merges cleanly alongside `#2045`. - **Red (`d48a957bb` + PR test)**: `shader_library_test.exe` fails on Windows 11 (`rc=1`, `line 744: module && utf8.spirv_bytes(*module) == sizeof(words)`). - **Green (`d48a957bb` + `6198879899` merge)**: Auto-merges cleanly (`rc=0`), introduces `0` new compiler warnings, and passes (`SHA-256, inflate (stored/fixed/dynamic), JSON, FSSM extraction, FSPX programs and index lookup OK`, `rc=0`). AI-assisted.
OreoFR commented 2026-11-29 03:45:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T03:45:35Z.


Verified by OreoFR

  • Base: main aa918e5d9 + PR head 619887989
  • Test: ctest -R ^shader_library$
  • Red on main: fails at line 744: the module whose file name is non-ASCII (UTF-8) is not found
  • Green with the PR: passes; package builds, full ctest shows no new failure (xs_proxy_mock, xmem_no_write_watch, xmem_write_watch failed once under load and pass on a serial rerun)
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

Note: shares runtime/src/shader_library.h, runtime/test/shader_library_test.cpp with the open #2566; a rebase may be needed if #2566 lands first.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250241461 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2043#issuecomment-7250241461). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T03:45:35Z. --- **Verified by OreoFR** - Base: main `aa918e5d9` + PR head `619887989` - Test: `ctest -R ^shader_library$` - Red on main: fails at line 744: the module whose file name is non-ASCII (UTF-8) is not found - Green with the PR: passes; package builds, full ctest shows no new failure (`xs_proxy_mock`, `xmem_no_write_watch`, `xmem_write_watch` failed once under load and pass on a serial rerun) - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 Note: shares `runtime/src/shader_library.h`, `runtime/test/shader_library_test.cpp` with the open #2566; a rebase may be needed if #2566 lands first. AI-assisted (Claude Code, Claude Opus 5.5).
MoonEyes commented 2026-11-29 14:19:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:19:04Z.


Merged at head 6198879. Tested by others, not re-run on my side (organizing machine, no build): OreoFR, Windows + RTX 4070, ctest -R ^shader_library$ red on main, green with this PR; zmasi, Windows 11 + MSVC 19.44, same result. GPUs: n/a for this test. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257208780 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2043#issuecomment-7257208780). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:19:04Z. --- Merged at head 6198879. Tested by others, not re-run on my side (organizing machine, no build): OreoFR, Windows + RTX 4070, `ctest -R ^shader_library$` red on main, green with this PR; zmasi, Windows 11 + MSVC 19.44, same result. GPUs: n/a for this test. AI-assisted: yes.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2043
No description provided.