diff --git a/include/bgfx.h b/include/bgfx.h index 9bef3662e..2d8988230 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -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]; } diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index b996a0d33..9e7deb3a4 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -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; } } diff --git a/src/renderer_d3d11.h b/src/renderer_d3d11.h index 1e93be616..d8ced4a63 100644 --- a/src/renderer_d3d11.h +++ b/src/renderer_d3d11.h @@ -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; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 595da3033..e05d4a241 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -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; } } diff --git a/src/renderer_d3d12.h b/src/renderer_d3d12.h index 798b27bd1..07d42ada7 100644 --- a/src/renderer_d3d12.h +++ b/src/renderer_d3d12.h @@ -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; diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index ce7398b35..f823372a7 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -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) );