Commit d15c3ea9 by Nicolas Capens

Support matrix stack overflow/underflow errors.

Change-Id: Ie3caee1128c8227397a74378fcefdf9e128fc6bf Reviewed-on: https://swiftshader-review.googlesource.com/3761Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 0080f712
...@@ -162,6 +162,8 @@ Context::Context(const egl::Config *config, const Context *shareContext) ...@@ -162,6 +162,8 @@ Context::Context(const egl::Config *config, const Context *shareContext)
mInvalidOperation = false; mInvalidOperation = false;
mOutOfMemory = false; mOutOfMemory = false;
mInvalidFramebufferOperation = false; mInvalidFramebufferOperation = false;
mMatrixStackOverflow = false;
mMatrixStackUnderflow = false;
lighting = false; lighting = false;
...@@ -2649,6 +2651,16 @@ void Context::recordInvalidFramebufferOperation() ...@@ -2649,6 +2651,16 @@ void Context::recordInvalidFramebufferOperation()
mInvalidFramebufferOperation = true; mInvalidFramebufferOperation = true;
} }
void Context::recordMatrixStackOverflow()
{
mMatrixStackOverflow = true;
}
void Context::recordMatrixStackUnderflow()
{
mMatrixStackUnderflow = true;
}
// Get one of the recorded errors and clear its flag, if any. // Get one of the recorded errors and clear its flag, if any.
// [OpenGL ES 2.0.24] section 2.5 page 13. // [OpenGL ES 2.0.24] section 2.5 page 13.
GLenum Context::getError() GLenum Context::getError()
...@@ -2688,6 +2700,20 @@ GLenum Context::getError() ...@@ -2688,6 +2700,20 @@ GLenum Context::getError()
return GL_INVALID_FRAMEBUFFER_OPERATION_OES; return GL_INVALID_FRAMEBUFFER_OPERATION_OES;
} }
if(mMatrixStackOverflow)
{
mMatrixStackOverflow = false;
return GL_INVALID_FRAMEBUFFER_OPERATION_OES;
}
if(mMatrixStackUnderflow)
{
mMatrixStackUnderflow = false;
return GL_INVALID_FRAMEBUFFER_OPERATION_OES;
}
return GL_NO_ERROR; return GL_NO_ERROR;
} }
......
...@@ -461,6 +461,8 @@ public: ...@@ -461,6 +461,8 @@ public:
void recordInvalidOperation(); void recordInvalidOperation();
void recordOutOfMemory(); void recordOutOfMemory();
void recordInvalidFramebufferOperation(); void recordInvalidFramebufferOperation();
void recordMatrixStackOverflow();
void recordMatrixStackUnderflow();
GLenum getError(); GLenum getError();
...@@ -533,6 +535,8 @@ private: ...@@ -533,6 +535,8 @@ private:
bool mInvalidOperation; bool mInvalidOperation;
bool mOutOfMemory; bool mOutOfMemory;
bool mInvalidFramebufferOperation; bool mInvalidFramebufferOperation;
bool mMatrixStackOverflow;
bool mMatrixStackUnderflow;
bool mHasBeenCurrent; bool mHasBeenCurrent;
......
...@@ -135,6 +135,14 @@ void error(GLenum errorCode) ...@@ -135,6 +135,14 @@ void error(GLenum errorCode)
context->recordInvalidFramebufferOperation(); context->recordInvalidFramebufferOperation();
TRACE("\t! Error generated: invalid framebuffer operation\n"); TRACE("\t! Error generated: invalid framebuffer operation\n");
break; break;
case GL_STACK_OVERFLOW:
context->recordMatrixStackOverflow();
TRACE("\t! Error generated: matrix stack overflow\n");
break;
case GL_STACK_UNDERFLOW:
context->recordMatrixStackUnderflow();
TRACE("\t! Error generated: matrix stack underflow\n");
break;
default: UNREACHABLE(errorCode); default: UNREACHABLE(errorCode);
} }
} }
......
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