Commit 8cce70e1 by Nicolas Capens Committed by Nicolas Capens

Fail GLSL compilation if compiler initialization fails

Bug: b/137828018 Change-Id: Ia30de6af925213269768e3123d3f4ecf821624fb Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/34468Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent b51a6f0c
...@@ -158,8 +158,14 @@ TranslatorASM *Shader::createCompiler(GLenum shaderType) ...@@ -158,8 +158,14 @@ TranslatorASM *Shader::createCompiler(GLenum shaderType)
{ {
if(!compilerInitialized) if(!compilerInitialized)
{ {
InitCompilerGlobals(); compilerInitialized = InitCompilerGlobals();
compilerInitialized = true;
if(!compilerInitialized)
{
infoLog += "GLSL compiler failed to initialize.\n";
return nullptr;
}
} }
TranslatorASM *assembler = new TranslatorASM(this, shaderType); TranslatorASM *assembler = new TranslatorASM(this, shaderType);
...@@ -205,6 +211,13 @@ void Shader::compile() ...@@ -205,6 +211,13 @@ void Shader::compile()
createShader(); createShader();
TranslatorASM *compiler = createCompiler(getType()); TranslatorASM *compiler = createCompiler(getType());
if(!compiler)
{
deleteShader();
return;
}
// Ensure we don't pass a nullptr source to the compiler // Ensure we don't pass a nullptr source to the compiler
const char *source = "\0"; const char *source = "\0";
if(mSource) if(mSource)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment