summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsVertexArray.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-01-07 15:40:45 -0800
committerJason Sams <rjsams@android.com>2010-01-07 16:26:42 -0800
commit6286953eced16648d18e1efc57c3b089c49b5608 (patch)
treee2e683664592acd3d8571a9d1e86395cc636503c /libs/rs/rsVertexArray.cpp
parentedc5189c33de03f3e2f5f73edc0e007992b933c9 (diff)
downloadframeworks_base-6286953eced16648d18e1efc57c3b089c49b5608.zip
frameworks_base-6286953eced16648d18e1efc57c3b089c49b5608.tar.gz
frameworks_base-6286953eced16648d18e1efc57c3b089c49b5608.tar.bz2
Change user attribs to look for empty slot rather than using them in order. Prevents conflict with numbered legacy slots.
Diffstat (limited to 'libs/rs/rsVertexArray.cpp')
-rw-r--r--libs/rs/rsVertexArray.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp
index 7a8e054..7124eb5 100644
--- a/libs/rs/rsVertexArray.cpp
+++ b/libs/rs/rsVertexArray.cpp
@@ -26,7 +26,6 @@ using namespace android::renderscript;
VertexArray::VertexArray()
{
mActiveBuffer = 0;
- mUserCount = 0;
}
VertexArray::~VertexArray()
@@ -40,7 +39,6 @@ void VertexArray::clearAll()
mAttribs[ct].clear();
}
mActiveBuffer = 0;
- mUserCount = 0;
}
VertexArray::Attrib::Attrib()
@@ -127,10 +125,13 @@ void VertexArray::setTexture(uint32_t size, uint32_t type, uint32_t stride, uint
void VertexArray::setUser(const Attrib &a, uint32_t stride)
{
- mAttribs[mUserCount].set(a);
- mAttribs[mUserCount].buffer = mActiveBuffer;
- mAttribs[mUserCount].stride = stride;
- mUserCount ++;
+ // Find empty slot, some may be taken by legacy 1.1 slots.
+ uint32_t slot = 0;
+ while (mAttribs[slot].size) slot++;
+ rsAssert(slot < RS_MAX_ATTRIBS);
+ mAttribs[slot].set(a);
+ mAttribs[slot].buffer = mActiveBuffer;
+ mAttribs[slot].stride = stride;
}
void VertexArray::logAttrib(uint32_t idx, uint32_t slot) const {
@@ -215,9 +216,8 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh
}
for (uint32_t ct=0; ct < RS_MAX_ATTRIBS; ct++) {
- if (mAttribs[ct].size) {
+ if (mAttribs[ct].size && (sc->vtxAttribSlot(ct) >= 0)) {
//logAttrib(ct, sc->vtxAttribSlot(ct));
- rsAssert(sc->vtxAttribSlot(ct) >= 0);
glEnableVertexAttribArray(sc->vtxAttribSlot(ct));
glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);