diff options
author | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-09-04 22:37:09 -0700 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2015-09-04 22:37:09 -0700 |
commit | 223661c47217561694ec84486871b6dc445171b3 (patch) | |
tree | f0536397d793a120a445497036ef77243c0b97e8 /misc | |
parent | cef224497dbfb40a7b90e7eca968f8979b7d2a38 (diff) |
misc/glsl_scraper: Encode the compile error in formation in the exception
Diffstat (limited to 'misc')
-rw-r--r-- | misc/glsl_scraper.py | 11 |
1 files changed, 8 insertions, 3 deletions
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 |