diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-05-14 16:35:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-05-14 16:35:57 +0300 |
commit | 750d3348b363716cf82136c337dac5da06bf5390 (patch) | |
tree | 29aed9c17d6121f77f9a48a0c570954d79a5aa81 | |
parent | 595cd8cf3c1013f2ae20b118655f667a6c24c452 (diff) | |
download | plus-750d3348b363716cf82136c337dac5da06bf5390.tar.gz plus-750d3348b363716cf82136c337dac5da06bf5390.tar.bz2 plus-750d3348b363716cf82136c337dac5da06bf5390.tar.xz plus-750d3348b363716cf82136c337dac5da06bf5390.zip |
add into texture bind dubugging also bind count.
-rw-r--r-- | src/graphics.h | 4 | ||||
-rw-r--r-- | src/gui/debugwindow.cpp | 20 | ||||
-rw-r--r-- | src/gui/debugwindow.h | 3 | ||||
-rw-r--r-- | src/normalopenglgraphics.cpp | 11 | ||||
-rw-r--r-- | src/normalopenglgraphics.h | 9 |
5 files changed, 44 insertions, 3 deletions
diff --git a/src/graphics.h b/src/graphics.h index 705a98ff6..03dd5ea2e 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -357,6 +357,10 @@ class Graphics : public gcn::SDLGraphics virtual unsigned int getDrawCalls() const { return 0; } #endif +#ifdef DEBUG_BIND_TEXTURE + virtual unsigned int getBinds() const + { return 0; } +#endif int mWidth; int mHeight; diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 64ae18c36..4fe4fbe1b 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -174,6 +174,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : // TRANSLATORS: debug window label _("Draw calls:"), "?"))), #endif +#ifdef DEBUG_BIND_TEXTURE + mBindsLabel(new Label(this, strprintf("%s %s", + // TRANSLATORS: debug window label + _("Texture binds:"), "?"))), +#endif // TRANSLATORS: debug window label, frames per second mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), // TRANSLATORS: debug window label, logic per second @@ -219,7 +224,8 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : place(0, 7, mParticleCountLabel, 2); place(0, 8, mMapActorCountLabel, 2); #ifdef USE_OPENGL -#if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) +#if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \ + || defined(DEBUG_BIND_TEXTURE) int n = 9; #endif #ifdef DEBUG_OPENGL_LEAKS @@ -231,6 +237,10 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #endif #ifdef DEBUG_DRAW_CALLS place(0, n, mDrawCallsLabel, 2); + n ++; +#endif +#ifdef DEBUG_BIND_TEXTURE + place(0, n, mBindsLabel, 2); #endif #endif place.getCell().matchColWidth(0, 0); @@ -300,6 +310,14 @@ void MapDebugTab::logic() _("Draw calls:"), mainGraphics->getDrawCalls())); } #endif +#ifdef DEBUG_BIND_TEXTURE + if (mainGraphics) + { + mBindsLabel->setCaption(strprintf("%s %d", + // TRANSLATORS: debug window label + _("Texture binds:"), mainGraphics->getBinds())); + } +#endif #endif } } diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 7fd94f990..26bedf9ce 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -75,6 +75,9 @@ class MapDebugTab final : public DebugTab #ifdef DEBUG_DRAW_CALLS Label *mDrawCallsLabel; #endif +#ifdef DEBUG_BIND_TEXTURE + Label *mBindsLabel; +#endif Label *mFPSLabel; Label *mLPSLabel; std::string mFPSText; diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp index 90ba0a188..af13d0a4f 100644 --- a/src/normalopenglgraphics.cpp +++ b/src/normalopenglgraphics.cpp @@ -44,6 +44,10 @@ GLuint NormalOpenGLGraphics::mLastImage = 0; unsigned int NormalOpenGLGraphics::mDrawCalls = 0; unsigned int NormalOpenGLGraphics::mLastDrawCalls = 0; #endif +#ifdef DEBUG_BIND_TEXTURE +unsigned int NormalOpenGLGraphics::mBinds = 0; +unsigned int NormalOpenGLGraphics::mLastBinds = 0; +#endif NormalOpenGLGraphics::NormalOpenGLGraphics(): mFloatTexArray(nullptr), @@ -1028,6 +1032,10 @@ void NormalOpenGLGraphics::updateScreen() mLastDrawCalls = mDrawCalls; mDrawCalls = 0; #endif +#ifdef DEBUG_BIND_TEXTURE + mLastBinds = mBinds; + mBinds = 0; +#endif SDL_GL_SwapBuffers(); // may be need clear? // glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -1361,6 +1369,9 @@ void NormalOpenGLGraphics::bindTexture(const GLenum target, { mLastImage = texture; glBindTexture(target, texture); +#ifdef DEBUG_BIND_TEXTURE + mBinds ++; +#endif } } diff --git a/src/normalopenglgraphics.h b/src/normalopenglgraphics.h index 86a380ac8..40a01cd9e 100644 --- a/src/normalopenglgraphics.h +++ b/src/normalopenglgraphics.h @@ -195,7 +195,10 @@ class NormalOpenGLGraphics final : public Graphics static unsigned int mLastDrawCalls; #endif - +#ifdef DEBUG_BIND_TEXTURE + virtual unsigned int getBinds() const + { return mLastBinds; } +#endif static void bindTexture(const GLenum target, const GLuint texture); static GLuint mLastImage; @@ -231,7 +234,9 @@ class NormalOpenGLGraphics final : public Graphics bool mColorAlpha; #ifdef DEBUG_BIND_TEXTURE std::string mOldTexture; - unsigned mOldTextureId; + unsigned int mOldTextureId; + static unsigned int mBinds; + static unsigned int mLastBinds; #endif FBOInfo mFbo; }; |