diff options
| author | Ray <[email protected]> | 2021-03-02 02:03:52 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-03-02 02:03:52 +0100 |
| commit | 01b3c97c42d366522a7e82fab2b0ac47e350ee77 (patch) | |
| tree | 43d86ca197620c489eb8e58039f29f09bc25a139 /src/rlgl.h | |
| parent | 8df56c5843778fa9061a51e4f1f5888192fc0c1b (diff) | |
| download | raylib-01b3c97c42d366522a7e82fab2b0ac47e350ee77.tar.gz raylib-01b3c97c42d366522a7e82fab2b0ac47e350ee77.zip | |
Some misc tweaks
Diffstat (limited to 'src/rlgl.h')
| -rw-r--r-- | src/rlgl.h | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -4051,25 +4051,21 @@ static unsigned int CompileShader(const char *shaderStr, int type) glCompileShader(shader); glGetShaderiv(shader, GL_COMPILE_STATUS, &success); - if (success != GL_TRUE) + if (success == GL_FALSE) { TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to compile shader code", shader); + int maxLength = 0; - int length; glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); - -#if defined(_MSC_VER) - char *log = RL_MALLOC(maxLength); -#else - char log[maxLength]; -#endif - glGetShaderInfoLog(shader, maxLength, &length, log); - - TRACELOG(LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log); - -#if defined(_MSC_VER) - RL_FREE(log); -#endif + + if (maxLength > 0) + { + int length = 0; + char *log = RL_CALLOC(maxLength, sizeof(char)); + glGetShaderInfoLog(shader, maxLength, &length, log); + TRACELOG(LOG_WARNING, "SHADER: [ID %i] Compile error: %s", shader, log); + RL_FREE(log); + } } else TRACELOG(LOG_INFO, "SHADER: [ID %i] Compiled successfully", shader); @@ -4113,7 +4109,7 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad if (maxLength > 0) { - int length; + int length = 0; char *log = RL_CALLOC(maxLength, sizeof(char)); glGetProgramInfoLog(program, maxLength, &length, log); TRACELOG(LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log); |
