From 0b5684abbd504fb2b0bb956f280680651b07ad42 Mon Sep 17 00:00:00 2001 From: Yochai Shefi Simchon Date: Thu, 16 Jun 2011 19:15:18 +0300 Subject: [PATCH] 1.1 Translator: fix bug in glDeleteTexture When glDeleteTexture is called for the currently bound texture, binding should be reset to 0. Also, calling glDeleteTexture on 0 should do nothing. --- .../host/libs/Translator/GLES_CM/GLEScmImp.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp index ab4542b93..71febeddc 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp @@ -488,9 +488,17 @@ GL_API void GL_APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures) { SET_ERROR_IF(n<0,GL_INVALID_VALUE); if(thrd->shareGroup.Ptr()) { for(int i=0; i < n; i++){ - thrd->shareGroup->deleteName(TEXTURE,textures[i]); - const GLuint globalTextureName = thrd->shareGroup->getGlobalName(TEXTURE,textures[i]); - ctx->dispatcher().glDeleteTextures(1,&globalTextureName); + if(textures[i] != 0) + { + thrd->shareGroup->deleteName(TEXTURE,textures[i]); + const GLuint globalTextureName = thrd->shareGroup->getGlobalName(TEXTURE,textures[i]); + ctx->dispatcher().glDeleteTextures(1,&globalTextureName); + + if(ctx->getBindedTexture() == textures[i]) + { + ctx->setBindedTexture(0); + } + } } } }