diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-30 00:05:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-30 00:05:03 +0300 |
commit | 7e3170fa2b3f602428404e2f82fdb8c6640ea787 (patch) | |
tree | ec3cab5f60f1e746241dc37f66481be0b416d69c /src | |
parent | 8448f1c4c07f49caa83a755e732918320e0e161f (diff) | |
download | manaplus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.gz manaplus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.bz2 manaplus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.tar.xz manaplus-7e3170fa2b3f602428404e2f82fdb8c6640ea787.zip |
Extend bind texture debug logging.
Diffstat (limited to 'src')
-rw-r--r-- | src/openglgraphics.cpp | 32 | ||||
-rw-r--r-- | src/openglgraphics.h | 6 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 1 |
3 files changed, 33 insertions, 6 deletions
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 diff --git a/src/openglgraphics.h b/src/openglgraphics.h index e088fa4e2..eeb875a01 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.h @@ -25,6 +25,7 @@ #ifdef USE_OPENGL +#include "localconsts.h" #include "main.h" #include "graphics.h" @@ -152,6 +153,8 @@ class OpenGLGraphics : public Graphics void updateMemoryInfo(); + void debugBindTexture(const Image *image); + private: GLfloat *mFloatTexArray; GLint *mIntTexArray; @@ -161,6 +164,9 @@ class OpenGLGraphics : public Graphics GLuint mFboId; GLuint mTextureId; GLuint mRboId; +#ifdef DEBUG_BIND_TEXTURE + std::string mOldTexture; +#endif }; #endif diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index 7606b9ec8..63c103e1f 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -275,4 +275,5 @@ int OpenGLImageHelper::useOpenGL() { return mUseOpenGL; } + #endif |