Loading libs/rs/rsContext.cpp +44 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,44 @@ static bool getProp(const char *str) return 0 != strcmp(buf, "0"); } void Context::displayDebugStats() { char buffer[128]; sprintf(buffer, "Frame %i ms, Script %i ms", mTimeMSLastFrame, mTimeMSLastScript); float oldR = mStateVertex.color[0]; float oldG = mStateVertex.color[1]; float oldB = mStateVertex.color[2]; float oldA = mStateVertex.color[3]; float shadowCol = 0.2f; mStateVertex.color[0] = shadowCol; mStateVertex.color[1] = shadowCol; mStateVertex.color[2] = shadowCol; mStateVertex.color[3] = 1.0f; if (!checkVersion2_0()) { glColor4f(shadowCol, shadowCol, shadowCol, 1.0f); } mStateFont.renderText(buffer, 5, getHeight() - 5); float textCol = 0.9f; mStateVertex.color[0] = textCol; mStateVertex.color[1] = textCol; mStateVertex.color[2] = textCol; mStateVertex.color[3] = 1.0f; if (!checkVersion2_0()) { glColor4f(textCol, textCol, textCol, 1.0f); } mStateFont.renderText(buffer, 4, getHeight() - 6); mStateVertex.color[0] = oldR; mStateVertex.color[1] = oldG; mStateVertex.color[2] = oldB; mStateVertex.color[3] = oldA; if (!checkVersion2_0()) { glColor4f(oldR, oldG, oldB, oldA); } } void * Context::threadProc(void *vrsc) { Context *rsc = static_cast<Context *>(vrsc); Loading @@ -271,6 +309,7 @@ void * Context::threadProc(void *vrsc) rsc->props.mLogScripts = getProp("debug.rs.script"); rsc->props.mLogObjects = getProp("debug.rs.object"); rsc->props.mLogShaders = getProp("debug.rs.shader"); rsc->props.mLogVisual = getProp("debug.rs.visual"); ScriptTLSStruct *tlsStruct = new ScriptTLSStruct; if (!tlsStruct) { Loading Loading @@ -308,6 +347,11 @@ void * Context::threadProc(void *vrsc) uint32_t targetTime = 0; if (mDraw && rsc->mIsGraphicsContext) { targetTime = rsc->runRootScript(); if(rsc->props.mLogVisual) { rsc->displayDebugStats(); } mDraw = targetTime && !rsc->mPaused; rsc->timerSet(RS_TIMER_CLEAR_SWAP); eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface); Loading libs/rs/rsContext.h +3 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ public: bool mLogScripts; bool mLogObjects; bool mLogShaders; bool mLogVisual; } props; void dumpDebug() const; Loading Loading @@ -257,6 +258,8 @@ protected: void objDestroyOOBRun(); void objDestroyOOBDestroy(); void displayDebugStats(); private: Context(); Loading Loading
libs/rs/rsContext.cpp +44 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,44 @@ static bool getProp(const char *str) return 0 != strcmp(buf, "0"); } void Context::displayDebugStats() { char buffer[128]; sprintf(buffer, "Frame %i ms, Script %i ms", mTimeMSLastFrame, mTimeMSLastScript); float oldR = mStateVertex.color[0]; float oldG = mStateVertex.color[1]; float oldB = mStateVertex.color[2]; float oldA = mStateVertex.color[3]; float shadowCol = 0.2f; mStateVertex.color[0] = shadowCol; mStateVertex.color[1] = shadowCol; mStateVertex.color[2] = shadowCol; mStateVertex.color[3] = 1.0f; if (!checkVersion2_0()) { glColor4f(shadowCol, shadowCol, shadowCol, 1.0f); } mStateFont.renderText(buffer, 5, getHeight() - 5); float textCol = 0.9f; mStateVertex.color[0] = textCol; mStateVertex.color[1] = textCol; mStateVertex.color[2] = textCol; mStateVertex.color[3] = 1.0f; if (!checkVersion2_0()) { glColor4f(textCol, textCol, textCol, 1.0f); } mStateFont.renderText(buffer, 4, getHeight() - 6); mStateVertex.color[0] = oldR; mStateVertex.color[1] = oldG; mStateVertex.color[2] = oldB; mStateVertex.color[3] = oldA; if (!checkVersion2_0()) { glColor4f(oldR, oldG, oldB, oldA); } } void * Context::threadProc(void *vrsc) { Context *rsc = static_cast<Context *>(vrsc); Loading @@ -271,6 +309,7 @@ void * Context::threadProc(void *vrsc) rsc->props.mLogScripts = getProp("debug.rs.script"); rsc->props.mLogObjects = getProp("debug.rs.object"); rsc->props.mLogShaders = getProp("debug.rs.shader"); rsc->props.mLogVisual = getProp("debug.rs.visual"); ScriptTLSStruct *tlsStruct = new ScriptTLSStruct; if (!tlsStruct) { Loading Loading @@ -308,6 +347,11 @@ void * Context::threadProc(void *vrsc) uint32_t targetTime = 0; if (mDraw && rsc->mIsGraphicsContext) { targetTime = rsc->runRootScript(); if(rsc->props.mLogVisual) { rsc->displayDebugStats(); } mDraw = targetTime && !rsc->mPaused; rsc->timerSet(RS_TIMER_CLEAR_SWAP); eglSwapBuffers(rsc->mEGL.mDisplay, rsc->mEGL.mSurface); Loading
libs/rs/rsContext.h +3 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,7 @@ public: bool mLogScripts; bool mLogObjects; bool mLogShaders; bool mLogVisual; } props; void dumpDebug() const; Loading Loading @@ -257,6 +258,8 @@ protected: void objDestroyOOBRun(); void objDestroyOOBDestroy(); void displayDebugStats(); private: Context(); Loading