Files
UnrealEngine/Engine/Source/Runtime/RenderCore/Public/RenderDeferredCleanup.h
2025-05-18 13:04:45 +08:00

39 lines
1.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/Array.h"
/**
* The base class of objects that need to defer deletion until the render command queue has been flushed.
*/
class FDeferredCleanupInterface
{
public:
virtual ~FDeferredCleanupInterface() {}
};
/**
* A set of cleanup objects which are pending deletion.
*/
class FPendingCleanupObjects
{
TArray<FDeferredCleanupInterface*> CleanupArray;
public:
inline bool IsEmpty() const { return CleanupArray.IsEmpty(); }
FPendingCleanupObjects();
RENDERCORE_API ~FPendingCleanupObjects();
};
/**
* Adds the specified deferred cleanup object to the current set of pending cleanup objects.
*/
extern RENDERCORE_API void BeginCleanup(FDeferredCleanupInterface* CleanupObject);
/**
* Transfers ownership of the current set of pending cleanup objects to the caller. A new set is created for subsequent BeginCleanup calls.
* @return A pointer to the set of pending cleanup objects. The called is responsible for deletion.
*/
extern RENDERCORE_API FPendingCleanupObjects* GetPendingCleanupObjects();