6#ifndef QSSGPERFRAMEALLOCATOR_H
7#define QSSGPERFRAMEALLOCATOR_H
20#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
32 Alignment =
sizeof(
void *),
33 SlabSize = ChunkSize -
sizeof(Slab *),
34 MaxAlloc = ChunkSize/2
40 previous->
next =
this;
49 Slab *current =
nullptr;
66 void *allocate(
size_t size)
68 size = (
size + Alignment - 1) & ~(Alignment - 1);
72 size_t amountLeftInSlab = SlabSize -
offset;
73 if (
size > amountLeftInSlab) {
75 current = current->
next;
77 current =
new Slab(current);
95 Slab *current =
nullptr;
100 ~LargeAllocator() { deallocateAll(); }
105 Slab *
n = current->
next;
112 void *allocate(
size_t size)
115 Slab *
s =
reinterpret_cast<Slab *
>(mem);
118 return mem +
sizeof(Slab);
122 FastAllocator m_fastAllocator;
123 LargeAllocator m_largeAllocator;
130 if (
size < FastAllocator::MaxAlloc)
131 return m_fastAllocator.allocate(
size);
133 return m_largeAllocator.allocate(
size);
138 m_fastAllocator.reset();
139 m_largeAllocator.deallocateAll();
void * allocate(size_t size)
Combined button and popup list for selecting options.
#define Q_STATIC_ASSERT(Condition)
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLuint GLintptr offset