summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-12-15 19:10:11 -0800
committerJason Sams <rjsams@android.com>2009-12-15 19:10:11 -0800
commit5dad8b4d1fda37b7b4763ef7361c5eb92131cb7e (patch)
tree1cd2619209c2c459ceba2bb5243594e3fabc1bea /libs/rs
parentd6542507e73e1d7f3380cb4657a0745772818002 (diff)
downloadframeworks_base-5dad8b4d1fda37b7b4763ef7361c5eb92131cb7e.zip
frameworks_base-5dad8b4d1fda37b7b4763ef7361c5eb92131cb7e.tar.gz
frameworks_base-5dad8b4d1fda37b7b4763ef7361c5eb92131cb7e.tar.bz2
Place shader logging behind prop to declutter logs.
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rsContext.cpp3
-rw-r--r--libs/rs/rsContext.h1
-rw-r--r--libs/rs/rsProgram.cpp13
-rw-r--r--libs/rs/rsProgram.h2
-rw-r--r--libs/rs/rsProgramFragment.cpp4
-rw-r--r--libs/rs/rsProgramFragment.h2
-rw-r--r--libs/rs/rsProgramVertex.cpp4
-rw-r--r--libs/rs/rsProgramVertex.h2
-rw-r--r--libs/rs/rsShaderCache.cpp18
-rw-r--r--libs/rs/rsShaderCache.h2
10 files changed, 32 insertions, 19 deletions
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 96c289e..8f56efa 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -239,7 +239,7 @@ void Context::timerPrint()
void Context::setupCheck()
{
if (checkVersion2_0()) {
- mShaderCache.lookup(mVertex.get(), mFragment.get());
+ mShaderCache.lookup(this, mVertex.get(), mFragment.get());
mFragmentStore->setupGL2(this, &mStateFragmentStore);
mFragment->setupGL2(this, &mStateFragment, &mShaderCache);
@@ -272,6 +272,7 @@ void * Context::threadProc(void *vrsc)
rsc->props.mLogTimes = getProp("debug.rs.profile");
rsc->props.mLogScripts = getProp("debug.rs.script");
rsc->props.mLogObjects = getProp("debug.rs.objects");
+ rsc->props.mLogShaders = getProp("debug.rs.shaders");
ScriptTLSStruct *tlsStruct = new ScriptTLSStruct;
if (!tlsStruct) {
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 790aca6..dd0423e 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -164,6 +164,7 @@ public:
bool mLogTimes;
bool mLogScripts;
bool mLogObjects;
+ bool mLogShaders;
} props;
void dumpDebug() const;
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index bcda5fb..e6d1e36 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -125,13 +125,15 @@ void Program::createShader()
{
}
-bool Program::loadShader(uint32_t type)
+bool Program::loadShader(Context *rsc, uint32_t type)
{
mShaderID = glCreateShader(type);
rsAssert(mShaderID);
- LOGV("Loading shader type %x, ID %i", type, mShaderID);
- LOGE(mShader.string());
+ if (rsc->props.mLogShaders) {
+ LOGV("Loading shader type %x, ID %i", type, mShaderID);
+ LOGV(mShader.string());
+ }
if (mShaderID) {
const char * ss = mShader.string();
@@ -156,7 +158,10 @@ bool Program::loadShader(uint32_t type)
}
}
}
- LOGV("--Shader load result %x ", glGetError());
+
+ if (rsc->props.mLogShaders) {
+ LOGV("--Shader load result %x ", glGetError());
+ }
return true;
}
diff --git a/libs/rs/rsProgram.h b/libs/rs/rsProgram.h
index e9837b7..003498e 100644
--- a/libs/rs/rsProgram.h
+++ b/libs/rs/rsProgram.h
@@ -72,7 +72,7 @@ protected:
String8 mAttribNames[MAX_ATTRIBS];
String8 mUniformNames[MAX_UNIFORMS];
- bool loadShader(uint32_t type);
+ bool loadShader(Context *, uint32_t type);
public:
void forceDirty() const {mDirty = true;}
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 2d18c42..c353301 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -161,8 +161,8 @@ void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state,
//LOGE("sgl2 frag2 %x", glGetError());
}
-void ProgramFragment::loadShader() {
- Program::loadShader(GL_FRAGMENT_SHADER);
+void ProgramFragment::loadShader(Context *rsc) {
+ Program::loadShader(rsc, GL_FRAGMENT_SHADER);
}
void ProgramFragment::createShader()
diff --git a/libs/rs/rsProgramFragment.h b/libs/rs/rsProgramFragment.h
index 1f548ad..14b4ec3 100644
--- a/libs/rs/rsProgramFragment.h
+++ b/libs/rs/rsProgramFragment.h
@@ -50,7 +50,7 @@ public:
void setTexEnable(uint32_t slot, bool);
virtual void createShader();
- virtual void loadShader();
+ virtual void loadShader(Context *rsc);
virtual void init(Context *rsc);
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 9a2edfc..058cd73 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -108,8 +108,8 @@ void ProgramVertex::setupGL(const Context *rsc, ProgramVertexState *state)
mDirty = false;
}
-void ProgramVertex::loadShader() {
- Program::loadShader(GL_VERTEX_SHADER);
+void ProgramVertex::loadShader(Context *rsc) {
+ Program::loadShader(rsc, GL_VERTEX_SHADER);
}
void ProgramVertex::createShader()
diff --git a/libs/rs/rsProgramVertex.h b/libs/rs/rsProgramVertex.h
index b3115a3..4748acc 100644
--- a/libs/rs/rsProgramVertex.h
+++ b/libs/rs/rsProgramVertex.h
@@ -49,7 +49,7 @@ public:
void transformToScreen(const Context *, float *v4out, const float *v3in) const;
virtual void createShader();
- virtual void loadShader();
+ virtual void loadShader(Context *);
virtual void init(Context *);
diff --git a/libs/rs/rsShaderCache.cpp b/libs/rs/rsShaderCache.cpp
index 4b16677..8e2af34 100644
--- a/libs/rs/rsShaderCache.cpp
+++ b/libs/rs/rsShaderCache.cpp
@@ -41,13 +41,13 @@ ShaderCache::~ShaderCache()
free(mEntries);
}
-bool ShaderCache::lookup(ProgramVertex *vtx, ProgramFragment *frag)
+bool ShaderCache::lookup(Context *rsc, ProgramVertex *vtx, ProgramFragment *frag)
{
if (!vtx->getShaderID()) {
- vtx->loadShader();
+ vtx->loadShader(rsc);
}
if (!frag->getShaderID()) {
- frag->loadShader();
+ frag->loadShader(rsc);
}
//LOGV("ShaderCache lookup vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
@@ -115,15 +115,21 @@ bool ShaderCache::lookup(ProgramVertex *vtx, ProgramFragment *frag)
}
for (uint32_t ct=0; ct < vtx->getAttribCount(); ct++) {
e->mVtxAttribSlots[ct] = glGetAttribLocation(pgm, vtx->getAttribName(ct));
- LOGV("vtx A, %s = %d\n", vtx->getAttribName(ct).string(), e->mVtxAttribSlots[ct]);
+ if (rsc->props.mLogShaders) {
+ LOGV("vtx A, %s = %d\n", vtx->getAttribName(ct).string(), e->mVtxAttribSlots[ct]);
+ }
}
for (uint32_t ct=0; ct < vtx->getUniformCount(); ct++) {
e->mVtxUniformSlots[ct] = glGetUniformLocation(pgm, vtx->getUniformName(ct));
- LOGV("vtx U, %s = %d\n", vtx->getUniformName(ct).string(), e->mVtxUniformSlots[ct]);
+ if (rsc->props.mLogShaders) {
+ LOGV("vtx U, %s = %d\n", vtx->getUniformName(ct).string(), e->mVtxUniformSlots[ct]);
+ }
}
for (uint32_t ct=0; ct < vtx->getUniformCount(); ct++) {
e->mFragUniformSlots[ct] = glGetUniformLocation(pgm, frag->getUniformName(ct));
- LOGV("frag U, %s = %d\n", frag->getUniformName(ct).string(), e->mFragUniformSlots[ct]);
+ if (rsc->props.mLogShaders) {
+ LOGV("frag U, %s = %d\n", frag->getUniformName(ct).string(), e->mFragUniformSlots[ct]);
+ }
}
}
diff --git a/libs/rs/rsShaderCache.h b/libs/rs/rsShaderCache.h
index 4d9f8ec..ede3734 100644
--- a/libs/rs/rsShaderCache.h
+++ b/libs/rs/rsShaderCache.h
@@ -33,7 +33,7 @@ public:
ShaderCache();
virtual ~ShaderCache();
- bool lookup(ProgramVertex *, ProgramFragment *);
+ bool lookup(Context *rsc, ProgramVertex *, ProgramFragment *);
void cleanupVertex(uint32_t id);
void cleanupFragment(uint32_t id);