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

#include <MetalResources.h>

+ Inheritance diagram for FMetalSurface:

Public Member Functions

 FMetalSurface (FMetalDevice &Device, FMetalTextureCreateDesc const &CreateDesc)
 
virtual ~FMetalSurface ()
 
void Initialize (FRHICommandListBase &RHICmdList)
 
MTL::Buffer * AllocSurface (const FRHILockTextureArgs &Arguments, uint32 MipBytes, uint32 DestStride)
 
void UpdateSurfaceAndDestroySourceBuffer (FMetalRHICommandContext *Context, MTL::Buffer *SourceBuffer, uint32 MipIndex, uint32 ArrayIndex)
 
FRHILockTextureResult Lock (const FRHILockTextureArgs &Arguments, bool bSingleLayer)
 
void Unlock (const FRHILockTextureArgs &Arguments)
 
FRHILockTextureResult AsyncLock (FRHICommandListBase &RHICmdList, const FRHILockTextureArgs &Arguments)
 
uint32 GetMipSize (uint32 MipIndex, uint32 *Stride, bool bSingleLayer)
 
uint32 GetMemorySize ()
 
uint32 GetNumFaces ()
 
MTLTexturePtr GetDrawableTexture ()
 
void ReleaseDrawableTexture ()
 
MTLTexturePtr GetCurrentTexture ()
 
MTLTexturePtr Reallocate (MTLTexturePtr Texture, MTL::TextureUsage UsageModifier)
 
void MakeAliasable (void)
 
virtual voidGetTextureBaseRHI () override final
 
virtual voidGetNativeResource () const override final
 
- Public Member Functions inherited from FRHITexture
virtual const FRHITextureDescGetDesc () const
 
virtual class FRHITextureReferenceGetTextureReference ()
 
virtual FRHIDescriptorHandle GetDefaultBindlessHandle () const
 
virtual voidGetNativeShaderResourceView () const
 
virtual void GetWriteMaskProperties (void *&OutData, uint32 &OutSize)
 
FIntVector GetSizeXYZ () const
 
FIntVector GetMipDimensions (uint8 MipIndex) const
 
bool IsMultisampled () const
 
bool HasClearValue () const
 
FLinearColor GetClearColor () const
 
void GetDepthStencilClearValue (float &OutDepth, uint32 &OutStencil) const
 
float GetDepthClearValue () const
 
uint32 GetStencilClearValue () const
 
void SetLastRenderTime (float InLastRenderTime)
 
double GetLastRenderTime () const
 
RHI_API void SetName (FName InName)
 
FRHITextureGetTexture2D ()
 
FRHITextureGetTexture2DArray ()
 
FRHITextureGetTexture3D ()
 
FRHITextureGetTextureCube ()
 
uint32 GetSizeX () const
 
uint32 GetSizeY () const
 
FIntPoint GetSizeXY () const
 
uint32 GetSizeZ () const
 
uint32 GetNumMips () const
 
EPixelFormat GetFormat () const
 
ETextureCreateFlags GetFlags () const
 
uint32 GetNumSamples () const
 
const FClearValueBinding GetClearBinding () const
 
uint32 GetSize () const
 
- Public Member Functions inherited from FRHIViewableResource
ERHIAccess GetTrackedAccess_Unsafe () const
 
FName GetName () const
 
- Public Member Functions inherited from FRHIResource
RHI_API FRHIResource (ERHIResourceType InResourceType)
 
uint32 AddRef () const
 
uint32 Release () const
 
uint32 GetRefCount () const
 
bool IsValid () const
 
void DisableLifetimeExtension ()
 
ERHIResourceType GetType () const
 
FName GetOwnerName () const
 
void SetOwnerName (FName InOwnerName)
 
- Public Member Functions inherited from FMetalViewableResource
 ~FMetalViewableResource ()
 
bool HasLinkedViews () const
 
void UpdateLinkedViews (FMetalRHICommandContext *Context)
 

Public Attributes

FMetalDeviceDevice
 
uint8 FormatKey
 
MTLTexturePtr Texture
 
MTLTexturePtr MSAATexture
 
MTLTexturePtr MSAAResolveTexture
 
FMetalBufferPtr BackingBuffer
 
class FMetalViewportViewport
 

Protected Member Functions

 FMetalSurface (FMetalDevice &MetalDevice, MTLTexturePtr InTexture, FRHITextureCreateDesc const &CreateDesc)
 
- Protected Member Functions inherited from FRHITexture
 FRHITexture ()=delete
 
RHI_API FRHITexture (const FRHITextureCreateDesc &CreateDesc)
 
RHI_API FRHITexture (ERHIResourceType InResourceType)
 
- Protected Member Functions inherited from FRHIViewableResource
 FRHIViewableResource (ERHIResourceType InResourceType, ERHIAccess InAccess, const TCHAR *InName, FName InOwnerName)
 
virtual void SetTrackedAccessFromContext (FRHITrackedAccess InTrackedAccess)
 
void TakeOwnership (FRHIViewableResource &Other)
 
void ReleaseOwnership ()
 
- Protected Member Functions inherited from FRHIResource
virtual RHI_API ~FRHIResource ()
 

