diff options
Diffstat (limited to 'libs/rs')
| -rw-r--r-- | libs/rs/java/Film/src/com/android/film/FilmRS.java | 10 | ||||
| -rw-r--r-- | libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java | 12 | ||||
| -rw-r--r-- | libs/rs/rsAllocation.cpp | 1 | ||||
| -rw-r--r-- | libs/rs/rsComponent.cpp | 5 | ||||
| -rw-r--r-- | libs/rs/rsComponent.h | 1 | ||||
| -rw-r--r-- | libs/rs/rsElement.cpp | 18 | ||||
| -rw-r--r-- | libs/rs/rsElement.h | 3 | ||||
| -rw-r--r-- | libs/rs/rsObjectBase.cpp | 6 | ||||
| -rw-r--r-- | libs/rs/rsObjectBase.h | 2 | ||||
| -rw-r--r-- | libs/rs/rsType.cpp | 10 | ||||
| -rw-r--r-- | libs/rs/rsType.h | 1 |
11 files changed, 54 insertions, 15 deletions
diff --git a/libs/rs/java/Film/src/com/android/film/FilmRS.java b/libs/rs/java/Film/src/com/android/film/FilmRS.java index cee827b..b5b6723 100644 --- a/libs/rs/java/Film/src/com/android/film/FilmRS.java +++ b/libs/rs/java/Film/src/com/android/film/FilmRS.java @@ -152,9 +152,9 @@ public class FilmRS { mBufferIDs = new int[13]; mImages = new Allocation[13]; mAllocIDs = Allocation.createSized(mRS, - Element.USER_FLOAT, mBufferIDs.length); + Element.USER_F32(mRS), mBufferIDs.length); - Element ie = Element.RGB_565; + Element ie = Element.RGB_565(mRS); mImages[0] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p01, ie, true); mImages[1] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p02, ie, true); mImages[2] = Allocation.createFromBitmapResourceBoxed(mRS, mRes, R.drawable.p03, ie, true); @@ -195,7 +195,7 @@ public class FilmRS { { mBufferState = new int[10]; mAllocState = Allocation.createSized(mRS, - Element.USER_FLOAT, mBufferState.length); + Element.USER_F32(mRS), mBufferState.length); mBufferState[STATE_LAST_FOCUS] = -1; mAllocState.data(mBufferState); } @@ -238,12 +238,12 @@ public class FilmRS { mAllocOffsets = Allocation.createSized(mRS, - Element.USER_I32, mFSM.mTriangleOffsets.length); + Element.USER_I32(mRS), mFSM.mTriangleOffsets.length); mAllocOffsets.data(mFSM.mTriangleOffsets); mScriptStrip.bindAllocation(mAllocOffsets, 4); mAllocOffsetsTex = Allocation.createSized(mRS, - Element.USER_FLOAT, mFSM.mTriangleOffsetsTex.length); + Element.USER_F32(mRS), mFSM.mTriangleOffsetsTex.length); mAllocOffsetsTex.data(mFSM.mTriangleOffsetsTex); mScriptStrip.bindAllocation(mAllocOffsetsTex, 5); diff --git a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java index ba74b58..ff89bc3 100644 --- a/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java +++ b/libs/rs/java/Rollo/src/com/android/rollo/RolloRS.java @@ -182,7 +182,7 @@ public class RolloRS { mAllocScratchBuf = new int[32]; mAllocScratch = Allocation.createSized(mRS, - Element.USER_I32, mAllocScratchBuf.length); + Element.USER_I32(mRS), mAllocScratchBuf.length); mAllocScratch.data(mAllocScratchBuf); Log.e("rs", "Done loading named"); @@ -193,14 +193,14 @@ public class RolloRS { mIcons = new Allocation[29]; mAllocIconIDBuf = new int[mIcons.length]; mAllocIconID = Allocation.createSized(mRS, - Element.USER_I32, mAllocIconIDBuf.length); + Element.USER_I32(mRS), mAllocIconIDBuf.length); mLabels = new Allocation[29]; mAllocLabelIDBuf = new int[mLabels.length]; mAllocLabelID = Allocation.createSized(mRS, - Element.USER_I32, mLabels.length); + Element.USER_I32(mRS), mLabels.length); - Element ie8888 = Element.RGBA_8888; + Element ie8888 = Element.RGBA_8888(mRS); mIcons[0] = Allocation.createFromBitmapResource(mRS, mRes, R.raw.browser, ie8888, true); mIcons[1] = Allocation.createFromBitmapResource(mRS, mRes, R.raw.market, ie8888, true); @@ -284,7 +284,7 @@ public class RolloRS { p.setTextSize(20); p.setColor(0xffffffff); c.drawText(t, 2, 26, p); - return Allocation.createFromBitmap(mRS, b, Element.RGBA_8888, true); + return Allocation.createFromBitmap(mRS, b, Element.RGBA_8888(mRS), true); } @@ -298,7 +298,7 @@ public class RolloRS { mAllocStateBuf = new int[] {0, 0, 0, 8, 0, 0, -1, 0, mAllocIconIDBuf.length, 0, 0}; mAllocState = Allocation.createSized(mRS, - Element.USER_I32, mAllocStateBuf.length); + Element.USER_I32(mRS), mAllocStateBuf.length); mScript.bindAllocation(mAllocState, 0); mScript.bindAllocation(mAllocIconID, 1); mScript.bindAllocation(mAllocScratch, 2); diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 8ee6e5a..8ac9c26 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -141,6 +141,7 @@ void Allocation::subData(uint32_t xoff, uint32_t count, const void *data, uint32 if (size != sizeBytes) { LOGE("Allocation::subData called with mismatched size expected %i, got %i", size, sizeBytes); + mType->dumpLOGV("type info"); return; } memcpy(ptr, data, size); diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp index 42e2e4f..de074c8 100644 --- a/libs/rs/rsComponent.cpp +++ b/libs/rs/rsComponent.cpp @@ -102,4 +102,9 @@ uint32_t Component::getGLType() const return 0; } +void Component::dumpLOGV(const char *prefix) const +{ + ObjectBase::dumpLOGV(prefix); + LOGV("%s component: %i %i %i %i", prefix, mType, mKind, mIsNormalized, mBits); +} diff --git a/libs/rs/rsComponent.h b/libs/rs/rsComponent.h index 290cd57..5366cc4 100644 --- a/libs/rs/rsComponent.h +++ b/libs/rs/rsComponent.h @@ -56,6 +56,7 @@ public: const char * getCType() const; const char * getComponentName() const {return mName.string();} + virtual void dumpLOGV(const char *prefix) const; protected: diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index a00fb52..67e4f14 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]); } diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h index 82da441..b41c552 100644 --- a/libs/rs/rsElement.h +++ b/libs/rs/rsElement.h @@ -51,6 +51,9 @@ public: uint32_t getComponentCount() const {return mComponentCount;} Component * getComponent(uint32_t idx) const {return mComponents[idx].get();} + + void dumpLOGV(const char *prefix) const; + protected: // deallocate any components that are part of this element. void clear(); diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp index 720e8fc..0008ea4 100644 --- a/libs/rs/rsObjectBase.cpp +++ b/libs/rs/rsObjectBase.cpp @@ -41,7 +41,7 @@ ObjectBase::~ObjectBase() remove(); } -void ObjectBase::dumpObj(const char *op) const +void ObjectBase::dumpLOGV(const char *op) const { if (mName) { LOGV("%s RSobj %p, name %s, refs %i,%i from %s,%i links %p,%p,%p", @@ -79,7 +79,7 @@ bool ObjectBase::checkDelete() const { if (!(mSysRefCount | mUserRefCount)) { if (mRSC && mRSC->props.mLogObjects) { - dumpObj("checkDelete"); + dumpLOGV("checkDelete"); } delete this; return true; @@ -188,7 +188,7 @@ void ObjectBase::zeroAllUserRef(Context *rsc) LOGV("Objects remaining."); o = rsc->mObjHead; while (o) { - o->dumpObj(" "); + o->dumpLOGV(" "); o = o->mNext; } } diff --git a/libs/rs/rsObjectBase.h b/libs/rs/rsObjectBase.h index ea5e37c..dc85ac7 100644 --- a/libs/rs/rsObjectBase.h +++ b/libs/rs/rsObjectBase.h @@ -50,7 +50,7 @@ public: static void zeroAllUserRef(Context *rsc); - void dumpObj(const char *op) const; + virtual void dumpLOGV(const char *prefix) const; protected: const char *mAllocFile; diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp index 5ce9ca2..ddaa2f0 100644 --- a/libs/rs/rsType.cpp +++ b/libs/rs/rsType.cpp @@ -302,6 +302,16 @@ void Type::enableGLVertexBuffer() const } +void Type::dumpLOGV(const char *prefix) const +{ + char buf[1024]; + ObjectBase::dumpLOGV(prefix); + LOGV("%s Type: x=%i y=%i z=%i mip=%i face=%i", prefix, mDimX, mDimY, mDimZ, mDimLOD, mFaces); + sprintf(buf, "%s element: ", prefix); + mElement->dumpLOGV(buf); +} + + ////////////////////////////////////////////////// // namespace android { diff --git a/libs/rs/rsType.h b/libs/rs/rsType.h index 116f1c7..2c43405 100644 --- a/libs/rs/rsType.h +++ b/libs/rs/rsType.h @@ -69,6 +69,7 @@ public: void enableGLVertexBuffer() const; + void dumpLOGV(const char *prefix) const; protected: struct LOD { |
