Disable the stencil test when no stencil buffer

TRAC #12181 Signed-off-by: Shannon Woods Signed-off-by: Daniel Koch Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@246 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent a54da4e5
...@@ -1642,7 +1642,7 @@ void Context::applyState(GLenum drawMode) ...@@ -1642,7 +1642,7 @@ void Context::applyState(GLenum drawMode)
device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
} }
if (mState.stencilTest) if (mState.stencilTest && hasStencil())
{ {
device->SetRenderState(D3DRS_STENCILENABLE, TRUE); device->SetRenderState(D3DRS_STENCILENABLE, TRUE);
device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE); device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, TRUE);
...@@ -2566,6 +2566,23 @@ bool Context::isTriangleMode(GLenum drawMode) ...@@ -2566,6 +2566,23 @@ bool Context::isTriangleMode(GLenum drawMode)
return false; return false;
} }
bool Context::hasStencil()
{
Framebuffer *framebufferObject = getFramebuffer();
if (framebufferObject)
{
Stencilbuffer *stencilbufferObject = framebufferObject->getStencilbuffer();
if (stencilbufferObject)
{
return stencilbufferObject->getStencilSize() > 0;
}
}
return false;
}
void Context::setVertexAttrib(GLuint index, const GLfloat *values) void Context::setVertexAttrib(GLuint index, const GLfloat *values)
{ {
ASSERT(index < gl::MAX_VERTEX_ATTRIBS); ASSERT(index < gl::MAX_VERTEX_ATTRIBS);
......
...@@ -391,6 +391,7 @@ class Context ...@@ -391,6 +391,7 @@ class Context
bool cullSkipsDraw(GLenum drawMode); bool cullSkipsDraw(GLenum drawMode);
bool isTriangleMode(GLenum drawMode); bool isTriangleMode(GLenum drawMode);
bool hasStencil();
const egl::Config *const mConfig; const egl::Config *const mConfig;
......
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