From 223661c47217561694ec84486871b6dc445171b3 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 4 Sep 2015 22:37:09 -0700 Subject: misc/glsl_scraper: Encode the compile error in formation in the exception --- misc/glsl_scraper.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'misc') diff --git a/misc/glsl_scraper.py b/misc/glsl_scraper.py index cc0861e..f2aa9b6 100644 --- a/misc/glsl_scraper.py +++ b/misc/glsl_scraper.py @@ -12,8 +12,8 @@ import tempfile from textwrap import dedent class ShaderCompileError(RuntimeError): - def __init__(self): - super(ShaderCompileError, self).__init__('Compile error') + def __init__(self, *args): + super(ShaderCompileError, self).__init__(*args) class Shader: def __init__(self, stage): @@ -50,13 +50,18 @@ class Shader: with subprocess.Popen([glslc] + extra_args + [stage_flag, '-std=430core', '-o', '-', '-'], stdout = subprocess.PIPE, + stderr = subprocess.PIPE, stdin = subprocess.PIPE) as proc: proc.stdin.write(self.glsl_source().encode('utf-8')) out, err = proc.communicate(timeout=30) if proc.returncode != 0: - raise ShaderCompileError() + # Unfortunately, glslang dumps errors to standard out. + # However, since we don't really want to count on that, + # we'll grab the output of both + message = out.decode('utf-8') + '\n' + err.decode('utf-8') + raise ShaderCompileError(message.strip()) return out -- cgit v1.2.3