Skip to content

Build runtime GLSL fixtures from Unicode Windows paths (BUILD-2482) - #7620

Open
cemalyakla wants to merge 1 commit into
ItsNotRexed:mainfrom
cemalyakla:fix/build-2482-unicode-glsl
Open

cemalyakla wants to merge 1 commit into
ItsNotRexed:mainfrom
cemalyakla:fix/build-2482-unicode-glsl

Conversation

@cemalyakla

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as BUILD-2482. Original report.

What and why

The runtime build passes absolute paths to glslang. On Windows, glslang 16.6.0 failed to open a synthetic shader under a directory containing CJK characters. It also crashed when given relative filenames from that directory. It compiled the same shader from an ASCII directory.

The runtime GLSL rules now share one CMake function. For a non-ASCII Windows build or source path it compiles each standalone fixture in a private ASCII directory and publishes the completed module to the requested output. Other builds invoke the compiler directly. The three occlusion CTests pass fixture paths relative to the build directory so their loaders can open the generated modules. The regression builds two variants concurrently through the production CMake function and reads their workgroup sizes from the resulting SPIR-V.

Two related PRs document the workaround and warn during configuration. This change makes the fixture build succeed in those directories. Documentation #7016 · Configuration warning #7305

Tested

Tested 868caaf9b on Windows 11 with an NVIDIA GeForce RTX 4070 Ti SUPER, driver 610.88, MSVC 19.42 and Windows SDK 10.0.26100.0. The inputs were synthetic.

I configured and built the native runtime with the following commands. The path variables point to local Vulkan headers and glslang 16.6.0.

cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded "-DVulkan_INCLUDE_DIR=$headers" "-DVulkan_GLSLANG_VALIDATOR_EXECUTABLE=$glslang"
cmake --build runtime/build --config RelWithDebInfo
ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure

For the Unicode run I supplied -S "$unicodeCheckout/runtime" -B "$unicodeBuild" at configure time and used "$unicodeBuild" for the build and CTest commands.

  • On ordinary Windows paths, 245 CTests passed, 13 skipped, one was disabled and two failed. Both failing tests gave the same results on the unmodified parent b2801e26e using the same SDK and GPU. In d3d12_indirect_dispatch_count the host returned 6/10 and the layer returned 0/0. In d3d12_vulkan_device the assertion was tiles == 1. Counted dispatch #5792 · Tile count #7125
  • With Unicode source and build directories, the branch built the full runtime and 220 CTests passed. Pristine b2801e26e had 217 passes. For the control build only, a launcher ran unmodified glslang in an ASCII directory and put its byte-identical outputs back. The control used pristine runtime sources, executables and test registrations. Both builds registered 261 tests, skipped 13 and disabled one. Failures fell from 30 to 27. The three restored passes were vk_overlapping_occlusion, vk_overlapping_occlusion_no_statistics and vk_binary_occlusion. Every other result matched, including the remaining Unicode path failures in loaders and runtime tests.
  • Built the 41 configured GLSL outputs from a Unicode Windows checkout and build directory, and compiled the three optional subgroup GLSL fixtures through the same rule. All 44 matched their ASCII controls byte for byte. All passed spirv-val --target-env for their target (4 Vulkan 1.0, 2 Vulkan 1.2 and 38 Vulkan 1.3).
  • A separate check with a Unicode source, output, working directory and temporary-directory settings produced the same module. A deliberately invalid input exited 2 and preserved the previously compiled module.
  • On Linux with Mesa llvmpipe and glslang 15.1.0, 61 CTests passed and two skipped. The new Python/CMake regression passed there too. The commands were cmake -S /src/runtime -B /tmp/linux -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVulkan_INCLUDE_DIR=/headers/include, cmake --build /tmp/linux --config RelWithDebInfo --parallel 3 and ctest --test-dir /tmp/linux -C RelWithDebInfo --output-on-failure.
  • python -I -m unittest discover -s tests/semantic -v ran 5,902 tests with 32 skips. The same two files failed under the repository’s parallel runner, python -I scripts/run_semantic_tests.py tests/semantic -j 6 (444 files). An independent comparison on pristine b2801e26e reproduced all 47 image-atomic guard subtest failures and the single cube-image D16 store failure with identical names and assertions. Upstream semantic fixes #7284
  • python -I tests/test_runtime_paths.py reported one missing workflow path for tools/replace_retry.py. The test has the same failure on pristine b2801e26e. Workflow filter #7029

