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
diff --git a/libGLESv2/Renderbuffer.cpp b/libGLESv2/Renderbuffer.cpp
index b44cab1..3eb470b 100644
--- a/libGLESv2/Renderbuffer.cpp
+++ b/libGLESv2/Renderbuffer.cpp
@@ -218,7 +218,7 @@
}
Stencilbuffer::Stencilbuffer(IDirect3DSurface9 *depthStencil) : mDepthStencil(depthStencil)
- {
+{
if (depthStencil)
{
depthStencil->AddRef();
@@ -229,7 +229,35 @@
mWidth = description.Width;
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()
{