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
parent 96c3893c
......@@ -316,22 +316,15 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
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);
......
......@@ -452,14 +452,13 @@ IDirect3DSurface9 *Colorbuffer::getRenderTarget()
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 @@ IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil()
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 @@ Depthbuffer::~Depthbuffer()
{
}
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)
......
......@@ -217,7 +217,7 @@ class Colorbuffer : public RenderbufferStorage
class DepthStencilbuffer : public RenderbufferStorage
{
public:
explicit DepthStencilbuffer(IDirect3DSurface9 *depthStencil);
explicit DepthStencilbuffer(renderer::SwapChain *swapChain);
DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
~DepthStencilbuffer();
......@@ -234,7 +234,6 @@ class DepthStencilbuffer : public RenderbufferStorage
class Depthbuffer : public DepthStencilbuffer
{
public:
explicit Depthbuffer(IDirect3DSurface9 *depthStencil);
Depthbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Depthbuffer();
......@@ -246,7 +245,6 @@ class Depthbuffer : public DepthStencilbuffer
class Stencilbuffer : public DepthStencilbuffer
{
public:
explicit Stencilbuffer(IDirect3DSurface9 *depthStencil);
Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Stencilbuffer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment