am fc7a319e: am 91d4e8e1: GLESv2 translator: don\'t delete EGLImage textures

* commit 'fc7a319e5c60cb634df20d6a7fcb6f23a584b449':
  GLESv2 translator: don't delete EGLImage textures
This commit is contained in:
Jesse Hall
2012-02-22 10:15:27 -08:00
committed by Android Git Automerger
2 changed files with 12 additions and 4 deletions

View File

@@ -1682,6 +1682,7 @@ GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOE
texData->internalFormat = img->internalFormat; texData->internalFormat = img->internalFormat;
texData->sourceEGLImage = (unsigned int)image; texData->sourceEGLImage = (unsigned int)image;
texData->eglImageDetach = s_eglIface->eglDetachEGLImage; texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
texData->oldGlobal = oldGlobal;
} }
} }
} }

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright(C) 2011 The Android Open Source Project * Copyright (C) 2011 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0(the "License"){ GET_CTX();} * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
@@ -2017,15 +2017,22 @@ GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglIma
if (ctx->shareGroup().Ptr()) { if (ctx->shareGroup().Ptr()) {
ObjectLocalName tex = TextureLocalName(target,ctx->getBindedTexture(target)); ObjectLocalName tex = TextureLocalName(target,ctx->getBindedTexture(target));
unsigned int oldGlobal = ctx->shareGroup()->getGlobalName(TEXTURE, tex); unsigned int oldGlobal = ctx->shareGroup()->getGlobalName(TEXTURE, tex);
// Delete old texture object // Delete old texture object but only if it is not a target of a EGLImage
if (oldGlobal) { if (oldGlobal) {
ctx->dispatcher().glDeleteTextures(1, &oldGlobal); TextureData* oldTexData = getTextureData(tex);
if (!oldTexData || oldTexData->sourceEGLImage == 0) {
ctx->dispatcher().glDeleteTextures(1, &oldGlobal);
}
} }
// replace mapping and bind the new global object // replace mapping and bind the new global object
ctx->shareGroup()->replaceGlobalName(TEXTURE, tex,img->globalTexName); ctx->shareGroup()->replaceGlobalName(TEXTURE, tex,img->globalTexName);
ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, img->globalTexName); ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, img->globalTexName);
TextureData *texData = getTextureTargetData(target); TextureData *texData = getTextureTargetData(target);
SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION);
texData->width = img->width;
texData->height = img->height;
texData->border = img->border;
texData->internalFormat = img->internalFormat;
texData->sourceEGLImage = (unsigned int)image; texData->sourceEGLImage = (unsigned int)image;
texData->eglImageDetach = s_eglIface->eglDetachEGLImage; texData->eglImageDetach = s_eglIface->eglDetachEGLImage;
texData->oldGlobal = oldGlobal; texData->oldGlobal = oldGlobal;