mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Don't create std::string on glCheckError unless necessary.
This commit is contained in:
parent
044eb85872
commit
f9b3e513d2
@ -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