Protected Attributes

uint64 TotalTextureSize
 
- Protected Attributes inherited from FRHIViewableResource
FName Name
 

Constructor & Destructor Documentation

◆ FMetalSurface() [1/2]

FMetalSurface::FMetalSurface ( FMetalDevice Device,
FMetalTextureCreateDesc const &  CreateDesc 
)

Constructor that will create Texture and Color/DepthBuffers as needed

◆ ~FMetalSurface()

FMetalSurface::~FMetalSurface ( )
virtual

Destructor

◆ FMetalSurface() [2/2]

FMetalSurface::FMetalSurface ( FMetalDevice MetalDevice,
MTLTexturePtr  InTexture,
FRHITextureCreateDesc const &  CreateDesc 
)
inlineprotected

Constructor for derived classes

Member Function Documentation

◆ AllocSurface()

MTL::Buffer * FMetalSurface::AllocSurface ( const FRHILockTextureArgs Arguments,
uint32  MipBytes,
uint32  DestStride 
)
Returns
A newly allocated buffer object large enough for the surface within the texture specified.

◆ AsyncLock()

FRHILockTextureResult FMetalSurface::AsyncLock ( FRHICommandListBase RHICmdList,
const FRHILockTextureArgs Arguments 
)

Locks one of the texture's mip-maps.

Parameters
ArrayIndexIndex of the texture array/face in the form Index*6+Face
Returns
A pointer to the specified texture data.

◆ GetCurrentTexture()

MTLTexturePtr FMetalSurface::GetCurrentTexture ( )

◆ GetDrawableTexture()

MTLTexturePtr FMetalSurface::GetDrawableTexture ( )

Gets the drawable texture if this is a back-buffer surface.

◆ GetMemorySize()

uint32 FMetalSurface::GetMemorySize ( )

Returns how much memory is used by the surface

◆ GetMipSize()

uint32 FMetalSurface::GetMipSize ( uint32  MipIndex,
uint32 Stride,
bool  bSingleLayer 
)

Returns how much memory a single mip uses, and optionally returns the stride

◆ GetNativeResource()

virtual void * FMetalSurface::GetNativeResource ( ) const
inlinefinaloverridevirtual

Returns access to the platform-specific native resource pointer. This is designed to be used to provide plugins with access to the underlying resource and should be used very carefully or not at all.

Returns
The pointer to the native resource or NULL if it not initialized or not supported for this resource type for some reason

Reimplemented from FRHITexture.

◆ GetNumFaces()

uint32 FMetalSurface::GetNumFaces ( )

Returns the number of faces for the texture

◆ GetTextureBaseRHI()

virtual void * FMetalSurface::GetTextureBaseRHI ( )
inlinefinaloverridevirtual

Returns access to the platform-specific RHI texture baseclass. This is designed to provide the RHI with fast access to its base classes in the face of multiple inheritance.

Returns
The pointer to the platform-specific RHI texture baseclass or NULL if it not initialized or not supported for this RHI

Reimplemented from FRHITexture.

◆ Initialize()

void FMetalSurface::Initialize ( FRHICommandListBase RHICmdList)

◆ Lock()

FRHILockTextureResult FMetalSurface::Lock ( const FRHILockTextureArgs Arguments,
bool  bSingleLayer 
)

Locks one of the texture's mip-maps.

Parameters
ArrayIndexIndex of the texture array/face in the form Index*6+Face
Returns
A pointer to the specified texture data.

◆ MakeAliasable()

void FMetalSurface::MakeAliasable ( void  )

◆ Reallocate()

MTLTexturePtr FMetalSurface::Reallocate ( MTLTexturePtr  Texture,
MTL::TextureUsage  UsageModifier 
)

◆ ReleaseDrawableTexture()

void FMetalSurface::ReleaseDrawableTexture ( )

◆ Unlock()

void FMetalSurface::Unlock ( const FRHILockTextureArgs Arguments)

Unlocks a previously locked mip-map.

Parameters
ArrayIndexIndex of the texture array/face in the form Index*6+Face

◆ UpdateSurfaceAndDestroySourceBuffer()

void FMetalSurface::UpdateSurfaceAndDestroySourceBuffer ( FMetalRHICommandContext Context,
MTL::Buffer *  SourceBuffer,
uint32  MipIndex,
uint32  ArrayIndex 
)

Apply the data in Buffer to the surface specified. Will also handle destroying SourceBuffer appropriately.

Member Data Documentation

◆ BackingBuffer

FMetalBufferPtr FMetalSurface::BackingBuffer

◆ Device

FMetalDevice& FMetalSurface::Device

◆ FormatKey

uint8 FMetalSurface::FormatKey

◆ MSAAResolveTexture

MTLTexturePtr FMetalSurface::MSAAResolveTexture

◆ MSAATexture

MTLTexturePtr FMetalSurface::MSAATexture

◆ Texture

MTLTexturePtr FMetalSurface::Texture

◆ TotalTextureSize

uint64 FMetalSurface::TotalTextureSize
protected

◆ Viewport

class FMetalViewport* FMetalSurface::Viewport

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