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

Function AllocBuffer

3rdparty/openal/al/buffer.cpp:309–327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309ALbuffer *AllocBuffer(ALCdevice *device)
310{
311 auto sublist = std::find_if(device->BufferList.begin(), device->BufferList.end(),
312 [](const BufferSubList &entry) noexcept -> bool
313 { return entry.FreeMask != 0; }
314 );
315
316 auto lidx = static_cast<ALuint>(std::distance(device->BufferList.begin(), sublist));
317 auto slidx = static_cast<ALuint>(CTZ64(sublist->FreeMask));
318
319 ALbuffer *buffer{::new (sublist->Buffers + slidx) ALbuffer{}};
320
321 /* Add 1 to avoid buffer ID 0. */
322 buffer->id = ((lidx<<6) | slidx) + 1;
323
324 sublist->FreeMask &= ~(1_u64 << slidx);
325
326 return buffer;
327}
328
329void FreeBuffer(ALCdevice *device, ALbuffer *buffer)
330{

Callers 1

buffer.cppFile · 0.85

Calls 3

distanceFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected