UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSlateRHIRenderer Class Referencefinal

#include <SlateRHIRenderer.h>

+ Inheritance diagram for FSlateRHIRenderer:

Public Member Functions

 FSlateRHIRenderer (TSharedRef< FSlateFontServices > InSlateFontServices, TSharedRef< FSlateRHIResourceManager > InResourceManager)
 
virtual bool Initialize () override
 
virtual void Destroy () override
 
virtual FSlateDrawBufferAcquireDrawBuffer () override
 
virtual void ReleaseDrawBuffer (FSlateDrawBuffer &InWindowDrawBuffer) override
 
virtual void OnWindowDestroyed (const TSharedRef< SWindow > &InWindow) override
 
virtual void OnWindowFinishReshaped (const TSharedPtr< SWindow > &InWindow) override
 
virtual void RequestResize (const TSharedPtr< SWindow > &Window, uint32 NewWidth, uint32 NewHeight) override
 
virtual void CreateViewport (const TSharedRef< SWindow > Window) override
 
virtual void UpdateFullscreenState (const TSharedRef< SWindow > Window, uint32 OverrideResX, uint32 OverrideResY) override
 
virtual void SetSystemResolution (uint32 Width, uint32 Height) override
 
virtual void RestoreSystemResolution (const TSharedRef< SWindow > InWindow) override
 
virtual void DrawWindows (FSlateDrawBuffer &InWindowDrawBuffer) override
 
virtual void FlushCommands () const override
 
virtual void Sync () const override
 
virtual void ReleaseDynamicResource (const FSlateBrush &InBrush) override
 
virtual void RemoveDynamicBrushResource (TSharedPtr< FSlateDynamicImageBrush > BrushToRemove) override
 
virtual FIntPoint GenerateDynamicImageResource (const FName InTextureName) override
 
virtual bool GenerateDynamicImageResource (FName ResourceName, uint32 Width, uint32 Height, const TArray< uint8 > &Bytes) override
 
virtual bool GenerateDynamicImageResource (FName ResourceName, FSlateTextureDataRef TextureData) override
 
virtual FSlateResourceHandle GetResourceHandle (const FSlateBrush &Brush, FVector2f LocalSize, float DrawScale) override
 
virtual bool CanRenderResource (UObject &InResourceObject) const override
 
virtual voidGetViewportResource (const SWindow &Window) override
 
virtual void SetColorVisionDeficiencyType (EColorVisionDeficiency Type, int32 Severity, bool bCorrectDeficiency, bool bShowCorrectionWithDeficiency) override
 
virtual FSlateUpdatableTextureCreateUpdatableTexture (uint32 Width, uint32 Height) override
 
virtual FSlateUpdatableTextureCreateSharedHandleTexture (void *SharedHandle) override
 
virtual void ReleaseUpdatableTexture (FSlateUpdatableTexture *Texture) override
 
virtual ISlateAtlasProviderGetTextureAtlasProvider () override
 
virtual FCriticalSectionGetResourceCriticalSection () override
 
virtual void ReleaseAccessedResources (bool bImmediatelyFlush) override
 
virtual int32 RegisterCurrentScene (FSceneInterface *Scene) override
 
virtual int32 GetCurrentSceneIndex () const override
 
virtual void SetCurrentSceneIndex (int32 InIndex) override
 
virtual void ClearScenes () override
 
EPixelFormat GetSlateRecommendedColorFormat () override
 
virtual void DestroyCachedFastPathRenderingData (struct FSlateCachedFastPathRenderingData *InRenderingData) override
 
virtual void DestroyCachedFastPathElementData (FSlateCachedElementData *InCachedElementData) override
 
virtual void BeginFrame () const override
 
virtual void EndFrame () const override
 
virtual void AddWidgetRendererUpdate (const struct FRenderThreadUpdateContext &Context, bool bDeferredRenderTargetUpdate) override
 
virtual void ReloadTextureResources () override
 
virtual void LoadStyleResources (const ISlateStyle &Style) override
 
virtual bool AreShadersInitialized () const override
 
virtual void InvalidateAllViewports () override
 
virtual void PrepareToTakeScreenshot (const FIntRect &Rect, TArray< FColor > *OutColorData, SWindow *ScreenshotWindow) override
 
virtual void PrepareToTakeHDRScreenshot (const FIntRect &Rect, TArray< FLinearColor > *OutColorData, SWindow *ScreenshotWindow) override
 
- Public Member Functions inherited from FSlateRenderer
SLATECORE_API FSlateRenderer (const TSharedRef< FSlateFontServices > &InSlateFontServices)
 
