Deleting program does not delete shaders that are marked
TRAC #12012
Also fixes failure to delete flagged program upon glUseProgram(0).
Signed-off-by: Nicolas Capens
Signed-off-by: Daniel Koch
Author: Andrew Lewycky
git-svn-id: https://angleproject.googlecode.com/svn/trunk@201 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index a60d7d9..9903870 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -550,12 +550,13 @@
{
Program *programObject = getCurrentProgram();
+ GLuint priorProgram = currentProgram;
+ currentProgram = program; // Must switch before trying to delete, otherwise it only gets flagged.
+
if (programObject && programObject->isFlaggedForDeletion())
{
- deleteProgram(currentProgram);
+ deleteProgram(priorProgram);
}
-
- currentProgram = program;
}
void Context::setFramebufferZero(Framebuffer *buffer)