From a05350ced32fe6987a9b5e696d2f40481b465bb9 Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Mon, 17 Aug 2026 23:06:02 +0200 Subject: [PATCH] [Build] Fix the SPIR-V shader script hiding the error it is reporting Steps 2 and 3 (spirv-opt, spirv-dis) run subprocess without text=True, so result.stderr is bytes -- and `sys.stderr.write(bytes)` raises TypeError. The tool's real message is replaced by a Python traceback at exactly the moment you need it. Building in a clean container, the visible failure was: ERROR: spirv-opt failed for guest_output_bilinear.ps.xesl TypeError: write() argument must be str, not bytes with the actual cause -- `Unknown flag '--canonicalize-ids'`, i.e. a SPIRV-Tools too old -- never printed. Use .buffer.write, as compile_shader_dxbc.py already does at the same site. Co-Authored-By: Claude Opus 5 (1M context) --- tools/build/compile_shader_spirv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/build/compile_shader_spirv.py b/tools/build/compile_shader_spirv.py index 2f7eb262c..49dec0786 100644 --- a/tools/build/compile_shader_spirv.py +++ b/tools/build/compile_shader_spirv.py @@ -107,7 +107,7 @@ def main(): if result.returncode != 0: print(f"ERROR: glslangValidator failed for {src_name}", file=sys.stderr) if result.stderr: - sys.stderr.write(result.stderr) + sys.stderr.buffer.write(result.stderr) return 1 # Step 2: spirv-opt @@ -118,7 +118,7 @@ def main(): if result.returncode != 0: print(f"ERROR: spirv-opt failed for {src_name}", file=sys.stderr) if result.stderr: - sys.stderr.write(result.stderr) + sys.stderr.buffer.write(result.stderr) return 1 # Step 3: spirv-dis @@ -127,7 +127,7 @@ def main(): if result.returncode != 0: print(f"ERROR: spirv-dis failed for {src_name}", file=sys.stderr) if result.stderr: - sys.stderr.write(result.stderr) + sys.stderr.buffer.write(result.stderr) return 1 # Step 4: Generate header