diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2021-02-11 18:38:52 +0100 |
---|---|---|
committer | RSDuck <RSDuck@users.noreply.github.com> | 2021-02-11 18:38:52 +0100 |
commit | f1e0816c1af934f38baa8c3095d03512b462db67 (patch) | |
tree | 218382a80cbf8dfaec0d1e1c495bebf0763f59b2 /src | |
parent | f05bc50d40cded130e188d165e6b310f2a72d58f (diff) |
detach and delete shaders directly after linking
Diffstat (limited to 'src')
-rw-r--r-- | src/OpenGLSupport.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/OpenGLSupport.cpp b/src/OpenGLSupport.cpp index 01fa9d8..a133c41 100644 --- a/src/OpenGLSupport.cpp +++ b/src/OpenGLSupport.cpp @@ -87,6 +87,12 @@ bool LinkShaderProgram(GLuint* ids) glLinkProgram(ids[2]); + glDetachShader(ids[2], ids[0]); + glDetachShader(ids[2], ids[1]); + + glDeleteShader(ids[0]); + glDeleteShader(ids[1]); + glGetProgramiv(ids[2], GL_LINK_STATUS, &res); if (res != GL_TRUE) { @@ -97,8 +103,6 @@ bool LinkShaderProgram(GLuint* ids) printf("OpenGL: failed to link shader program: %s\n", log); delete[] log; - glDeleteShader(ids[0]); - glDeleteShader(ids[1]); glDeleteProgram(ids[2]); return false; @@ -109,8 +113,6 @@ bool LinkShaderProgram(GLuint* ids) void DeleteShaderProgram(GLuint* ids) { - glDeleteShader(ids[0]); - glDeleteShader(ids[1]); glDeleteProgram(ids[2]); } |