virtual SLATECORE_API ~FSlateRenderer ()
 
virtual FSlateDrawBufferGetDrawBuffer ()
 
 DECLARE_MULTICAST_DELEGATE_TwoParams (FOnSlateWindowRendered, SWindow &, void *)
 
FOnSlateWindowRenderedOnSlateWindowRendered ()
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FOnSlateWindowDestroyed, void *)
 
FOnSlateWindowDestroyedOnSlateWindowDestroyed ()
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FOnPreResizeWindowBackbuffer, void *)
 
FOnPreResizeWindowBackbufferOnPreResizeWindowBackBuffer ()
 
 DECLARE_MULTICAST_DELEGATE_OneParam (FOnPostResizeWindowBackbuffer, void *)
 
FOnPostResizeWindowBackbufferOnPostResizeWindowBackBuffer ()
 
 DECLARE_TS_MULTICAST_DELEGATE_TwoParams (FOnBackBufferReadyToPresent, SWindow &, const FTextureRHIRef &)
 
FOnBackBufferReadyToPresentOnBackBufferReadyToPresent ()
 
 DECLARE_TS_MULTICAST_DELEGATE_ThreeParams (FOnAddBackBufferReadyToPresentPass, FRDGBuilder &, SWindow &, FRDGTexture *)
 
FOnAddBackBufferReadyToPresentPassOnAddBackBufferReadyToPresentPass ()
 
virtual FSlateResourceHandle GetResourceHandle (const FSlateBrush &Brush)
 
TSharedRef< FSlateFontServicesGetFontServices () const
 
TSharedRef< class FSlateFontMeasureGetFontMeasureService () const
 
TSharedRef< class FSlateFontCacheGetFontCache () const
 
void FlushFontCache (const FString &FlushReason)
 
SLATECORE_API bool IsViewportFullscreen (const SWindow &Window) const
 
virtual void SetWindowRenderTarget (const SWindow &Window, class IViewportRenderTargetProvider *Provider)
 
virtual SLATECORE_API ISlateAtlasProviderGetFontAtlasProvider ()
 
virtual void CopyWindowsToVirtualScreenBuffer (const TArray< FString > &KeypressBuffer)
 
virtual void MapVirtualScreenBuffer (FMappedTextureBuffer *OutImageData)
 
virtual void UnmapVirtualScreenBuffer ()
 
virtual bool HasLostDevice () const
 

Additional Inherited Members

- Protected Attributes inherited from FSlateRenderer
TSharedPtr< FSlateFontServicesSlateFontServices
 
FOnSlateWindowRendered SlateWindowRendered
 
FOnSlateWindowDestroyed OnSlateWindowDestroyedDelegate
 
FOnPreResizeWindowBackbuffer PreResizeBackBufferDelegate
 
FOnPostResizeWindowBackbuffer PostResizeBackBufferDelegate
 
FOnBackBufferReadyToPresent OnBackBufferReadyToPresentDelegate
 
FOnAddBackBufferReadyToPresentPass OnAddBackBufferReadyToPresentPassDelegate
 
FCriticalSection ResourceCriticalSection
 

Detailed Description

A Slate rendering implementation for Unreal engine

Constructor & Destructor Documentation

◆ FSlateRHIRenderer()

FSlateRHIRenderer::FSlateRHIRenderer ( TSharedRef< FSlateFontServices InSlateFontServices,
TSharedRef< FSlateRHIResourceManager InResourceManager 
)

Member Function Documentation

◆ AcquireDrawBuffer()

FSlateDrawBuffer & FSlateRHIRenderer::AcquireDrawBuffer ( )
overridevirtual

Returns a draw buffer that can be used by Slate windows to draw window elements

Implements FSlateRenderer.

◆ AddWidgetRendererUpdate()

void FSlateRHIRenderer::AddWidgetRendererUpdate ( const struct FRenderThreadUpdateContext Context,
bool  bDeferredRenderTargetUpdate 
)
overridevirtual

Lets the renderer know that we need to render some widgets to a render target.

Parameters
ContextThe context that describes what we're rendering to
bDeferredRenderTargetUpdateWhether or not the update is deferred until the end of the frame when it is potentially less expensive to update the render target. See GDeferRetainedRenderingRenderThread for more info. Care must be taken to destroy anything referenced in the context when it is safe to do so.

Reimplemented from FSlateRenderer.

◆ AreShadersInitialized()

bool FSlateRHIRenderer::AreShadersInitialized ( ) const
overridevirtual

