Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
glslmemorypool_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSG_GLSLMEMORYPOOL_H
7#define QSSG_GLSLMEMORYPOOL_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3DGlslParser/private/glsl_p.h>
21
22#include <cstddef>
23#include <new>
24
25QT_BEGIN_NAMESPACE
26
27namespace GLSL {
28
29class MemoryPool;
30
31class Q_QUICK3DGLSLPARSER_EXPORT MemoryPool
32{
34 void operator =(const MemoryPool &other);
35
36public:
37 MemoryPool();
38 ~MemoryPool();
39
40 void reset();
41
42 inline void *allocate(size_t size)
43 {
44 size = (size + 7) & ~7;
45 if (_ptr && (_ptr + size < _end)) {
46 void *addr = _ptr;
47 _ptr += size;
48 return addr;
49 }
50 return allocate_helper(size);
51 }
52
53private:
55
56private:
57 char **_blocks;
58 int _allocatedBlocks;
59 int _blockCount;
60 char *_ptr;
61 char *_end;
62
63 enum
64 {
65 BLOCK_SIZE = 8 * 1024,
66 DEFAULT_BLOCK_COUNT = 8
67 };
68};
69
70class Q_QUICK3DGLSLPARSER_EXPORT Managed
71{
72 Managed(const Managed &other);
73 void operator = (const Managed &other);
74
75public:
76 Managed();
77 virtual ~Managed();
78
79 void *operator new(size_t size, MemoryPool *pool);
80 void operator delete(void *);
81 void operator delete(void *, MemoryPool *);
82};
83
84} // namespace GLSL
85
86QT_END_NAMESPACE
87
88#endif // QSSG_GLSLMEMORYPOOL_H
void * operator new(size_t size, MemoryPool *pool)
void operator delete(void *, MemoryPool *)
void operator delete(void *)
void * allocate(size_t size)
Method & operator=(const Method &)
Assigns other to this Method instance.
Definition qqmlsa.cpp:611
#define assert