Преглед изворни кода

gpu: added a SetStream that takes an array of attributes

undefined
Benlitz Sam Hocevar <sam@hocevar.net> пре 11 година
родитељ
комит
d775d7da19
2 измењених фајлова са 19 додато и 6 уклоњено
  1. +17
    -6
      src/gpu/vertexbuffer.cpp
  2. +2
    -0
      src/lol/gpu/vertexbuffer.h

+ 17
- 6
src/gpu/vertexbuffer.cpp Прегледај датотеку

@@ -309,6 +309,19 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attr1,
ShaderAttrib attr10,
ShaderAttrib attr11,
ShaderAttrib attr12)
{
#if defined _XBOX || defined USE_D3D9
// Don't bother in DirectX world, shader attributes are not used
SetStream(vb, NULL);
#else
ShaderAttrib attribs[12] = { attr1, attr2, attr3, attr4, attr5, attr6,
attr7, attr8, attr9, attr10, attr11, attr12 };

SetStream(vb, attribs);
#endif
}

void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[])
{
if (!vb->m_data->m_size)
return;
@@ -347,13 +360,11 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attr1,
}
#else
glBindBuffer(GL_ARRAY_BUFFER, vb->m_data->m_vbo);
ShaderAttrib l[12] = { attr1, attr2, attr3, attr4, attr5, attr6,
attr7, attr8, attr9, attr10, attr11, attr12 };
for (int n = 0; n < 12 && l[n].m_flags != (uint64_t)0 - 1; n++)
for (int n = 0; n < 12 && attribs[n].m_flags != (uint64_t)0 - 1; n++)
{
uint32_t reg = l[n].m_flags >> 32;
uint32_t usage = (l[n].m_flags >> 16) & 0xffff;
uint32_t index = l[n].m_flags & 0xffff;
uint32_t reg = attribs[n].m_flags >> 32;
uint32_t usage = (attribs[n].m_flags >> 16) & 0xffff;
uint32_t index = attribs[n].m_flags & 0xffff;

# if !defined __CELLOS_LV2__
if (reg != 0xffffffff)


+ 2
- 0
src/lol/gpu/vertexbuffer.h Прегледај датотеку

@@ -300,6 +300,8 @@ public:
ShaderAttrib attr11 = ShaderAttrib(),
ShaderAttrib attr12 = ShaderAttrib());

void SetStream(VertexBuffer *vb, ShaderAttrib attribs[]);

int GetStreamCount() const;

VertexStreamBase GetStream(int index) const;


Loading…
Откажи
Сачувај