These local checks passed.

python -I -m compileall -q make_game.py tools tests runtime/cmake
python -I make_game.py --help
python -I tests/test_runtime_glsl_paths.py
python -I tests/test_build_runtime_batch.py
python -I tests/test_build_runtime_fallback.py
python -I tests/test_cmake_vulkan_missing.py
python -I tests/test_ci_registration.py
python -I tests/test_ctest_registration.py
python -I tests/test_llvm_source_version.py
python -I tests/test_check_sparse_queue_family.py
python -I scripts/check_no_game_data.py

AI-assisted with OpenAI Codex.

  • No game data, keys or decryption, including in test fixtures and reports. The tracked-file extension and content checks passed.
  • Translator contract table entry is inapplicable to this build-tool change.

@svds12343 svds12343 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent native Windows validation of PR #7620: PASS within the scope below.

Tested commit: 868caaf
Claim: #7599 (comment)
Windows 11 Pro N (build 26200), NVIDIA GeForce RTX 3070, driver 610.88.
MSVC 19.44.35230, Windows SDK 10.0.26100, Python 3.12.5, CMake 4.4.5,
Ninja 1.13.2, glslang 16.6.0, Vulkan SDK 1.4.363.0.
AI-assisted with Codex. Only repository and hand-written synthetic fixtures were used.

Results:

  • Configured the exact PR head in separate ASCII and Unicode source/build paths
    (CJK source path, Greek/CJK build path). Built all 44 GLSL outputs through the
    production CMake rules, including the three optional subgroup GLSL fixtures.
    All 44 Unicode outputs were byte-for-byte identical to their ASCII controls.
  • All 44 modules passed spirv-val with the configured target environment:
    4 Vulkan 1.0, 2 Vulkan 1.2, 38 Vulkan 1.3. This SDK's spirv-val itself cannot
    open absolute CJK paths, so validation used byte-identical copies in an ASCII
    scratch folder. The actual production build and GPU runs used the Unicode paths.
  • vk_overlapping_occlusion, vk_overlapping_occlusion_no_statistics and
    vk_binary_occlusion passed in both builds: 6/6 CTest executions, zero skips.
    Vulkan validation was enabled and emitted no validation diagnostics.
  • Negative control: invoking the same Unicode-build executables with the old
    CTest registration's absolute Unicode shader arguments failed all 3 tests
    (exit 1). The PR's relative arguments passed all 3. No runtime source was edited.
  • A synthetic compute shader compiled directly with glslang from an ASCII path
    (exit 0), but failed with an absolute CJK source path (exit 1). The new helper
    produced the same bytes for Unicode source only, Unicode output only, and
    Unicode source/output/cwd/TEMP/TMP/TMPDIR together.
  • The production CMake helper also passed all 4 combinations of ASCII/Unicode
    source and build paths, with byte-identical output.
  • Invalid GLSL (exit 2) and a missing source (exit 1) left an existing valid output
    byte-for-byte unchanged and left no staging directory behind.
  • The PR's parallel-variants test passed (1 test; distinct local sizes 1 and 8).
    Additional checks passed: test_build_runtime_batch.py (1),
    test_build_runtime_fallback.py (8), test_cmake_vulkan_missing.py (5),
    test_ci_registration.py (14), test_ctest_registration.py (4): 33 tests total.
    compileall of runtime/cmake and the new test, git diff --check, and the
    no-game-data scan of all four changed files and this report passed.
  • Code review found no blocking issue in the changed CMake rules or helper.
    The PR merged cleanly in git merge-tree with inspected upstream bb6f692.

Commands (run in a configured MSVC/Vulkan/Python shell, once per source/build pair):

