int32_t read(bx::ReaderI* _reader, VertexDecl& _decl, bx::Error* _err) { BX_ERROR_SCOPE(_err); int32_t total = 0; uint8_t numAttrs; total += bx::read(_reader, numAttrs, _err); uint16_t stride; total += bx::read(_reader, stride, _err); if (!_err->isOk() ) { return total; } _decl.begin(); for (uint32_t ii = 0; ii < numAttrs; ++ii) { uint16_t offset; total += bx::read(_reader, offset, _err); uint16_t attribId = 0; total += bx::read(_reader, attribId, _err); uint8_t num; total += bx::read(_reader, num, _err); uint16_t attribTypeId; total += bx::read(_reader, attribTypeId, _err); bool normalized; total += bx::read(_reader, normalized, _err); bool asInt; total += bx::read(_reader, asInt, _err); if (!_err->isOk() ) { return total; } Attrib::Enum attr = idToAttrib(attribId); AttribType::Enum type = idToAttribType(attribTypeId); if (Attrib::Count != attr && AttribType::Count != type) { _decl.add(attr, num, type, normalized, asInt); _decl.m_offset[attr] = offset; } } _decl.end(); _decl.m_stride = stride; return total; }
int32_t read(bx::ReaderI* _reader, VertexDecl& _decl) { int32_t total = 0; uint8_t numAttrs; total += bx::read(_reader, numAttrs); uint16_t stride; total += bx::read(_reader, stride); _decl.begin(); for (uint32_t ii = 0; ii < numAttrs; ++ii) { uint16_t offset; total += bx::read(_reader, offset); uint16_t attribId = 0; total += bx::read(_reader, attribId); uint8_t num; total += bx::read(_reader, num); uint16_t attribTypeId; total += bx::read(_reader, attribTypeId); bool normalized; total += bx::read(_reader, normalized); bool asInt; total += bx::read(_reader, asInt); Attrib::Enum attr = idToAttrib(attribId); AttribType::Enum type = idToAttribType(attribTypeId); if (Attrib::Count != attr && AttribType::Count != type) { _decl.add(attr, num, type, normalized, asInt); _decl.m_offset[attr] = offset; } } _decl.end(); _decl.m_stride = stride; return total; }