Allow other attachment points for glFramebufferTexture2D
TRAC #12040
Signed-off-by: Andrew Lewycky
Signed-off-by: Daniel Koch

Author:    Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@194 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Framebuffer.cpp b/src/libGLESv2/Framebuffer.cpp
index 9ca0a8d..fcddd91 100644
--- a/src/libGLESv2/Framebuffer.cpp
+++ b/src/libGLESv2/Framebuffer.cpp
@@ -52,12 +52,23 @@
 
 void Framebuffer::detachTexture(GLuint texture)
 {
-    if (mColorbufferHandle == texture
-        && (mColorbufferType == GL_TEXTURE_2D || es2dx::IsCubemapTextureTarget(mColorbufferType)))
+    if (mColorbufferHandle == texture && es2dx::IsTextureTarget(mColorbufferType))
     {
         mColorbufferType = GL_NONE;
         mColorbufferHandle = 0;
     }
+
+    if (mDepthbufferHandle == texture && es2dx::IsTextureTarget(mDepthbufferType))
+    {
+        mDepthbufferType = GL_NONE;
+        mDepthbufferHandle = 0;
+    }
+
+    if (mStencilbufferHandle == texture && es2dx::IsTextureTarget(mStencilbufferType))
+    {
+        mStencilbufferType = GL_NONE;
+        mStencilbufferHandle = 0;
+    }
 }
 
 void Framebuffer::detachRenderbuffer(GLuint renderbuffer)