Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1121c6ce authored by Alex Sakhartchouk's avatar Alex Sakhartchouk Committed by Android (Google) Code Review
Browse files

Merge "Error checking for MVP matrix computation. Fixing more padding bugs."

parents 2953283f 7215b511
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -108,6 +108,11 @@ void ProgramVertex::setupGL2(Context *rsc, ProgramVertexState *state, ShaderCach
    rsc->checkError("ProgramVertex::setupGL2 start");
    rsc->checkError("ProgramVertex::setupGL2 start");


    if(!isUserProgram()) {
    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());
        float *f = static_cast<float *>(mConstants[0]->getPtr());
        Matrix mvp;
        Matrix mvp;
        mvp.load(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET]);
        mvp.load(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET]);
+9 −9
Original line number Original line Diff line number Diff line
@@ -84,6 +84,10 @@ void VertexArray::clear(uint32_t n)


void VertexArray::add(const Attrib &a, uint32_t stride)
void VertexArray::add(const Attrib &a, uint32_t stride)
{
{
    // Skip padding
    if(a.name[0] == '#') {
        return;
    }
    rsAssert(mCount < RS_MAX_ATTRIBS);
    rsAssert(mCount < RS_MAX_ATTRIBS);
    mAttribs[mCount].set(a);
    mAttribs[mCount].set(a);
    mAttribs[mCount].buffer = mActiveBuffer;
    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)
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);
    rsAssert(mCount < RS_MAX_ATTRIBS);
    mAttribs[mCount].clear();
    mAttribs[mCount].clear();
    mAttribs[mCount].type = type;
    mAttribs[mCount].type = type;
@@ -129,12 +137,7 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh


    rsc->checkError("VertexArray::setupGL2 disabled");
    rsc->checkError("VertexArray::setupGL2 disabled");
    for (uint32_t ct=0; ct < mCount; ct++) {
    for (uint32_t ct=0; ct < mCount; ct++) {
        int32_t slot = 0;
        int32_t slot = -1;

        if (mAttribs[ct].name[0] == '#') {
            continue;
        }

        if (sc->isUserVertexProgram()) {
        if (sc->isUserVertexProgram()) {
            slot = sc->vtxAttribSlot(ct);
            slot = sc->vtxAttribSlot(ct);
        } else {
        } else {
@@ -146,14 +149,11 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh
                slot = 2;
                slot = 2;
            } else if (mAttribs[ct].name == "texture0") {
            } else if (mAttribs[ct].name == "texture0") {
                slot = 3;
                slot = 3;
            } else {
                continue;
            }
            }
        }
        }
        if(slot < 0) {
        if(slot < 0) {
            continue;
            continue;
        }
        }

        //logAttrib(ct, slot);
        //logAttrib(ct, slot);
        glEnableVertexAttribArray(slot);
        glEnableVertexAttribArray(slot);
        glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
        glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);