mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-22 19:18:31 +00:00
REVIEWED: LoadShaderProgram() #1563
Try to avoid a possible false-positive memory leak...
This commit is contained in:
22
src/rlgl.h
22
src/rlgl.h
@@ -3639,7 +3639,6 @@ TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int si
|
|||||||
|
|
||||||
// Generate mipmaps for the prefiltered HDR texture
|
// Generate mipmaps for the prefiltered HDR texture
|
||||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||||
//rlGenerateMipmaps(Texture2D *texture); // Only GL_TEXTURE_2D
|
|
||||||
|
|
||||||
// STEP 2: Draw to framebuffer
|
// STEP 2: Draw to framebuffer
|
||||||
//------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------
|
||||||
@@ -4113,22 +4112,17 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
|
|||||||
TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to link shader program", program);
|
TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to link shader program", program);
|
||||||
|
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
int length;
|
|
||||||
|
|
||||||
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
|
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
if (maxLength > 0)
|
||||||
char *log = RL_MALLOC(maxLength);
|
{
|
||||||
#else
|
int length;
|
||||||
char log[maxLength];
|
char *log = RL_CALLOC(maxLength, sizeof(char));
|
||||||
#endif
|
glGetProgramInfoLog(program, maxLength, &length, log);
|
||||||
glGetProgramInfoLog(program, maxLength, &length, log);
|
TRACELOG(LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log);
|
||||||
|
RL_FREE(log);
|
||||||
|
}
|
||||||
|
|
||||||
TRACELOG(LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log);
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
RL_FREE(log);
|
|
||||||
#endif
|
|
||||||
glDeleteProgram(program);
|
glDeleteProgram(program);
|
||||||
|
|
||||||
program = 0;
|
program = 0;
|
||||||
|
Reference in New Issue
Block a user