From 39852e8b8bdc08b65a1b9baabbe7e2167eae5fdb Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 22 Nov 2020 13:33:34 -0800 Subject: Removed autorelease pool from unit tests: Metal backend now catches all autoreleased objects automatically --- Graphics/GraphicsEngine/interface/BlendState.h | 3 +++ Graphics/GraphicsEngine/interface/GraphicsTypes.h | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/BlendState.h b/Graphics/GraphicsEngine/interface/BlendState.h index 2dd843ec..50feb22c 100644 --- a/Graphics/GraphicsEngine/interface/BlendState.h +++ b/Graphics/GraphicsEngine/interface/BlendState.h @@ -171,6 +171,9 @@ DILIGENT_TYPED_ENUM(BLEND_OPERATION, Int8) /// writable components of the render target DILIGENT_TYPED_ENUM(COLOR_MASK, Int8) { + /// Do not store any components. + COLOR_MASK_NONE = 0, + /// Allow data to be stored in the red component. COLOR_MASK_RED = 1, diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index d85540ac..41fd8210 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -2258,6 +2258,25 @@ struct EngineMtlCreateInfo DILIGENT_DERIVE(EngineCreateInfo) /// resource manager and then suballocate from this chunk in a lock-free /// fashion. DynamicHeapPageSize defines the size of this chunk. Uint32 DynamicHeapPageSize DEFAULT_INITIALIZER(4 << 20); + + + /// Indicates if device contexts should automatically manage autorelease pools. + + /// Metal API creates a lot of autoreleased objects. By default, the engine + /// will catch all these objects by pushing autorelease pools where necessary. + /// When UseAutoreleasePoolsInContexts is set to false, the engine will not use + /// autorelease pools in device contexts and the application will be responsible + /// for ensuring that all context commands are issued from within an autorelease + /// pool to avoid memory leaks. + /// + /// \note Autorelease pool is pushed by the first command of the device context + /// that needs it and popped by IDeviceContext::FinishFrame(). + /// The method must always be called from the same thread that + /// issued the context commands. + /// + /// Creating device objects will not leak memory even when + /// UseAutoreleasePoolsInContexts is set to false. + bool UseAutoreleasePoolsInContexts DEFAULT_INITIALIZER(true); }; typedef struct EngineMtlCreateInfo EngineMtlCreateInfo; -- cgit v1.2.3