Files
UnrealEngineUWP/Engine/Source/Runtime/RenderCore/Public/IRenderCaptureProvider.h
jonathan bard 9372101ef9 * Added a scope object (IModularFeatures::FScopedLockModularFeatureList) to more easily lock/unlock the list of modular features when accessing it.
* Fixed render capture provider firing an assert when accessing IModularFeatures from outside the game thread (naive implementation for now, since this is a accessed very sporadically)
* Avoid locking the modular features list when calling GetEngineCrypto(), since the IEngineCrypto* is only accessed once and stored in a static member

#rb peter.knepley, carl-magnus.nordin

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19091116 via CL 19097126 via CL 19098363 via CL 19105418
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19146756 by jonathan bard in ue5-main branch]
2022-02-25 09:47:32 -05:00

87 lines
2.8 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Features/IModularFeatures.h"
class FRHICommandListImmediate;
class FViewport;
class IRenderCaptureProvider : public IModularFeature
{
public:
/**
* Get the feature name used for module resolution.
*
* @return The feature name.
*/
static FName GetModularFeatureName()
{
static FName FeatureName = FName(TEXT("RenderCaptureProvider"));
return FeatureName;
}
/**
* Checks to see if the specified feature is available.
*
* @return True if the feature is available right now and it is safe to call Get().
*/
static inline bool IsAvailable()
{
// This function is accessible from the render and RHI threads, so lock the list of modular features before calling GetModularFeature
IModularFeatures::FScopedLockModularFeatureList ScopedLockModularFeatureList;
return IModularFeatures::Get().IsModularFeatureAvailable(GetModularFeatureName());
}
/**
* Gets the first registered implementation of this feature. Will assert or crash
* if the specified feature is not available! You should call IsAvailable() first!
*
* @return The feature.
*/
static inline IRenderCaptureProvider& Get()
{
// This function is accessible from the render and RHI threads, so lock the list of modular features before calling GetModularFeature
IModularFeatures::FScopedLockModularFeatureList ScopedLockModularFeatureList;
return IModularFeatures::Get().GetModularFeature<IRenderCaptureProvider>(GetModularFeatureName());
}
/**
* Flags to pass to capture API.
*/
enum ECaptureFlags
{
// Set to launch the capture viewing application. Whether this is supported depends on the underlying capture tool.
ECaptureFlags_Launch = 1,
};
/**
* Capture the next full frame of rendering information.
* Currently any capture details (number of frames etc.) must be set up by CVars exposed in the underlying capture tool.
* Call from main thread only.
*
* @param Viewport The specific viewport to capture. (Optional).
* @param bLaunch
* @param DestFileName The destination file name for saving the capture. (Optional).
*
*/
virtual void CaptureFrame(FViewport* InViewport = nullptr, uint32 InFlags = 0, FString const& InDestFileName = FString()) = 0;
/**
* Start capturing rendering information.
* Call from render thread only.
*
* @param RHICommandList The command list to capture on.
* @param DestFileName The destination file name for saving the capture. (Optional).
*/
virtual void BeginCapture(FRHICommandListImmediate* InRHICommandList, uint32 InFlags = 0, FString const& InDestFileName = FString()) = 0;
/**
* Stop capturing rendering information and save the captured data.
* Call from render thread only.
*
* @param RHICommandList The command list to capture on.
*/
virtual void EndCapture(FRHICommandListImmediate* InRHICommandList) = 0;
};