Skip to content

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

Merged
MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
alexandersato0830:codex/shader-library-utf8-module-paths
Nov 29, 2026
Merged

MoonEyes merged 1 commit into
ProjectLeonida:mainfrom
alexandersato0830:codex/shader-library-utf8-module-paths

Conversation

@alexandersato0830

Copy link
Copy Markdown
Contributor

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.

@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

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

OreoFR commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

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
MoonEyes merged commit 51d343b into ProjectLeonida:main Nov 29, 2026
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.

4 participants