diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-09-27 10:29:47 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-09-27 10:29:47 -0700 |
commit | 7215b5115ed8c34448b502dbfae1efa295c0a1e5 (patch) | |
tree | 7ef7e42b94324c33005b33a8faf6a64cc087d33f /libs | |
parent | bace89118bf1589e8afa00a3c1b36d681b6835da (diff) | |
download | frameworks_base-7215b5115ed8c34448b502dbfae1efa295c0a1e5.zip frameworks_base-7215b5115ed8c34448b502dbfae1efa295c0a1e5.tar.gz frameworks_base-7215b5115ed8c34448b502dbfae1efa295c0a1e5.tar.bz2 |
Error checking for MVP matrix computation.
Fixing more padding bugs.
Change-Id: Ic5d4260027b7dc86a50fdab7221c7296c7d3ea0d
Diffstat (limited to 'libs')
-rw-r--r-- | libs/rs/rsProgramVertex.cpp | 5 | ||||
-rw-r--r-- | libs/rs/rsVertexArray.cpp | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp index c3ef356..918625c 100644 --- a/libs/rs/rsProgramVertex.cpp +++ b/libs/rs/rsProgramVertex.cpp @@ -108,6 +108,11 @@ void ProgramVertex::setupGL2(Context *rsc, ProgramVertexState *state, ShaderCach rsc->checkError("ProgramVertex::setupGL2 start"); if(!isUserProgram()) { + if(mConstants[0].get() == NULL) { + LOGE("Unable to set fixed function emulation matrices because allocation is missing"); + rsc->setError(RS_ERROR_BAD_SHADER, "Fixed function allocation missing"); + return; + } float *f = static_cast<float *>(mConstants[0]->getPtr()); Matrix mvp; mvp.load(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET]); diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp index 075a70d..16be5ea 100644 --- a/libs/rs/rsVertexArray.cpp +++ b/libs/rs/rsVertexArray.cpp @@ -84,6 +84,10 @@ void VertexArray::clear(uint32_t n) void VertexArray::add(const Attrib &a, uint32_t stride) { + // Skip padding + if(a.name[0] == '#') { + return; + } rsAssert(mCount < RS_MAX_ATTRIBS); mAttribs[mCount].set(a); mAttribs[mCount].buffer = mActiveBuffer; @@ -94,6 +98,10 @@ void VertexArray::add(const Attrib &a, uint32_t stride) void VertexArray::add(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset, const char *name) { + // Skip padding + if(name[0] == '#') { + return; + } rsAssert(mCount < RS_MAX_ATTRIBS); mAttribs[mCount].clear(); mAttribs[mCount].type = type; @@ -129,12 +137,7 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh rsc->checkError("VertexArray::setupGL2 disabled"); for (uint32_t ct=0; ct < mCount; ct++) { - int32_t slot = 0; - - if (mAttribs[ct].name[0] == '#') { - continue; - } - + int32_t slot = -1; if (sc->isUserVertexProgram()) { slot = sc->vtxAttribSlot(ct); } else { @@ -146,14 +149,11 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh slot = 2; } else if (mAttribs[ct].name == "texture0") { slot = 3; - } else { - continue; } } if(slot < 0) { continue; } - //logAttrib(ct, slot); glEnableVertexAttribArray(slot); glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); |