Merge pull request #317 from cforfang/master
Speedup for debugging: don't create std::string on every call to glCheckError
This commit is contained in:
commit
62c6dc3c59
@ -34,13 +34,14 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void glCheckError(const std::string& file, unsigned int line)
|
void glCheckError(const char* file, unsigned int line)
|
||||||
{
|
{
|
||||||
// Get the last error
|
// Get the last error
|
||||||
GLenum errorCode = glGetError();
|
GLenum errorCode = glGetError();
|
||||||
|
|
||||||
if (errorCode != GL_NO_ERROR)
|
if (errorCode != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
|
std::string fileString(file);
|
||||||
std::string error = "unknown error";
|
std::string error = "unknown error";
|
||||||
std::string description = "no description";
|
std::string description = "no description";
|
||||||
|
|
||||||
@ -99,7 +100,7 @@ void glCheckError(const std::string& file, unsigned int line)
|
|||||||
|
|
||||||
// Log the error
|
// Log the error
|
||||||
err() << "An internal OpenGL call failed in "
|
err() << "An internal OpenGL call failed in "
|
||||||
<< file.substr(file.find_last_of("\\/") + 1) << " (" << line << ") : "
|
<< fileString.substr(fileString.find_last_of("\\/") + 1) << " (" << line << ") : "
|
||||||
<< error << ", " << description
|
<< error << ", " << description
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace priv
|
|||||||
/// \param line Line number of the source file where the call is located
|
/// \param line Line number of the source file where the call is located
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void glCheckError(const std::string& file, unsigned int line);
|
void glCheckError(const char* file, unsigned int line);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Make sure that GLEW is initialized
|
/// \brief Make sure that GLEW is initialized
|
||||||
|
Loading…
Reference in New Issue
Block a user