UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSlateTexture2DRHIRef Class Reference

#include <SlateTextures.h>

+ Inheritance diagram for FSlateTexture2DRHIRef:

Public Member Functions

ENGINE_API FSlateTexture2DRHIRef (FTextureRHIRef InRef, uint32 InWidth, uint32 InHeight)
 
ENGINE_API FSlateTexture2DRHIRef (uint32 InWidth, uint32 InHeight, EPixelFormat InPixelFormat, TSharedPtr< FSlateTextureData, ESPMode::ThreadSafe > InTextureData, ETextureCreateFlags InTexCreateFlags=TexCreate_None, bool bCreateEmptyTexture=false)
 
virtual ENGINE_API ~FSlateTexture2DRHIRef ()
 
virtual ENGINE_API void Cleanup () override
 
virtual uint32 GetWidth () const override
 
virtual uint32 GetHeight () const override
 
virtual ENGINE_API void InitRHI (FRHICommandListBase &RHICmdList) override
 
virtual ENGINE_API void ReleaseRHI () override
 
ENGINE_API void Resize (uint32 Width, uint32 Height)
 
bool IsValid () const
 
ENGINE_API void SetRHIRef (FTextureRHIRef InRenderTargetTexture, uint32 InWidth, uint32 InHeight)
 
FTextureRHIRef GetRHIRef () const
 
ENGINE_API void SetTextureData (FSlateTextureDataPtr NewTextureData)
 
ENGINE_API void SetTextureData (FSlateTextureDataPtr NewTextureData, EPixelFormat InPixelFormat, ETextureCreateFlags InTexCreateFlags)
 
ENGINE_API void ClearTextureData ()
 
EPixelFormat GetPixelFormat () const
 
virtual FSlateShaderResourceGetSlateResource () override
 
virtual FRenderResourceGetRenderResource () override
 
virtual ENGINE_API void ResizeTexture (uint32 Width, uint32 Height) override
 
virtual ENGINE_API void UpdateTexture (const TArray< uint8 > &Bytes) override
 
virtual ENGINE_API void UpdateTextureThreadSafe (const TArray< uint8 > &Bytes) override
 
virtual ENGINE_API void UpdateTextureThreadSafeRaw (uint32 Width, uint32 Height, const void *Buffer, const FIntRect &Dirty) override
 
virtual ENGINE_API void UpdateTextureThreadSafeWithTextureData (FSlateTextureData *BulkData) override
 
virtual void UpdateTextureThreadSafeWithKeyedTextureHandle (void *TextureHandle, int KeyLockVal, int KeyUnlockVal, const FIntRect &Dirty=FIntRect()) override
 
- Public Member Functions inherited from TSlateTexture< FTextureRHIRef >
 TSlateTexture ()
 
 TSlateTexture (FTextureRHIRef &InShaderResource)
 
virtual ~TSlateTexture ()
 
FTextureRHIRefGetTypedResource ()
 
virtual ESlateShaderResource::Type GetType () const override
 
- Public Member Functions inherited from FSlateShaderResource
virtual bool IsResourceValid () const
 
virtual ESlatePostRT GetUsedSlatePostBuffers () const
 
virtual bool RequiresVirtualTextureFeedback () const
 
void CheckForStaleResources () const
 
bool Debug_IsDestroyed () const
 
virtual ~FSlateShaderResource ()=default
 
- Public Member Functions inherited from FSlateUpdatableTexture
virtual ~FSlateUpdatableTexture ()
 
- Public Member Functions inherited from FDeferredCleanupInterface
virtual ~FDeferredCleanupInterface ()
 
- Public Member Functions inherited from FRenderResource
RENDERCORE_API FRenderResource ()
 
RENDERCORE_API FRenderResource (ERHIFeatureLevel::Type InFeatureLevel)
 
RENDERCORE_API FRenderResource (const FRenderResource &)
 
RENDERCORE_API FRenderResource (FRenderResource &&)
 
RENDERCORE_API FRenderResourceoperator= (const FRenderResource &Other)
 
RENDERCORE_API FRenderResourceoperator= (FRenderResource &&Other)
 
virtual RENDERCORE_API ~FRenderResource ()
 
virtual RENDERCORE_API void InitResource (FRHICommandListBase &RHICmdList)
 
virtual RENDERCORE_API void ReleaseResource ()
 
RENDERCORE_API void UpdateRHI (FRHICommandListBase &RHICmdList)
 
virtual FString GetFriendlyName () const
 
bool IsInitialized () const
 
int32 GetListIndex () const
 
EInitPhase GetInitPhase () const
 
void SetOwnerName (FName InOwnerName)
 
FName GetOwnerName () const
 
void SetResourceName (FName InResourceName)
 
