[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) <noreply@anthropic.com>
This commit is contained in:
@@ -107,7 +107,7 @@ def main():
|
|||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print(f"ERROR: glslangValidator failed for {src_name}", file=sys.stderr)
|
print(f"ERROR: glslangValidator failed for {src_name}", file=sys.stderr)
|
||||||
if result.stderr:
|
if result.stderr:
|
||||||
sys.stderr.write(result.stderr)
|
sys.stderr.buffer.write(result.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Step 2: spirv-opt
|
# Step 2: spirv-opt
|
||||||
@@ -118,7 +118,7 @@ def main():
|
|||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print(f"ERROR: spirv-opt failed for {src_name}", file=sys.stderr)
|
print(f"ERROR: spirv-opt failed for {src_name}", file=sys.stderr)
|
||||||
if result.stderr:
|
if result.stderr:
|
||||||
sys.stderr.write(result.stderr)
|
sys.stderr.buffer.write(result.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Step 3: spirv-dis
|
# Step 3: spirv-dis
|
||||||
@@ -127,7 +127,7 @@ def main():
|
|||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print(f"ERROR: spirv-dis failed for {src_name}", file=sys.stderr)
|
print(f"ERROR: spirv-dis failed for {src_name}", file=sys.stderr)
|
||||||
if result.stderr:
|
if result.stderr:
|
||||||
sys.stderr.write(result.stderr)
|
sys.stderr.buffer.write(result.stderr)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Step 4: Generate header
|
# Step 4: Generate header
|
||||||
|
|||||||
Reference in New Issue
Block a user