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/Context.cpp b/src/libGLESv2/Context.cpp
index 0b4b647..bf780d8 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -316,22 +316,15 @@
         mHasBeenCurrent = true;
     }
 
-    // Wrap the existing Direct3D 9 resources into GL objects and assign them to the '0' names
-    // D3D9_REPLACE
+    // Wrap the existing swapchain resources into GL objects and assign them to the '0' names
     renderer::SwapChain *swapchain = surface->getSwapChain();
-    IDirect3DSurface9 *depthStencil = swapchain->getDepthStencil();
 
     Colorbuffer *colorbufferZero = new Colorbuffer(swapchain);
-    DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
+    DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(swapchain);
     Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero);
 
     setFramebufferZero(framebufferZero);
 
-    if (depthStencil)
-    {
-        depthStencil->Release();
-    }
-
     // Reset pixel shader to null to work around a bug that only happens with Intel GPUs.
     // http://crbug.com/110343
     mDevice->SetPixelShader(NULL);