Added support for controlling the frequency of checking for OpenGL errors
via:
enum CheckForGLErrors
{
/** NEVER_CHECK_GL_ERRORS hints that OpenGL need not be checked for, this
is the fastest option since checking for errors does incurr a small overhead.*/
NEVER_CHECK_GL_ERRORS,
/** ONCE_PER_FRAME means that OpenGl errors will be checked for once per
frame, the overhead is still small, but at least OpenGL errors that are occurring
will be caught, the reporting isn't fine grained enough for debugging purposes.*/
ONCE_PER_FRAME,
/** ONCE_PER_ATTRIBUTE means that OpenGL errors will be checked for after
every attribute is applied, allow errors to be directly associated with
particular operations which makes debugging much easier.*/
ONCE_PER_ATTRIBUTE
};
/** Set whether and how often OpenGL errors should be checked for.*/
void setCheckForGLErrors(CheckForGLErrors check) { _checkGLErrors = check; }
/** Get whether and how often OpenGL errors should be checked for.*/
CheckForGLErrors getCheckForGLErrors() const { return _checkGLErrors; }
This commit is contained in:
@@ -28,7 +28,7 @@ State::State()
|
||||
_modelView = _identity;
|
||||
|
||||
_abortRenderingPtr = false;
|
||||
_reportGLErrors = false;
|
||||
_checkGLErrors = ONCE_PER_FRAME;
|
||||
|
||||
_currentActiveTextureUnit=0;
|
||||
_currentClientActiveTextureUnit=0;
|
||||
@@ -247,7 +247,7 @@ void State::captureCurrentState(StateSet& stateset) const
|
||||
|
||||
void State::apply(const StateSet* dstate)
|
||||
{
|
||||
if (_reportGLErrors) checkGLErrors("start of State::apply(StateSet*)");
|
||||
if (_checkGLErrors==ONCE_PER_ATTRIBUTE) checkGLErrors("start of State::apply(StateSet*)");
|
||||
|
||||
// equivilant to:
|
||||
//pushStateSet(dstate);
|
||||
@@ -312,13 +312,13 @@ void State::apply(const StateSet* dstate)
|
||||
apply();
|
||||
}
|
||||
|
||||
if (_reportGLErrors) checkGLErrors("end of State::apply(StateSet*)");
|
||||
if (_checkGLErrors==ONCE_PER_ATTRIBUTE) checkGLErrors("end of State::apply(StateSet*)");
|
||||
}
|
||||
|
||||
void State::apply()
|
||||
{
|
||||
|
||||
if (_reportGLErrors) checkGLErrors("start of State::apply()");
|
||||
if (_checkGLErrors==ONCE_PER_ATTRIBUTE) checkGLErrors("start of State::apply()");
|
||||
|
||||
// go through all active OpenGL modes, enabling/disable where
|
||||
// appropriate.
|
||||
@@ -355,7 +355,7 @@ void State::apply()
|
||||
}
|
||||
}
|
||||
|
||||
if (_reportGLErrors) checkGLErrors("end of State::apply()");
|
||||
if (_checkGLErrors==ONCE_PER_ATTRIBUTE) checkGLErrors("end of State::apply()");
|
||||
}
|
||||
|
||||
void State::haveAppliedMode(StateAttribute::GLMode mode,StateAttribute::GLModeValue value)
|
||||
|
||||
Reference in New Issue
Block a user