* GlExtensionDestroy() was not being called on clean-up
* PrepareTexture() was not being called when binding the texture
* Error code returned from TargetTexture() was not being handled
Change-Id: Ie3e8f9d5cc973da8a72eea68838e9443a3421077
if( mId )
{
context.DeleteTextures( 1, &mId );
if( mId )
{
context.DeleteTextures( 1, &mId );
+
+ if( mNativeImage )
+ {
+ mNativeImage->GlExtensionDestroy();
+ }
context.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_WRAP_DEFAULT );
// platform specific implementation decides on what GL extension to use
context.TexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_WRAP_DEFAULT );
// platform specific implementation decides on what GL extension to use
- mNativeImage->TargetTexture();
+ if( mNativeImage->TargetTexture() != 0u )
+ {
+ context.DeleteTextures( 1, &mId );
+ mNativeImage->GlExtensionDestroy();
+ mId = 0u;
+ }
ApplySampler( context, sampler );
ApplySampler( context, sampler );
+ if( mNativeImage )
+ {
+ //Allow implementation specific operations after binding the texture
+ mNativeImage->PrepareTexture();
+ }
+