Changeset 2919


Ignore:
Timestamp:
Sep 14, 2013, 6:58:45 PM (6 years ago)
Author:
benlitz
Message:

gpu: added a SetStream that takes an array of attributes

Location:
trunk/src
Files:
2 edited

Legend:

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

    r2830 r2919  
    311311                                                    ShaderAttrib attr12)
    312312{
     313#if defined _XBOX || defined USE_D3D9
     314    // Don't bother in DirectX world, shader attributes are not used
     315    SetStream(vb, NULL);
     316#else
     317    ShaderAttrib attribs[12] = { attr1, attr2, attr3, attr4, attr5, attr6,
     318                           attr7, attr8, attr9, attr10, attr11, attr12 };
     319
     320    SetStream(vb, attribs);
     321#endif
     322}
     323
     324void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[])
     325{
    313326    if (!vb->m_data->m_size)
    314327        return;
     
    348361#else
    349362    glBindBuffer(GL_ARRAY_BUFFER, vb->m_data->m_vbo);
    350     ShaderAttrib l[12] = { attr1, attr2, attr3, attr4, attr5, attr6,
    351                            attr7, attr8, attr9, attr10, attr11, attr12 };
    352     for (int n = 0; n < 12 && l[n].m_flags != (uint64_t)0 - 1; n++)
    353     {
    354         uint32_t reg = l[n].m_flags >> 32;
    355         uint32_t usage = (l[n].m_flags >> 16) & 0xffff;
    356         uint32_t index = l[n].m_flags & 0xffff;
     363    for (int n = 0; n < 12 && attribs[n].m_flags != (uint64_t)0 - 1; n++)
     364    {
     365        uint32_t reg = attribs[n].m_flags >> 32;
     366        uint32_t usage = (attribs[n].m_flags >> 16) & 0xffff;
     367        uint32_t index = attribs[n].m_flags & 0xffff;
    357368
    358369#   if !defined __CELLOS_LV2__
  • trunk/src/lol/gpu/vertexbuffer.h

    r2816 r2919  
    301301                                     ShaderAttrib attr12 = ShaderAttrib());
    302302
     303    void SetStream(VertexBuffer *vb, ShaderAttrib attribs[]);
     304
    303305    int GetStreamCount() const;
    304306
Note: See TracChangeset for help on using the changeset viewer.