Returns whether shaders that Slate depends on have been compiled.

Reimplemented from FSlateRenderer.

◆ BeginFrame()

void FSlateRHIRenderer::BeginFrame ( ) const
overridevirtual

Indicates the start of a new frame to the Renderer. This is usually handled by the engine loop but certain situations (ie, when the main loop is paused) may require manual calls.

Reimplemented from FSlateRenderer.

◆ CanRenderResource()

bool FSlateRHIRenderer::CanRenderResource ( UObject InResourceObject) const
overridevirtual

The default implementation assumes all things are renderable.

Reimplemented from FSlateRenderer.

◆ ClearScenes()

void FSlateRHIRenderer::ClearScenes ( )
overridevirtual

Reset the internal Scene tracking.

Implements FSlateRenderer.

◆ CreateSharedHandleTexture()

FSlateUpdatableTexture * FSlateRHIRenderer::CreateSharedHandleTexture ( void SharedHandle)
overridevirtual

Create an updatable texture that can receive new data via a shared handle

Parameters
SharedHandleThe OS dependant handle that backs the texture data
Returns
Newly created updatable texture

Implements FSlateRenderer.

◆ CreateUpdatableTexture()

FSlateUpdatableTexture * FSlateRHIRenderer::CreateUpdatableTexture ( uint32  Width,
uint32  Height 
)
overridevirtual

Create an updatable texture that can receive new data dynamically

Parameters
WidthInitial width of the texture
HeightInitial height of the texture
Returns
Newly created updatable texture

Implements FSlateRenderer.

◆ CreateViewport()

void FSlateRHIRenderer::CreateViewport ( const TSharedRef< SWindow InWindow)
overridevirtual

Creates a rendering viewport

Parameters
InWindowThe window to create the viewport for

Implements FSlateRenderer.

◆ Destroy()

void FSlateRHIRenderer::Destroy ( )
overridevirtual

Implements FSlateRenderer.

◆ DestroyCachedFastPathElementData()

void FSlateRHIRenderer::DestroyCachedFastPathElementData ( FSlateCachedElementData InCachedElementData)
overridevirtual

Reimplemented from FSlateRenderer.

◆ DestroyCachedFastPathRenderingData()

void FSlateRHIRenderer::DestroyCachedFastPathRenderingData ( struct FSlateCachedFastPathRenderingData InRenderingData)
overridevirtual

Reimplemented from FSlateRenderer.

◆ DrawWindows()

void FSlateRHIRenderer::DrawWindows ( FSlateDrawBuffer InWindowDrawBuffer)
overridevirtual

Creates necessary resources to render a window and sends draw commands to the rendering thread

Parameters
WindowDrawBufferThe buffer containing elements to draw

Implements FSlateRenderer.

◆ EndFrame()

void FSlateRHIRenderer::EndFrame ( ) const
overridevirtual

Indicates the end of the current frame to the Renderer. This is usually handled by the engine loop but certain situations (ie, when the main loop is paused) may require manual calls.

Reimplemented from FSlateRenderer.

◆ FlushCommands()

void FSlateRHIRenderer::FlushCommands ( ) const
overridevirtual

Gives the renderer a chance to wait for any render commands to be completed before returning/

Reimplemented from FSlateRenderer.

◆ GenerateDynamicImageResource() [1/3]

FIntPoint FSlateRHIRenderer::GenerateDynamicImageResource ( const FName  InTextureName)
overridevirtual

Creates a dynamic image resource and returns its size

Parameters
InTextureNameThe name of the texture resource
Returns
The size of the loaded texture

Reimplemented from FSlateRenderer.

◆ GenerateDynamicImageResource() [2/3]

bool FSlateRHIRenderer::GenerateDynamicImageResource ( FName  ResourceName,
FSlateTextureDataRef  TextureData 
)
overridevirtual

Reimplemented from FSlateRenderer.

◆ GenerateDynamicImageResource() [3/3]

bool FSlateRHIRenderer::GenerateDynamicImageResource ( FName  ResourceName,
uint32  Width,
uint32  Height,
const TArray< uint8 > &  Bytes 
)
overridevirtual

Creates a dynamic image resource

Parameters
ResourceNameThe name of the texture resource
WidthThe width of the resource
HeightThe height of the image
BytesThe payload for the resource
Returns
true if the resource was successfully generated, otherwise false

Reimplemented from FSlateRenderer.

◆ GetCurrentSceneIndex()

