Fixed vertex attribute.

This commit is contained in:
Branimir Karadžić 2015-08-07 11:37:52 -07:00
parent 6d8cf6a000
commit f82f99b2a6
6 changed files with 20 additions and 20 deletions

View file

@ -594,7 +594,7 @@ namespace bgfx
void decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const;
/// Returns true if VertexDecl contains attribute.
bool has(Attrib::Enum _attrib) const { return 0xff != m_attributes[_attrib]; }
bool has(Attrib::Enum _attrib) const { return UINT16_MAX != m_attributes[_attrib]; }
/// Returns relative attribute offset from the vertex.
uint16_t getOffset(Attrib::Enum _attrib) const { return m_offset[_attrib]; }

View file

@ -306,7 +306,7 @@ namespace bgfx { namespace d3d11
for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
{
if (0xff != _decl.m_attributes[attr])
if (UINT16_MAX != _decl.m_attributes[attr])
{
memcpy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) );
@ -2049,13 +2049,13 @@ BX_PRAGMA_DIAGNOSTIC_POP();
VertexDecl decl;
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
const uint8_t* attrMask = _program.m_vsh->m_attrMask;
const uint16_t* attrMask = _program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
{
uint8_t mask = attrMask[ii];
uint8_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
uint16_t mask = attrMask[ii];
uint16_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
}
D3D11_INPUT_ELEMENT_DESC* elem = fillVertexDecl(vertexElements, decl);
@ -3234,7 +3234,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (Attrib::Count != attr)
{
m_attrMask[attr] = 0xff;
m_attrMask[attr] = UINT16_MAX;
}
}

View file

@ -215,7 +215,7 @@ namespace bgfx { namespace d3d11
ConstantBuffer* m_constantBuffer;
PredefinedUniform m_predefined[PredefinedUniform::Count];
uint8_t m_attrMask[Attrib::Count];
uint16_t m_attrMask[Attrib::Count];
uint32_t m_hash;

View file

@ -289,7 +289,7 @@ namespace bgfx { namespace d3d12
for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
{
if (0xff != _decl.m_attributes[attr])
if (UINT16_MAX != _decl.m_attributes[attr])
{
memcpy(elem, &s_attrib[attr], sizeof(D3D12_INPUT_ELEMENT_DESC) );
@ -1821,13 +1821,13 @@ data.NumQualityLevels = 0;
{
VertexDecl decl;
memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
const uint8_t* attrMask = _program.m_vsh->m_attrMask;
const uint16_t* attrMask = _program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
{
uint8_t mask = attrMask[ii];
uint8_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
uint16_t mask = attrMask[ii];
uint16_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
}
D3D12_INPUT_ELEMENT_DESC* elem = fillVertexDecl(_vertexElements, decl);
@ -1939,13 +1939,13 @@ data.NumQualityLevels = 0;
VertexDecl decl;
memcpy(&decl, &m_vertexDecls[_declIdx], sizeof(VertexDecl) );
const uint8_t* attrMask = program.m_vsh->m_attrMask;
const uint16_t* attrMask = program.m_vsh->m_attrMask;
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
{
uint8_t mask = attrMask[ii];
uint8_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
uint16_t mask = attrMask[ii];
uint16_t attr = (decl.m_attributes[ii] & mask);
decl.m_attributes[ii] = attr == 0 ? UINT16_MAX : attr == UINT16_MAX ? 0 : attr;
}
bx::HashMurmur2A murmur;
@ -2947,7 +2947,7 @@ data.NumQualityLevels = 0;
if (Attrib::Count != attr)
{
m_attrMask[attr] = 0xff;
m_attrMask[attr] = UINT16_MAX;
}
}

View file

@ -183,7 +183,7 @@ namespace bgfx { namespace d3d12
ConstantBuffer* m_constantBuffer;
PredefinedUniform m_predefined[PredefinedUniform::Count];
uint8_t m_attrMask[Attrib::Count];
uint16_t m_attrMask[Attrib::Count];
uint32_t m_hash;
uint16_t m_numUniforms;

View file

@ -3455,7 +3455,7 @@ namespace bgfx { namespace gl
if (-1 != loc)
{
if (0xff != _vertexDecl.m_attributes[attr])
if (UINT16_MAX != _vertexDecl.m_attributes[attr])
{
GL_CHECK(glEnableVertexAttribArray(loc) );
GL_CHECK(glVertexAttribDivisor(loc, 0) );