Permalink
Browse files

Performance enhancements for fixed-function emulation.

Too much time was being spent in operator< for std::map::find.
  • Loading branch information...
1 parent 52a5e6f commit 3b66047465e82458a5be90467e7be3decd536133 @nigels-com nigels-com committed Oct 12, 2012
@@ -62,14 +62,18 @@ def apiErrorFuncDefineCode(apis, args):
code += ' RegalAssert(_next);\n'
if name != 'glGetError':
code += ' GLenum _error = GL_NO_ERROR;\n'
- code += ' if (!_context->depthBeginEnd)\n'
+ code += ' if (!_context->err.inBeginEnd)\n'
code += ' _error = _next->call(&_next->glGetError)();\n'
code += ' RegalAssert(_error==GL_NO_ERROR);\n'
code += ' '
+ if name == 'glBegin':
+ code += '_context->err.inBeginEnd = true;\n'
if not typeIsVoid(rType):
code += '%s ret = ' % rType
code += '_next->call(&_next->%s)(%s);\n' % ( name, callParams )
- code += ' if (!_context->depthBeginEnd) {\n'
+ if name == 'glEnd':
+ code += '_context->err.inBeginEnd = false;\n'
+ code += ' if (!_context->err.inBeginEnd) {\n'
code += ' _error = _next->call(&_next->glGetError)();\n'
code += ' if (_error!=GL_NO_ERROR) {\n'
code += ' Error("%s : ",Token::GLerrorToString(_error));\n'%(name)

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -47,16 +47,16 @@ struct DispatchErrorState
public:
DispatchErrorState()
: callback(NULL)
+ , inBeginEnd( false )
{
}
~DispatchErrorState()
{
}
- ::RegalErrorCallback Set( RegalContext *ctx, ::RegalErrorCallback cb );
-
::RegalErrorCallback callback;
+ bool inBeginEnd;
};
REGAL_NAMESPACE_END
Oops, something went wrong.

0 comments on commit 3b66047

Please sign in to comment.