From fa7cd66f71f4d7a6ee42b9d8a85a28ba209a6101 Mon Sep 17 00:00:00 2001 From: Dario Manesku Date: Tue, 25 Aug 2015 02:49:39 +0200 Subject: [PATCH] Fixing encodeAsInt field. Had two problems: 1# Bit field didn't got updated for Uint10. 2# Shifting by 8 on uint8_t. Problem was introduced on: 8da579ff99a62318682f1e913f5e0d9f6b8f8b2c. --- src/vertexdecl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vertexdecl.cpp b/src/vertexdecl.cpp index f26c5f86..7bc8f616 100644 --- a/src/vertexdecl.cpp +++ b/src/vertexdecl.cpp @@ -111,10 +111,10 @@ namespace bgfx VertexDecl& VertexDecl::add(Attrib::Enum _attrib, uint8_t _num, AttribType::Enum _type, bool _normalized, bool _asInt) { - const uint8_t encodedNorm = (_normalized&1)<<7; - const uint8_t encodedType = (_type&7)<<3; - const uint8_t encodedNum = (_num-1)&3; - const uint8_t encodeAsInt = (_asInt&(!!"\x1\x1\x0\x0"[_type]) )<<8; + const uint32_t encodedNorm = (_normalized&1)<<7; + const uint32_t encodedType = (_type&7)<<3; + const uint32_t encodedNum = (_num-1)&3; + const uint32_t encodeAsInt = (_asInt&(!!"\x1\x1\x1\x0\x0"[_type]) )<<8; m_attributes[_attrib] = encodedNorm|encodedType|encodedNum|encodeAsInt; m_offset[_attrib] = m_stride;