From cbdb9bfe429c38754b4809aac60fa72bf1727d1d Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 16 Sep 2020 16:33:17 +0200 Subject: [PATCH] REVIEWED: UnloadShader() issue Avoid unloading default shader, raylib will take care of it --- src/rlgl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 4a936421..b7596b0e 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -3161,13 +3161,13 @@ Shader LoadShaderCode(const char *vsCode, const char *fsCode) // Unload shader from GPU memory (VRAM) void UnloadShader(Shader shader) { - if (shader.id > 0) + if ((shader.id != RLGL.State.defaultShader.id) && (shader.id > 0)) { rlDeleteShader(shader.id); + RL_FREE(shader.locs); + TRACELOG(LOG_INFO, "SHADER: [ID %i] Unloaded shader program data from VRAM (GPU)", shader.id); } - - RL_FREE(shader.locs); } // Begin custom shader mode