MCPcopy Create free account
hub / github.com/crownengine/crown / read

Function read

3rdparty/bgfx/src/vertexlayout.cpp:286–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284 }
285
286 int32_t read(bx::ReaderI* _reader, VertexLayout& _layout, bx::Error* _err)
287 {
288 BX_ERROR_SCOPE(_err);
289
290 int32_t total = 0;
291
292 uint8_t numAttrs;
293 total += bx::read(_reader, numAttrs, _err);
294
295 uint16_t stride;
296 total += bx::read(_reader, stride, _err);
297
298 if (!_err->isOk() )
299 {
300 return total;
301 }
302
303 _layout.begin();
304
305 for (uint32_t ii = 0; ii < numAttrs; ++ii)
306 {
307 uint16_t offset;
308 total += bx::read(_reader, offset, _err);
309
310 uint16_t attribId = 0;
311 total += bx::read(_reader, attribId, _err);
312
313 uint8_t num;
314 total += bx::read(_reader, num, _err);
315
316 uint16_t attribTypeId;
317 total += bx::read(_reader, attribTypeId, _err);
318
319 bool normalized;
320 total += bx::read(_reader, normalized, _err);
321
322 bool asInt;
323 total += bx::read(_reader, asInt, _err);
324
325 if (!_err->isOk() )
326 {
327 return total;
328 }
329
330 Attrib::Enum attr = idToAttrib(attribId);
331 AttribType::Enum type = idToAttribType(attribTypeId);
332 if (Attrib::Count != attr
333 && AttribType::Count != type)
334 {
335 _layout.add(attr, num, type, normalized, asInt);
336 _layout.m_offset[attr] = offset;
337 }
338 }
339
340 _layout.end();
341 _layout.m_stride = stride;
342
343 return total;

Callers

nothing calls this directly

Calls 5

idToAttribFunction · 0.85
idToAttribTypeFunction · 0.85
beginMethod · 0.45
addMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected