Changeset 1688


Ignore:
Timestamp:
Aug 1, 2012, 1:50:59 PM (7 years ago)
Author:
sam
Message:

gpu: only unbind vertex attribs that we actually bound.

Location:
trunk/src/gpu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gpu/vertexbuffer.cpp

    r1603 r1688  
    237237        Abort();
    238238#elif !defined __CELLOS_LV2__
    239     /* FIXME: we need to unbind what we bound */
    240     //glDisableVertexAttribArray(m_attrib);
    241     /* FIXME: temporary kludge */
    242     for (int i = 0; i < 12; i++)
    243         glDisableVertexAttribArray(i);
     239    for (int i = 0; i < m_count; i++)
     240    {
     241        if (m_streams[i].reg >= 0)
     242        {
     243            for (int j = i + 1; j < m_count; j++)
     244                if (m_streams[j].reg == m_streams[i].reg)
     245                    m_streams[j].reg = -1;
     246
     247            glDisableVertexAttribArray(m_streams[i].reg);
     248        }
     249    }
    244250    glBindBuffer(GL_ARRAY_BUFFER, 0);
    245     /* FIXME: only useful for VAOs */
     251    /* FIXME: only useful for VAOs? */
    246252    //glBindBuffer(GL_ARRAY_BUFFER, 0);
    247     /* Or: */
    248     //glDisableVertexAttribArray(m_attrib);
    249253#else
    250254    /* Or even: */
     
    347351            if (m_streams[i].index == m_streams[attr_index].index)
    348352            {
     353                /* Remember the register used for this stream */
     354                m_streams[i].reg = reg;
     355
    349356                stride += m_streams[i].size;
    350357                if (i < attr_index)
     
    523530        m_streams[m_count].size = s.m_streams[i].size;
    524531        m_streams[m_count].index = index;
     532        m_streams[m_count].reg = -1;
    525533        m_count++;
    526534    }
  • trunk/src/gpu/vertexbuffer.h

    r1468 r1688  
    124124};
    125125
     126/* Specialise this template for "void" to act as a NOP */
    126127template<>
    127128inline void VertexStreamBase::AddStream<void>(int n, VertexUsage usage)
     
    199200    void AddStream(VertexStreamBase const &);
    200201
    201     struct { uint8_t stream_type, index, usage, size; } m_streams[12 + 1];
     202    struct { uint8_t stream_type, index, usage, size; int reg; } m_streams[12 + 1];
    202203    int m_count;
    203204
Note: See TracChangeset for help on using the changeset viewer.