Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

An OpenGL game's missing glslangValidator is reported before the long steps (issue #71)

LNPANDY9454caf68622
diff --git a/scripts/build_ipa_from_nsp.py b/scripts/build_ipa_from_nsp.py
index 83b08ac3..fe9c6f96 100755
--- a/scripts/build_ipa_from_nsp.py
+++ b/scripts/build_ipa_from_nsp.py
@@ -2070,6 +2070,11 @@ def main(args=None):
if gfx == 'vulkan': say(f'Vulkan game ({src["graphics"][1]}): vk_shaders.py translates the shaders instead of the NVN shader chain')
if gfx == 'gl': say(f'OpenGL game ({src["graphics"][1]}): gl_shaders.py translates the shaders instead of the NVN shader chain')
if gfx == 'nvn': check_metal(py, repo, env) # before the captures and the shader split, which take minutes
+ # Same reason as check_metal: build_gl_shaders checks for glslangValidator, but by then the
+ # extraction and the capture have run for minutes, and the check raises before layer_shaders
+ # creates gl_shaders.log — so the GUI showed a failure with no log to read (issue #71).
+ if gfx == 'gl' and not shutil.which('glslangValidator', path=env['PATH']):
+ raise BuildError("glslangValidator is not installed: an OpenGL game's GLSL shaders need it to compile to SPIR-V (brew install glslang)")
for on, k in ((glslc, 'glslc_capture'), (vkcap, 'vk_capture'), (glcap, 'gl_capture'), (uedec, 'ue_decode'), (gfx == 'nvn' and src['oodle_packs'][0], 'oodle_packs'), (gfx == 'nvn' and src['ue_legacy'][0], 'ue_legacy')):
if on: say(src[k][1])
PROG.add(glslc + vkcap + glcap + uedec + (gfx == 'nvn'))
diff --git a/scripts/sync_upstream.py b/scripts/sync_upstream.py
index 5f32a44b..60043bff 100644
--- a/scripts/sync_upstream.py
+++ b/scripts/sync_upstream.py
@@ -732,6 +732,19 @@ def rmtree(p):
# Say so here instead (ufooer's PR #31, item 3).
if sys.platform == 'darwin' and subprocess.run(['sysctl', '-n', 'sysctl.proc_translated'], capture_output=True, text=True).stdout.strip() == '1':
raise BuildError(f'{sys.executable} is an Intel Python running under Rosetta; run the build with a native arm64 Python (e.g. /usr/bin/python3 or Homebrew in /opt/homebrew)')
+""")]))
+ # glslangValidator is only needed by an OpenGL game, and build_gl_shaders already checks for it —
+ # but by then the extraction and the capture have run for minutes, and the check raises before
+ # layer_shaders creates gl_shaders.log, so the failure had no log to read (issue #71). Checked
+ # next to check_metal, which is in the same place for the same reason.
+ P.append(('GL shader tool check', 'glslangValidator is not installed', [(
+ " if gfx == 'nvn': check_metal(py, repo, env) # before the captures and the shader split, which take minutes\n",
+ """ if gfx == 'nvn': check_metal(py, repo, env) # before the captures and the shader split, which take minutes
+ # Same reason as check_metal: build_gl_shaders checks for glslangValidator, but by then the
+ # extraction and the capture have run for minutes, and the check raises before layer_shaders
+ # creates gl_shaders.log — so the GUI showed a failure with no log to read (issue #71).
+ if gfx == 'gl' and not shutil.which('glslangValidator', path=env['PATH']):
+ raise BuildError("glslangValidator is not installed: an OpenGL game's GLSL shaders need it to compile to SPIR-V (brew install glslang)")
""")]))
for name, marker, pairs in P:
if marker in t: