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) ...@@ -316,22 +316,15 @@ void Context::makeCurrent(egl::Display *display, egl::Surface *surface)
mHasBeenCurrent = true; mHasBeenCurrent = true;
} }
// Wrap the existing Direct3D 9 resources into GL objects and assign them to the '0' names // Wrap the existing swapchain resources into GL objects and assign them to the '0' names
// D3D9_REPLACE
renderer::SwapChain *swapchain = surface->getSwapChain(); renderer::SwapChain *swapchain = surface->getSwapChain();
IDirect3DSurface9 *depthStencil = swapchain->getDepthStencil();
Colorbuffer *colorbufferZero = new Colorbuffer(swapchain); Colorbuffer *colorbufferZero = new Colorbuffer(swapchain);
DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil); DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(swapchain);
Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero); Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero);
setFramebufferZero(framebufferZero); setFramebufferZero(framebufferZero);
if (depthStencil)
{
depthStencil->Release();
}
// Reset pixel shader to null to work around a bug that only happens with Intel GPUs. // Reset pixel shader to null to work around a bug that only happens with Intel GPUs.
// http://crbug.com/110343 // http://crbug.com/110343
mDevice->SetPixelShader(NULL); mDevice->SetPixelShader(NULL);
......
...@@ -452,14 +452,13 @@ IDirect3DSurface9 *Colorbuffer::getRenderTarget() ...@@ -452,14 +452,13 @@ IDirect3DSurface9 *Colorbuffer::getRenderTarget()
return mRenderTarget; 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; D3DSURFACE_DESC description;
depthStencil->GetDesc(&description); mDepthStencil->GetDesc(&description);
mWidth = description.Width; mWidth = description.Width;
mHeight = description.Height; mHeight = description.Height;
...@@ -527,16 +526,6 @@ IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil() ...@@ -527,16 +526,6 @@ IDirect3DSurface9 *DepthStencilbuffer::getDepthStencil()
return mDepthStencil; 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) Depthbuffer::Depthbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
{ {
if (mDepthStencil) if (mDepthStencil)
...@@ -551,16 +540,6 @@ Depthbuffer::~Depthbuffer() ...@@ -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) Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, samples)
{ {
if (mDepthStencil) if (mDepthStencil)
......
...@@ -217,7 +217,7 @@ class Colorbuffer : public RenderbufferStorage ...@@ -217,7 +217,7 @@ class Colorbuffer : public RenderbufferStorage
class DepthStencilbuffer : public RenderbufferStorage class DepthStencilbuffer : public RenderbufferStorage
{ {
public: public:
explicit DepthStencilbuffer(IDirect3DSurface9 *depthStencil); explicit DepthStencilbuffer(renderer::SwapChain *swapChain);
DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples); DepthStencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
~DepthStencilbuffer(); ~DepthStencilbuffer();
...@@ -234,7 +234,6 @@ class DepthStencilbuffer : public RenderbufferStorage ...@@ -234,7 +234,6 @@ class DepthStencilbuffer : public RenderbufferStorage
class Depthbuffer : public DepthStencilbuffer class Depthbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Depthbuffer(IDirect3DSurface9 *depthStencil);
Depthbuffer(GLsizei width, GLsizei height, GLsizei samples); Depthbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Depthbuffer(); virtual ~Depthbuffer();
...@@ -246,7 +245,6 @@ class Depthbuffer : public DepthStencilbuffer ...@@ -246,7 +245,6 @@ class Depthbuffer : public DepthStencilbuffer
class Stencilbuffer : public DepthStencilbuffer class Stencilbuffer : public DepthStencilbuffer
{ {
public: public:
explicit Stencilbuffer(IDirect3DSurface9 *depthStencil);
Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples); Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
virtual ~Stencilbuffer(); 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