int32 FSlateRHIRenderer::GetCurrentSceneIndex ( ) const
overridevirtual

Get the currently registered scene index (set by RegisterCurrentScene)

Implements FSlateRenderer.

◆ GetResourceCriticalSection()

FCriticalSection * FSlateRHIRenderer::GetResourceCriticalSection ( )
overridevirtual

Necessary to grab before flushing the resource pool, as it may be being accessed by multiple threads when loading.

Implements FSlateRenderer.

◆ GetResourceHandle()

FSlateResourceHandle FSlateRHIRenderer::GetResourceHandle ( const FSlateBrush Brush,
FVector2f  LocalSize,
float  DrawScale 
)
overridevirtual

Implements FSlateRenderer.

◆ GetSlateRecommendedColorFormat()

EPixelFormat FSlateRHIRenderer::GetSlateRecommendedColorFormat ( )
overridevirtual

Reimplemented from FSlateRenderer.

◆ GetTextureAtlasProvider()

ISlateAtlasProvider * FSlateRHIRenderer::GetTextureAtlasProvider ( )
overridevirtual

Returns the way to access the texture atlas information for this renderer

Reimplemented from FSlateRenderer.

◆ GetViewportResource()

void * FSlateRHIRenderer::GetViewportResource ( const SWindow Window)
overridevirtual

Returns the viewport rendering resource (backbuffer) for the provided window

Parameters
WindowThe window to get the viewport from

Reimplemented from FSlateRenderer.

◆ Initialize()

bool FSlateRHIRenderer::Initialize ( )
overridevirtual

FSlateRenderer interface

Implements FSlateRenderer.

◆ InvalidateAllViewports()

void FSlateRHIRenderer::InvalidateAllViewports ( )
overridevirtual

Removes references to FViewportRHI's.
This has to be done explicitly instead of using the FRenderResource mechanism because FViewportRHI's are managed by the game thread. This is needed before destroying the RHI device.

Reimplemented from FSlateRenderer.

◆ LoadStyleResources()

void FSlateRHIRenderer::LoadStyleResources ( const ISlateStyle Style)
overridevirtual

Loads all the resources used by the specified SlateStyle

Reimplemented from FSlateRenderer.

◆ OnWindowDestroyed()

void FSlateRHIRenderer::OnWindowDestroyed ( const TSharedRef< SWindow > &  InWindow)
overridevirtual

Called when a window is destroyed to give the renderer a chance to free resources

Implements FSlateRenderer.

◆ OnWindowFinishReshaped()

void FSlateRHIRenderer::OnWindowFinishReshaped ( const TSharedPtr< SWindow > &  InWindow)
overridevirtual

Called when a window is finished being reshaped

Reimplemented from FSlateRenderer.

◆ PrepareToTakeHDRScreenshot()

void FSlateRHIRenderer::PrepareToTakeHDRScreenshot ( const FIntRect Rect,
TArray< FLinearColor > *  OutColorData,
SWindow InScreenshotWindow 
)
overridevirtual

Prepares the renderer to take a screenshot of the UI. The Rect is portion of the rendered output that will be stored into the TArray of FColors.

Reimplemented from FSlateRenderer.

◆ PrepareToTakeScreenshot()

void FSlateRHIRenderer::PrepareToTakeScreenshot ( const FIntRect Rect,
TArray< FColor > *  OutColorData,
SWindow InScreenshotWindow 
)
overridevirtual

Prepares the renderer to take a screenshot of the UI. The Rect is portion of the rendered output that will be stored into the TArray of FColors.

Reimplemented from FSlateRenderer.

◆ RegisterCurrentScene()

int32 FSlateRHIRenderer::RegisterCurrentScene ( FSceneInterface Scene)
overridevirtual

Register the active scene pointer with the renderer. This will return the scene internal index that will be used for all subsequent elements drawn.

Implements FSlateRenderer.

◆ ReleaseAccessedResources()

void FSlateRHIRenderer::ReleaseAccessedResources ( bool  bImmediatelyFlush)
overridevirtual

A renderer may need to keep a cache of accessed garbage collectible objects alive for the duration of their usage. During some operations like ending a game. It becomes important to immediately release game related resources. This should flush any buffer holding onto those referenced objects.

Reimplemented from FSlateRenderer.

◆ ReleaseDrawBuffer()

void FSlateRHIRenderer::ReleaseDrawBuffer ( FSlateDrawBuffer InWindowDrawBuffer)
overridevirtual

Return the previously acquired buffer.

Implements FSlateRenderer.

◆ ReleaseDynamicResource()