FName GetResourceName () const
 

Protected Attributes

uint32 Width
 
uint32 Height
 
- Protected Attributes inherited from TSlateTexture< FTextureRHIRef >
FTextureRHIRef ShaderResource
 

Additional Inherited Members

- Public Types inherited from FRenderResource
enum class  EInitPhase : uint8 { Pre , Default , MAX }
 
- Static Public Member Functions inherited from FRenderResource
static RENDERCORE_API void ReleaseRHIForAllResources ()
 
static RENDERCORE_API void InitPreRHIResources ()
 
static RENDERCORE_API void ChangeFeatureLevel (ERHIFeatureLevel::Type NewFeatureLevel)
 
static RENDERCORE_API FName SetScopeName (FName Name)
 
- Public Attributes inherited from FRenderResource
ERenderResourceState ResourceState = ERenderResourceState::Default
 
- Protected Member Functions inherited from FRenderResource
void SetFeatureLevel (const FStaticFeatureLevel InFeatureLevel)
 
const FStaticFeatureLevel GetFeatureLevel () const
 
bool HasValidFeatureLevel () const
 
template<typename T >
FBufferRHIRef CreateRHIBuffer (FRHICommandListBase &RHICmdList, T &InOutResourceObject, uint32 ResourceCount, EBufferUsageFlags InBufferUsageFlags, const TCHAR *InDebugName)
 
void SetInitPhase (EInitPhase InInitPhase)
 
- Static Protected Member Functions inherited from FRenderResource
static RENDERCORE_API FRHICommandListBaseGetImmediateCommandList ()
 

Detailed Description

Encapsulates a Texture2DRHIRef for use by a Slate rendering implementation

Constructor & Destructor Documentation

◆ FSlateTexture2DRHIRef() [1/2]

FSlateTexture2DRHIRef::FSlateTexture2DRHIRef ( FTextureRHIRef  InRef,
uint32  InWidth,
uint32  InHeight 
)

◆ FSlateTexture2DRHIRef() [2/2]

FSlateTexture2DRHIRef::FSlateTexture2DRHIRef ( uint32  InWidth,
uint32  InHeight,
EPixelFormat  InPixelFormat,
TSharedPtr< FSlateTextureData, ESPMode::ThreadSafe InTextureData,
ETextureCreateFlags  InTexCreateFlags = TexCreate_None,
bool  bCreateEmptyTexture = false 
)

◆ ~FSlateTexture2DRHIRef()

FSlateTexture2DRHIRef::~FSlateTexture2DRHIRef ( )
virtual

Member Function Documentation

◆ Cleanup()

void FSlateTexture2DRHIRef::Cleanup ( )
overridevirtual

Deferred or Immediate cleanup of this data depending on what is required.

Implements FSlateUpdatableTexture.

◆ ClearTextureData()

void FSlateTexture2DRHIRef::ClearTextureData ( )

Clears texture data being used. Can only be accessed on the render thread

◆ GetHeight()

virtual uint32 FSlateTexture2DRHIRef::GetHeight ( ) const
inlineoverridevirtual

Gets the height of the resource.

Returns
Resource height(in pixels).

Implements FSlateShaderResource.

◆ GetPixelFormat()

EPixelFormat FSlateTexture2DRHIRef::GetPixelFormat ( ) const
inline

Returns the pixel format of this texture

◆ GetRenderResource()

virtual FRenderResource * FSlateTexture2DRHIRef::GetRenderResource ( )
inlineoverridevirtual

Gets the interface to the underlying render resource (may not always be used)

Returns
FRenderResource* pointer to the render resource

Reimplemented from FSlateUpdatableTexture.

◆ GetRHIRef()

FTextureRHIRef FSlateTexture2DRHIRef::GetRHIRef ( ) const
inline

◆ GetSlateResource()

virtual FSlateShaderResource * FSlateTexture2DRHIRef::GetSlateResource ( )
inlineoverridevirtual

Gets the interface to the underlying platform independent texture

Returns
FSlateShaderResource* pointer to the shader resource

Implements FSlateUpdatableTexture.

◆ GetWidth()

virtual uint32 FSlateTexture2DRHIRef::GetWidth ( ) const
inlineoverridevirtual

Gets the width of the resource.

Returns
Resource width (in pixels).

Implements FSlateShaderResource.

◆ InitRHI()

void FSlateTexture2DRHIRef::InitRHI ( FRHICommandListBase RHICmdList)
overridevirtual

FRenderResource Interface. Called when render resources need to be initialized

Reimplemented from FRenderResource.

◆ IsValid()

bool FSlateTexture2DRHIRef::IsValid ( ) const
inline
Returns
true if the texture is valid

◆ ReleaseRHI()

