From 12c8cbd2d52cea3c419050eeaa0fab3f52363e91 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 22 Apr 2020 21:30:02 +1000 Subject: [PATCH] If fail to compile shader/program, show a dialog with compilation failure message Used to just log to stdout, but this was pretty user unfriendly. Especially for mobile web browser. --- src/Graphics.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Graphics.c b/src/Graphics.c index cac4bed2b..515c3f2c4 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -1535,6 +1535,7 @@ static void Gfx_GenFragmentShader(const struct GLShader* shader, String* dst) { /* Tries to compile GLSL shader code. Aborts program on failure. */ static GLuint Gfx_CompileShader(GLenum type, const String* src) { + char logInfo[2048]; GLint temp, shader; int len; @@ -1551,11 +1552,9 @@ static GLuint Gfx_CompileShader(GLenum type, const String* src) { glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &temp); if (temp > 1) { - char logInfo[2048]; glGetShaderInfoLog(shader, 2047, NULL, logInfo); - logInfo[2047] = '\0'; - Platform_LogConst(logInfo); + Window_ShowDialog("Failed to compile shader", logInfo); } Logger_Abort("Failed to compile shader"); return 0; @@ -1612,7 +1611,7 @@ static void Gfx_CompileProgram(struct GLShader* shader) { if (temp > 0) { glGetProgramInfoLog(program, 2047, NULL, tmpBuffer); tmpBuffer[2047] = '\0'; - Platform_LogConst(tmpBuffer); + Window_ShowDialog("Failed to compile program", tmpBuffer); } Logger_Abort("Failed to compile program"); }