Move Texture Serials to the base class.

It's reasonable to use the serial logic on both the GL and all other
translated Renderers, since we check the logic on the GL-side.
Serials give us a way to identify Textures that aren't raw pointers
and aren't "id". "id" has issues when Textures are deleted, then
re-allocated with the same value.

BUG=angle:781

Change-Id: I1a2a8b6f4ea3db915574c957c143a81e0210ec7d
Reviewed-on: https://chromium-review.googlesource.com/222922
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/libGLESv2/Texture.cpp b/src/libGLESv2/Texture.cpp
index 3a70d57..4786802 100644
--- a/src/libGLESv2/Texture.cpp
+++ b/src/libGLESv2/Texture.cpp
@@ -47,9 +47,12 @@
     return (samplerState.magFilter == GL_NEAREST && (samplerState.minFilter == GL_NEAREST || samplerState.minFilter == GL_NEAREST_MIPMAP_NEAREST));
 }
 
+unsigned int Texture::mCurrentTextureSerial = 1;
+
 Texture::Texture(rx::TextureImpl *impl, GLuint id, GLenum target)
     : RefCountObject(id),
       mTexture(impl),
+      mTextureSerial(issueTextureSerial()),
       mUsage(GL_NONE),
       mImmutableLevelCount(0),
       mTarget(target)
@@ -154,10 +157,14 @@
     return mTexture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, source);
 }
 
-unsigned int Texture::getTextureSerial()
+unsigned int Texture::getTextureSerial() const
 {
-    rx::TextureStorage *texture = getNativeTexture();
-    return texture ? texture->getTextureSerial() : 0;
+    return mTextureSerial;
+}
+
+unsigned int Texture::issueTextureSerial()
+{
+    return mCurrentTextureSerial++;
 }
 
 bool Texture::isImmutable() const