void FSlateTexture2DRHIRef::ReleaseRHI ( )
overridevirtual

FRenderResource Interface. Called when render resources need to be released

Reimplemented from FRenderResource.

◆ Resize()

void FSlateTexture2DRHIRef::Resize ( uint32  Width,
uint32  Height 
)

Resize the texture. Can only be called on the render thread

◆ ResizeTexture()

void FSlateTexture2DRHIRef::ResizeTexture ( uint32  Width,
uint32  Height 
)
overridevirtual

Resize the texture.

Parameters
WidthNew texture width
HeightNew texture height

Implements FSlateUpdatableTexture.

◆ SetRHIRef()

void FSlateTexture2DRHIRef::SetRHIRef ( FTextureRHIRef  InRenderTargetTexture,
uint32  InWidth,
uint32  InHeight 
)

Sets the RHI Ref to use.

◆ SetTextureData() [1/2]

void FSlateTexture2DRHIRef::SetTextureData ( FSlateTextureDataPtr  NewTextureData)

Sets the bulk data for this texture. Note: Does not reinitialize the resource, Can only be used on the render thread

Parameters
NewTextureDataThe new bulk data

◆ SetTextureData() [2/2]

void FSlateTexture2DRHIRef::SetTextureData ( FSlateTextureDataPtr  NewTextureData,
EPixelFormat  InPixelFormat,
ETextureCreateFlags  InTexCreateFlags 
)

Sets the bulk data for this texture and the format of the rendering resource Note: Does not reinitialize the resource. Can only be used on the render thread

Parameters
NewTextureDataThe new texture data
InPixelFormatThe format of the texture data
InTexCreateFlagsFlags for creating the rendering resource

◆ UpdateTexture()

void FSlateTexture2DRHIRef::UpdateTexture ( const TArray< uint8 > &  Bytes)
overridevirtual

Updates the texture contents via a byte array. Note: This method is not thread safe so make sure you do not use the Bytes data on another after it is passed in

Parameters
BytesArray of texture data

Implements FSlateUpdatableTexture.

◆ UpdateTextureThreadSafe()

void FSlateTexture2DRHIRef::UpdateTextureThreadSafe ( const TArray< uint8 > &  Bytes)
overridevirtual

Updates the texture contents via a byte array making a copy first for thread safety

Parameters
BytesArray of texture data

Implements FSlateUpdatableTexture.

◆ UpdateTextureThreadSafeRaw()

void FSlateTexture2DRHIRef::UpdateTextureThreadSafeRaw ( uint32  Width,
uint32  Height,
const void Buffer,
const FIntRect Dirty 
)
overridevirtual

Update the texture from a raw byte buffer. Should only be used when integrating with third party APIs that provide a raw pointer to texture data. This method does a copy of the buffer for thread safety. Will resize the texture if the passed in width and height is different from the current size. The passed in size must correspond to the size of the buffer and the data must be valid for the entire texture, even when passing in a Dirty rectangle, as the implementation may chose to copy a larger area than specified. The RHI renderer currently ignores the Dirty argument completely.

Parameters
WidthNew texture width
HeightNew texture height
BufferA void pointer to a byte buffer.
DirtyAn optional hint of the area to update. An empty rectangle means that the entire texture should be updated.

Implements FSlateUpdatableTexture.

◆ UpdateTextureThreadSafeWithKeyedTextureHandle()

virtual void FSlateTexture2DRHIRef::UpdateTextureThreadSafeWithKeyedTextureHandle ( void TextureHandle,
int  KeyLockVal,
int  KeyUnlockVal,
const FIntRect Dirty = FIntRect() 
)
inlineoverridevirtual

Update the texture from a shared texture handle. The handle type/usage is render system dependent, D3D uses the D3D11 OpenSharedResource call On macOS we use an IOSurface.

Parameters
TextureHandleA pointer to the opque texture handle provided by the OS.
DirtyAn optional hint of the area to update. An empty rectangle means that the entire texture should be updated.

Implements FSlateUpdatableTexture.

◆ UpdateTextureThreadSafeWithTextureData()

void FSlateTexture2DRHIRef::UpdateTextureThreadSafeWithTextureData ( FSlateTextureData TextureData)
overridevirtual

Update the texture from a provided FSlateTextureData buffer, also transferring ownership of the texture

Parameters
TextureDataA pointer to the provided FSlateTextureData.

NOTE: This function transfers ownership of the FSlateTextureData object. It will be deleted once the texture is used

Implements FSlateUpdatableTexture.

Member Data Documentation

◆ Height

uint32 FSlateTexture2DRHIRef::Height
protected

Height of this texture

◆ Width

uint32 FSlateTexture2DRHIRef::Width
protected

Width of this texture


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