Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5336: Move assertNoGlErrors() method to debugging/gl.h header. On fa…
…ilure, the global error handler is invoked instead of directly opening an wxutil::Messagebox.
- Loading branch information
1 parent
da70add
commit a88a9c9
Showing
21 changed files
with
72 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
|
||
#ifdef _DEBUG | ||
#include "igl.h" | ||
#include "string/convert.h" | ||
#endif | ||
|
||
namespace debug | ||
{ | ||
|
||
/// \brief Asserts that there no OpenGL errors have occurred since the last call to glGetError. | ||
inline void assertNoGlErrors() | ||
{ | ||
#ifdef _DEBUG | ||
// Return if no error | ||
GLenum error = glGetError(); | ||
|
||
if (error == GL_NO_ERROR) | ||
{ | ||
return; | ||
} | ||
|
||
// Build list of all GL errors | ||
std::string allErrString = "GL errors encountered: "; | ||
int maxErrors = 100; | ||
|
||
for (; error != GL_NO_ERROR; error = glGetError()) | ||
{ | ||
const char* strErr = reinterpret_cast<const char*>( | ||
gluErrorString(error) | ||
); | ||
allErrString += string::to_string(error); | ||
allErrString += " (" + std::string(strErr) + ") "; | ||
|
||
if (--maxErrors <= 0) | ||
{ | ||
allErrString += "---> Maximum number of GL errors reached, maybe there is a problem with the GL context?"; | ||
break; | ||
} | ||
} | ||
|
||
// Show the error message and terminate | ||
GlobalErrorHandler()("OpenGL Error", allErrString); | ||
#endif | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
#include "iglprogram.h" | ||
|
||
#include "debugging/render.h" | ||
#include "debugging/gl.h" | ||
|
||
namespace render | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
radiantcore/rendersystem/backend/glprogram/ARBDepthFillProgram.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#include "ARBDepthFillProgram.h" | ||
#include "../GLProgramFactory.h" | ||
#include "debugging/gl.h" | ||
|
||
namespace render | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
radiantcore/rendersystem/backend/glprogram/GLSLDepthFillProgram.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters