Minor improvement to gl_debug_log.h

This commit is contained in:
Henrik Rydgård committed 2020-09-17 20:53:02 +02:00
1 parent 277f0e4ec6
commit 7c76f4e65c
3 files changed
+9 -3

No files matched your search

+3 -1
View File
@@ -34,9 +34,11 @@ std::string GLEnumToString(uint16_t value) {
}
}
void CheckGLError(const char *file, int line) {
bool CheckGLError(const char *file, int line) {
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
ERROR_LOG(G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line);
return false;
}
return true;
}
+2 -2
View File
@@ -10,8 +10,8 @@
#if defined(DEBUG_OPENGL)
void CheckGLError(const char *file, int line);
#define CHECK_GL_ERROR_IF_DEBUG() CheckGLError(__FILE__, __LINE__)
bool CheckGLError(const char *file, int line);
#define CHECK_GL_ERROR_IF_DEBUG() if (!CheckGLError(__FILE__, __LINE__)) __debugbreak();
#else
+4
View File
@@ -1146,6 +1146,7 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
if (!tex) {
break;
}
CHECK_GL_ERROR_IF_DEBUG();
if (tex->canWrap) {
if (tex->wrapS != c.textureSampler.wrapS) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, c.textureSampler.wrapS);
@@ -1156,14 +1157,17 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
tex->wrapT = c.textureSampler.wrapT;
}
}
CHECK_GL_ERROR_IF_DEBUG();
if (tex->magFilter != c.textureSampler.magFilter) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, c.textureSampler.magFilter);
tex->magFilter = c.textureSampler.magFilter;
}
CHECK_GL_ERROR_IF_DEBUG();
if (tex->minFilter != c.textureSampler.minFilter) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, c.textureSampler.minFilter);
tex->minFilter = c.textureSampler.minFilter;
}
CHECK_GL_ERROR_IF_DEBUG();
if (tex->anisotropy != c.textureSampler.anisotropy) {
if (c.textureSampler.anisotropy != 0.0f) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, c.textureSampler.anisotropy);