Improve error handling when shader does not compile
This commit is contained in:
@@ -4,6 +4,7 @@ package lime.utils;
|
||||
import lime.graphics.opengl.GLProgram;
|
||||
import lime.graphics.opengl.GLShader;
|
||||
import lime.graphics.opengl.GL;
|
||||
import lime.utils.Log;
|
||||
|
||||
|
||||
class GLUtils {
|
||||
@@ -17,14 +18,17 @@ class GLUtils {
|
||||
|
||||
if (GL.getShaderParameter (shader, GL.COMPILE_STATUS) == 0) {
|
||||
|
||||
switch (type) {
|
||||
var message = switch (type) {
|
||||
|
||||
case GL.VERTEX_SHADER: throw "Error compiling vertex shader";
|
||||
case GL.FRAGMENT_SHADER: throw "Error compiling fragment shader";
|
||||
default: throw "Error compiling unknown shader type";
|
||||
case GL.VERTEX_SHADER: "Error compiling vertex shader";
|
||||
case GL.FRAGMENT_SHADER: "Error compiling fragment shader";
|
||||
default: "Error compiling unknown shader type";
|
||||
|
||||
}
|
||||
|
||||
message += "\n" + GL.getShaderInfoLog (shader);
|
||||
Log.error (message);
|
||||
|
||||
}
|
||||
|
||||
return shader;
|
||||
@@ -44,7 +48,7 @@ class GLUtils {
|
||||
|
||||
if (GL.getProgramParameter (program, GL.LINK_STATUS) == 0) {
|
||||
|
||||
throw "Unable to initialize the shader program.";
|
||||
Log.error ("Unable to initialize the shader program");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user