Pass swapchain to DepthStencil constructor instead of d3d9 surface

Trac #21810
Signed-off-by: Nicolas Capens

Also get rid of unused StencilBuffer and Depthbuffer constructors

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1355 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Renderbuffer.cpp b/src/libGLESv2/Renderbuffer.cpp
index 6065afb..f8840ec 100644
--- a/src/libGLESv2/Renderbuffer.cpp
+++ b/src/libGLESv2/Renderbuffer.cpp
@@ -452,14 +452,13 @@
     return mRenderTarget;
 }
 
-DepthStencilbuffer::DepthStencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil)
+DepthStencilbuffer::DepthStencilbuffer(renderer::SwapChain *swapChain)
 {
-    if (depthStencil)
+    mDepthStencil = swapChain->getDepthStencil();
+    if (mDepthStencil)
     {
-        depthStencil->AddRef();
-
         D3DSURFACE_DESC description;
-        depthStencil->GetDesc(&description);
+        mDepthStencil->GetDesc(&description);
 
         mWidth = description.Width;
         mHeight = description.Height;
@@ -527,16 +526,6 @@
     return mDepthStencil;
 }
 
-Depthbuffer::Depthbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-    if (depthStencil)
-    {
-        mInternalFormat = GL_DEPTH_COMPONENT16;   // If the renderbuffer parameters are queried, the calling function
-                                                  // will expect one of the valid renderbuffer formats for use in 
-                                                  // glRenderbufferStorage
-    }
-}
-
 Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
 {
     if (mDepthStencil)
@@ -551,16 +540,6 @@
 {
 }
 
-Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-    if (depthStencil)
-    {
-        mInternalFormat = GL_STENCIL_INDEX8;   // If the renderbuffer parameters are queried, the calling function
-                                               // will expect one of the valid renderbuffer formats for use in 
-                                               // glRenderbufferStorage
-    }
-}
-
 Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
 {
     if (mDepthStencil)