From 7e3170fa2b3f602428404e2f82fdb8c6640ea787 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 Jun 2012 00:05:03 +0300 Subject: Extend bind texture debug logging. --- src/openglgraphics.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'src/openglgraphics.cpp') diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index ab65fd7ee..80a28dcd2 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -215,7 +215,7 @@ bool OpenGLGraphics::drawImage(const Image *image, int srcX, int srcY, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -275,7 +275,7 @@ bool OpenGLGraphics::drawRescaledImage(Image *image, int srcX, int srcY, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -331,7 +331,7 @@ void OpenGLGraphics::drawImagePattern(const Image *image, int x, int y, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -468,7 +468,7 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); @@ -611,7 +611,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -928,7 +928,7 @@ void OpenGLGraphics::drawTile(ImageVertexes *vert) glColor4f(1.0f, 1.0f, 1.0f, image->mAlpha); #ifdef DEBUG_BIND_TEXTURE - logger->log("bind: " + image->getIdPath()); + debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); setTexturingAndBlending(true); @@ -1394,4 +1394,24 @@ void OpenGLGraphics::dumpSettings() } } +#ifdef DEBUG_BIND_TEXTURE +void OpenGLGraphics::debugBindTexture(const Image *image) +{ + const std::string texture = image->getIdPath(); + if (mOldTexture != texture) + { + if (!mOldTexture.empty() && !texture.empty()) + { + logger->log("bind: %s to %s", mOldTexture.c_str(), + texture.c_str()); + } + mOldTexture = texture; + } +} +#else +void OpenGLGraphics::debugBindTexture(Image *image A_UNUSED) +{ +} +#endif + #endif // USE_OPENGL -- cgit v1.2.3-60-g2f50