|
1 | 1 | /* |
2 | | - * Copyright 2019-2024 Diligent Graphics LLC |
| 2 | + * Copyright 2019-2025 Diligent Graphics LLC |
3 | 3 | * Copyright 2015-2019 Egor Yusov |
4 | 4 | * |
5 | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
33 | 33 | #include "../../../Primitives/interface/Object.h" |
34 | 34 | #include "../../../Primitives/interface/DebugOutput.h" |
35 | 35 | #include "../../../Primitives/interface/DataBlob.h" |
| 36 | +#include "../../../Primitives/interface/MemoryAllocator.h" |
36 | 37 | #include "GraphicsTypes.h" |
37 | 38 |
|
38 | 39 |
|
@@ -128,16 +129,38 @@ DILIGENT_BEGIN_INTERFACE(IEngineFactory, IObject) |
128 | 129 |
|
129 | 130 | /// Sets a user-provided debug message callback. |
130 | 131 |
|
131 | | - /// \param [in] MessageCallback - Debug message callback function to use instead of the default one. |
| 132 | + /// \param [in] MessageCallback - Debug message callback function to use instead of the default one. |
| 133 | + /// |
| 134 | + /// MessageCallback is a global setting that applies to the entire execution unit |
| 135 | + /// (executable or shared library that contains the engine implementation). |
132 | 136 | VIRTUAL void METHOD(SetMessageCallback)(THIS_ |
133 | 137 | DebugMessageCallbackType MessageCallback) CONST PURE; |
134 | 138 |
|
| 139 | + |
135 | 140 | /// Sets whether to break program execution on assertion failure. |
136 | 141 |
|
137 | | - /// \param [in] BreakOnError - Whether to break on assertion failure. |
| 142 | + /// \param [in] BreakOnError - Whether to break on assertion failure. |
| 143 | + /// |
| 144 | + /// BreakOnError is a global setting that applies to the entire execution unit |
| 145 | + /// (executable or shared library that contains the engine implementation). |
138 | 146 | VIRTUAL void METHOD(SetBreakOnError)(THIS_ |
139 | 147 | bool BreakOnError) CONST PURE; |
140 | 148 |
|
| 149 | + |
| 150 | + /// Sets the memory allocator to be used by the engine. |
| 151 | + |
| 152 | + /// \param [in] pAllocator - Pointer to the memory allocator. |
| 153 | + /// |
| 154 | + /// The allocator is a global setting that applies to the entire execution unit |
| 155 | + /// (executable or shared library that contains the engine implementation). |
| 156 | + /// |
| 157 | + /// The allocator should be set before any other factory method is called and |
| 158 | + /// should not be changed afterwards. |
| 159 | + /// The allocator object must remain valid for the lifetime of the |
| 160 | + /// engine until all engine objects are destroyed. |
| 161 | + VIRTUAL void METHOD(SetMemoryAllocator)(THIS_ |
| 162 | + IMemoryAllocator* pAllocator) CONST PURE; |
| 163 | + |
141 | 164 | #if PLATFORM_ANDROID |
142 | 165 | /// On Android platform, it is necessary to initialize the file system before |
143 | 166 | /// CreateDefaultShaderSourceStreamFactory() method can be called. |
@@ -171,6 +194,7 @@ DILIGENT_END_INTERFACE |
171 | 194 | # define IEngineFactory_CreateDearchiver(This, ...) CALL_IFACE_METHOD(EngineFactory, CreateDearchiver, This, __VA_ARGS__) |
172 | 195 | # define IEngineFactory_SetMessageCallback(This, ...) CALL_IFACE_METHOD(EngineFactory, SetMessageCallback, This, __VA_ARGS__) |
173 | 196 | # define IEngineFactory_SetBreakOnError(This, ...) CALL_IFACE_METHOD(EngineFactory, SetBreakOnError, This, __VA_ARGS__) |
| 197 | +# define IEngineFactory_SetMemoryAllocator(This, ...) CALL_IFACE_METHOD(EngineFactory, SetMemoryAllocator, This, __VA_ARGS__) |
174 | 198 | // clang-format on |
175 | 199 |
|
176 | 200 | #endif |
|
0 commit comments