cmake -S /runtime -B -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_POLICY_DEFAULT_CMP0141=NEW -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded -DLEONIDA_SDL3=OFF -DVulkan_INCLUDE_DIR=/Include -DVulkan_GLSLANG_VALIDATOR_EXECUTABLE=/Bin/glslangValidator.exe
cmake --build --parallel 6 --target vk_overlapping_occlusion_test vk_binary_occlusion_test <44 configured GLSL output targets>
ctest --test-dir -R "^vk_(overlapping_occlusion(_no_statistics)?|binary_occlusion)$" -V
spirv-val --target-env
python -I tests/test_runtime_glsl_paths.py
python -I tests/test_build_runtime_batch.py
python -I tests/test_build_runtime_fallback.py
python -I tests/test_cmake_vulkan_missing.py
python -I tests/test_ci_registration.py
python -I tests/test_ctest_registration.py
python -I -m compileall -q runtime/cmake tests/test_runtime_glsl_paths.py

Scope: targeted build/path/GPU validation, not a full runtime or translator-suite
rerun. This does not certify the unrelated Unicode loader paths already noted
in the PR, other operating systems, or retail-game behavior. No game files used.

@CourtyardGames

Copy link
Copy Markdown

Code read of 868caaf (I didn't build this head). The helper looks right to me: ASCII scratch copy, relative names, os.replace from a staging dir next to the output, and the direct command is unchanged for ASCII builds.

One path worth a check: with a non-ASCII profile (the original report's C:\Users\José/東京 case), tempfile.gettempdir() is under that profile too, so every shader falls back to %SystemRoot%\Temp. That's writable for standard users on a default install, but it's the only fallback left there, and the error message tells the user to set TEMP, which they can't do if their profile is the problem.

For comparison, I measured the same three failure modes independently (glslang 16.6.0, ACP 1252, folder 東京: cwd → 0xC0000409, input → "unable to open input file", output → "Failed to open file"; José works). I also tried a different fix that needs no scratch folder: a build-dir copy of glslangValidator.exe with activeCodePage=UTF-8 merged into its manifest via mt.exe, so glslang's narrow argv, fopen and current_path() are all UTF-8. From a %TEMP%\…\東京 checkout, main failed 41 of 41 GLSL steps and that branch built 41 of 41 (ASCII folder unchanged, no copy made). The tradeoffs are that it needs mt.exe (it's in the VS dev environment) and Windows 10 1903+. Branch, in case it's useful to the maintainer: CourtyardGames/Leonida@main...runtime/glslang-utf8. I'm not opening a PR for it, since this one came first (I released RT-518 in the coordination issue). AI-assisted.

@cemalyakla

Copy link
Copy Markdown
Contributor Author

I checked the profile fallback on 868caaf9b with glslang 16.6.0 under a non-elevated Windows account. I set the child process’s profile, TEMP, TMP and TMPDIR to synthetic CJK paths and put the source, output and working directory there too. A Python audit hook recorded the real compiler starting in a private directory under %SystemRoot%\Temp. The output matched the ASCII control byte for byte. Original question

I also simulated an unavailable system temp directory without changing any machine settings. The helper reported the scratch-directory error and preserved the previous output. Pointing TEMP at a writable ASCII directory for just the build process worked with the same Unicode profile. If TMPDIR is explicitly set, Python gives it precedence, so I also tested pointing both variables at that directory. That produced the same bytes again.

@CourtyardGames

Copy link
Copy Markdown

Tested 868caaf on Windows 11 Home (ACP 1252), MSVC 14.51, CMake 4.3.1-msvc1 + Ninja, glslang 16.6.0 (conda-forge), Python 3.14: pass.

  • runtime/ configured from %TEMP%\glsl_e2e\東京\L (source and build both under 東京), then every .spv target built with ninja -k 0: 41/41, 0 failed. main (dde82f2) fails 41/41 in the same folder ("unable to open input file").
  • Same checkout in an ASCII folder: 41/41. The 東京 outputs are byte-identical to the ASCII ones (41/41 same SHA-256).
  • Non-ASCII profile case (my note above): rebuilt the 東京 tree with TEMP and TMP set to a 東京\Temp folder: 41/41, so the %SystemRoot%\Temp fallback works for a non-elevated user here, and no leonida-glsl-* folders were left behind.
  • python -I tests/test_runtime_glsl_paths.py: OK.

Shader outputs only; I didn't run the GPU tests or ctest on this head. AI-assisted.

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.

3 participants