summaryrefslogtreecommitdiff
path: root/libs/rs/rsElement.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2009-09-27 17:50:38 -0700
committer Jason Sams <rjsams@android.com> 2009-09-27 17:50:38 -0700
commit3c0dfbab807a459622aeade4940daddf482dec66 (patch)
treeefd2b716319c8f69789ec81343776eb7d008975e /libs/rs/rsElement.cpp
parente7d60bfdff35ad8eace600d2a6cb81163c966bb0 (diff)
Improve logging code to dump more detaild rs object info. Fix bug with predefined elements not being recreated for contexts after one was destroyed. Add stricter type enforcement.
Diffstat (limited to 'libs/rs/rsElement.cpp')
-rw-r--r--libs/rs/rsElement.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index a00fb5217128..67e4f1401066 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -55,6 +55,8 @@ void Element::setComponent(uint32_t idx, Component *c)
rsAssert(!mComponents[idx].get());
rsAssert(idx < mComponentCount);
mComponents[idx].set(c);
+
+// Fixme: This should probably not be here
c->incUserRef();
}
@@ -179,6 +181,17 @@ uint32_t Element::getGLFormat() const
}
+void Element::dumpLOGV(const char *prefix) const
+{
+ ObjectBase::dumpLOGV(prefix);
+ LOGV("%s Element: components %i, size %i", prefix, mComponentCount, getSizeBytes());
+ for (uint32_t ct = 0; ct < mComponentCount; ct++) {
+ char buf[1024];
+ sprintf(buf, "%s component %i: ", prefix, ct);
+ mComponents[ct]->dumpLOGV(buf);
+ }
+}
+
ElementState::ElementState()
{
}
@@ -201,6 +214,9 @@ void rsi_ElementBegin(Context *rsc)
void rsi_ElementAdd(Context *rsc, RsDataKind dk, RsDataType dt, bool isNormalized, size_t bits, const char *name)
{
ElementState * sec = &rsc->mStateElement;
+
+ rsAssert(bits > 0);
+
Component *c = new Component(rsc,
static_cast<Component::DataKind>(dk),
static_cast<Component::DataType>(dt),
@@ -215,6 +231,8 @@ RsElement rsi_ElementCreate(Context *rsc)
ElementState * sec = &rsc->mStateElement;
Element *se = new Element(rsc, sec->mComponentBuildList.size());
+ rsAssert(se->getComponentCount() > 0);
+
for (size_t ct = 0; ct < se->getComponentCount(); ct++) {
se->setComponent(ct, sec->mComponentBuildList[ct]);
}