void FSlateRHIRenderer::ReleaseDynamicResource ( const FSlateBrush Brush)
overridevirtual

Releases a specific resource.
It is unlikely that you want to call this directly. Use RemoveDynamicBrushResource instead

Implements FSlateRenderer.

◆ ReleaseUpdatableTexture()

void FSlateRHIRenderer::ReleaseUpdatableTexture ( FSlateUpdatableTexture Texture)
overridevirtual

Return an updatable texture to the renderer for release

Parameters
TextureThe texture we are releasing (should not use this pointer after calling)

Implements FSlateRenderer.

◆ ReloadTextureResources()

void FSlateRHIRenderer::ReloadTextureResources ( )
overridevirtual

Reloads texture resources from disk

Reimplemented from FSlateRenderer.

◆ RemoveDynamicBrushResource()

void FSlateRHIRenderer::RemoveDynamicBrushResource ( TSharedPtr< FSlateDynamicImageBrush BrushToRemove)
overridevirtual

Queues a dynamic brush for removal when it is safe. The brush is not immediately released but you should consider the brush destroyed and no longer usable

Parameters
BrushToRemoveThe brush to queue for removal which is no longer valid to use

Implements FSlateRenderer.

◆ RequestResize()

void FSlateRHIRenderer::RequestResize ( const TSharedPtr< SWindow > &  InWindow,
uint32  NewSizeX,
uint32  NewSizeY 
)
overridevirtual

Requests that a rendering viewport be resized

Parameters
WindowThe window to resize
WidthThe new width of the window
HeightThe new height of the window

Implements FSlateRenderer.

◆ RestoreSystemResolution()

void FSlateRHIRenderer::RestoreSystemResolution ( const TSharedRef< SWindow InWindow)
overridevirtual

Restore the given window to the resolution settings currently cached by the engine

Parameters
InWindow-> The window to restore to the cached settings

Implements FSlateRenderer.

◆ SetColorVisionDeficiencyType()

void FSlateRHIRenderer::SetColorVisionDeficiencyType ( EColorVisionDeficiency  Type,
int32  Severity,
bool  bCorrectDeficiency,
bool  bShowCorrectionWithDeficiency 
)
overridevirtual

Sets which color vision filter to use

Reimplemented from FSlateRenderer.

◆ SetCurrentSceneIndex()

void FSlateRHIRenderer::SetCurrentSceneIndex ( int32  InIndex)
overridevirtual

Set currently registered scene index

Implements FSlateRenderer.

◆ SetSystemResolution()

void FSlateRHIRenderer::SetSystemResolution ( uint32  Width,
uint32  Height 
)
overridevirtual

Set the resolution cached by the engine

Parameters
WidthWidth of the system resolution
HeightHeight of the system resolution

Implements FSlateRenderer.

◆ Sync()

void FSlateRHIRenderer::Sync ( ) const
overridevirtual

Gives the renderer a chance to synchronize with another thread in the event that the renderer runs in a multi-threaded environment. This function does not return until the sync is complete

Reimplemented from FSlateRenderer.

◆ UpdateFullscreenState()

void FSlateRHIRenderer::UpdateFullscreenState ( const TSharedRef< SWindow InWindow,
uint32  OverrideResX,
uint32  OverrideResY 
)
overridevirtual

Sets fullscreen state on the window's rendering viewport

Parameters
InWindowThe window to update fullscreen state on
OverrideResX0 if no override
OverrideResY0 if no override

Implements FSlateRenderer.

Member Data Documentation

◆ CachedElementData

TArray<FSlateCachedElementData*, FConcurrentLinearArrayAllocator> FSlateRHIRenderer::CachedElementData

◆ CachedFastPathRenderingData

TArray<FSlateCachedFastPathRenderingData*, FConcurrentLinearArrayAllocator> FSlateRHIRenderer::CachedFastPathRenderingData

◆ ColorData

TArray<FColor>* FSlateRHIRenderer::ColorData = nullptr

◆ ColorDataHDR

TArray<FLinearColor>* FSlateRHIRenderer::ColorDataHDR = nullptr

◆ LastUsedFrameCounter

TStaticArray<uint64, (int32)ESlatePostRT::Num> FSlateRHIRenderer::LastUsedFrameCounter { InPlace, 0 }

◆ ViewportToCapture

FSlateViewportInfo* FSlateRHIRenderer::ViewportToCapture = nullptr

◆ ViewRect

FIntRect FSlateRHIRenderer::ViewRect

The documentation for this class was generated from the following files: