Implemented support for GL_STENCIL_INDEX8 renderbuffers

TRAC #11366 Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/trunk@5 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 680553bf
...@@ -218,7 +218,7 @@ IDirect3DSurface9 *Depthbuffer::getDepthStencil() ...@@ -218,7 +218,7 @@ IDirect3DSurface9 *Depthbuffer::getDepthStencil()
} }
Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil) Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil)
{ {
if (depthStencil) if (depthStencil)
{ {
depthStencil->AddRef(); depthStencil->AddRef();
...@@ -229,7 +229,35 @@ Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(de ...@@ -229,7 +229,35 @@ Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(de
mWidth = description.Width; mWidth = description.Width;
mHeight = description.Height; mHeight = description.Height;
} }
} }
Stencilbuffer::Stencilbuffer(int width, int height)
{
IDirect3DDevice9 *device = getDevice();
mDepthStencil = NULL;
HRESULT result = device->CreateDepthStencilSurface(width, height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &mDepthStencil, 0);
if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY)
{
error(GL_OUT_OF_MEMORY);
return;
}
ASSERT(SUCCEEDED(result));
if (mDepthStencil)
{
mWidth = width;
mHeight = height;
}
else
{
mWidth = 0;
mHeight = 0;
}
}
Stencilbuffer::~Stencilbuffer() Stencilbuffer::~Stencilbuffer()
{ {
......
...@@ -90,6 +90,7 @@ class Stencilbuffer : public Renderbuffer ...@@ -90,6 +90,7 @@ class Stencilbuffer : public Renderbuffer
{ {
public: public:
Stencilbuffer(IDirect3DSurface9 *depthStencil); Stencilbuffer(IDirect3DSurface9 *depthStencil);
Stencilbuffer(int width, int height);
~Stencilbuffer(); ~Stencilbuffer();
......
...@@ -2580,11 +2580,10 @@ void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsiz ...@@ -2580,11 +2580,10 @@ void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsiz
case GL_RGB5_A1: case GL_RGB5_A1:
case GL_RGB565: case GL_RGB565:
UNIMPLEMENTED(); // FIXME UNIMPLEMENTED(); // FIXME
// context->setRenderbuffer(new Colorbuffer(renderTarget)); // context->setRenderbuffer(new Colorbuffer(renderTarget));
break; break;
case GL_STENCIL_INDEX8: case GL_STENCIL_INDEX8:
UNIMPLEMENTED(); // FIXME context->setRenderbuffer(new gl::Stencilbuffer(width, height));
// context->setRenderbuffer(new Stencilbuffer(depthStencil));
break; break;
default: default:
return error(GL_INVALID_ENUM); return error(GL_INVALID_ENUM);
......
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