UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MetalRHIPrivate.h File Reference
#include "MetalRHI.h"
#include "MetalThirdParty.h"
#include "PixelFormat.h"
#include "RHICommandList.h"
#include "RHIGlobals.h"

Go to the source code of this file.

Classes

struct  FMetalBufferFormat
 
struct  TMetalResourceTraits< T >
 

Macros

#define METAL_USE_METAL_SHADER_CONVERTER   PLATFORM_SUPPORTS_BINDLESS_RENDERING
 
#define METAL_RHI_RAYTRACING   (METAL_USE_METAL_SHADER_CONVERTER)
 
#define BUFFER_CACHE_MODE   MTL::ResourceCPUCacheModeDefaultCache
 
#define BUFFER_MANAGED_MEM   0
 
#define BUFFER_STORAGE_MODE   MTL::StorageModeShared
 
#define BUFFER_RESOURCE_STORAGE_MANAGED   MTL::ResourceStorageModeShared
 
#define BUFFER_DYNAMIC_REALLOC   BUF_AnyDynamic
 
#define METAL_SUPPORTS_INDIRECT_ARGUMENT_BUFFERS   1
 
#define METAL_SUPPORTS_CAPTURE_MANAGER   1
 
#define METAL_SUPPORTS_TILE_SHADERS   1
 
#define METAL_DEBUG_OPTIONS   !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
 
#define METAL_DEBUG_OPTION(Code)   Code
 
#define ENABLE_METAL_GPUEVENTS_IN_TEST   0
 
#define ENABLE_METAL_GPUEVENTS   (UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT || (UE_BUILD_TEST && ENABLE_METAL_GPUEVENTS_IN_TEST))
 
#define ENABLE_METAL_GPUPROFILE   (ENABLE_METAL_GPUEVENTS && 1)
 
#define METAL_GPUPROFILE(Code)
 
#define UNREAL_TO_METAL_BUFFER_INDEX(Index)   ((MaxMetalStreams - 1) - Index)
 
#define METAL_TO_UNREAL_BUFFER_INDEX(Index)   ((MaxMetalStreams - 1) - Index)
 
#define METAL_NEW_NONNULL_DECL   (__clang_major__ >= 9)
 
#define METAL_FATAL_ERROR(Format, ...)   UE_LOG(LogMetal, Fatal, Format, __VA_ARGS__)
 
#define METAL_FATAL_ASSERT(Condition, Format, ...)   if (!(Condition)) { METAL_FATAL_ERROR(Format, __VA_ARGS__); }
 
#define METAL_IGNORED(Func)
 
#define NOT_SUPPORTED(Func)   UE_LOG(LogMetal, Fatal, TEXT("'%s' is not supported"), TEXT(Func));
 

Enumerations

enum  EMTLTextureType { EMTLTextureTypeCubeArray = 6 }
 
enum  EMetalShaderStages { Vertex , Pixel , Compute , Num }
 

Functions

 DECLARE_LOG_CATEGORY_EXTERN (LogMetal, Display, All)
 
 DECLARE_DELEGATE_OneParam (FMetalCommandBufferCompletionHandler, MTL::CommandBuffer *)
 
FORCEINLINE bool IsMetalBindlessEnabled ()
 
FMetalSurfaceGetMetalSurfaceFromRHITexture (FRHITexture *Texture)
 
FORCEINLINE bool MetalIsSafeToUseRHIThreadResources ()
 
FORCEINLINE int32 GetMetalCubeFace (ECubeFace Face)
 
FORCEINLINE MTL::LoadAction GetMetalRTLoadAction (ERenderTargetLoadAction LoadAction)
 
MTL::PrimitiveType TranslatePrimitiveType (uint32 PrimitiveType)
 
MTL::PixelFormat UEToMetalFormat (FMetalDevice &Device, EPixelFormat UEFormat, bool bSRGB)
 
uint8 GetMetalPixelFormatKey (MTL::PixelFormat Format)
 
MTL::LanguageVersion ValidateVersion (uint32 Version)
 
FORCEINLINE EShaderFrequency GetRHIShaderFrequency (EMetalShaderStages Stage)
 
FORCEINLINE EMetalShaderStages GetMetalShaderFrequency (EShaderFrequency Stage)
 
FORCEINLINE FString NSStringToFString (NS::String *InputString)
 
FORCEINLINE NS::StringFStringToNSString (const FString &InputString)
 
bool ShouldUseMemoryless (ETextureCreateFlags Flags)
 
bool AllowMSAA ()
 

Variables

bool GIsMetalInitialized
 
const uint32 BufferOffsetAlignment = 16
 
const uint32 BufferBackedLinearTextureOffsetAlignment = 64
 
const uint32 MetalBufferPageSize = 4096
 
const uint32 MetalBufferBytesSize = BufferOffsetAlignment * 32
 
const uint32 MaxMetalStreams = 30
 
bool GMetalSupportsCaptureManager
 
FMetalBufferFormat GMetalBufferFormats [PF_MAX]
 
bool GMetalCommandBufferDebuggingEnabled
 

Macro Definition Documentation

◆ BUFFER_CACHE_MODE

◆ BUFFER_DYNAMIC_REALLOC

#define BUFFER_DYNAMIC_REALLOC   BUF_AnyDynamic

◆ BUFFER_MANAGED_MEM

#define BUFFER_MANAGED_MEM   0

◆ BUFFER_RESOURCE_STORAGE_MANAGED

#define BUFFER_RESOURCE_STORAGE_MANAGED   MTL::ResourceStorageModeShared

◆ BUFFER_STORAGE_MODE

#define BUFFER_STORAGE_MODE   MTL::StorageModeShared

◆ ENABLE_METAL_GPUEVENTS

◆ ENABLE_METAL_GPUEVENTS_IN_TEST

#define ENABLE_METAL_GPUEVENTS_IN_TEST   0

Set to 1 to enable GPU events in Xcode frame debugger

◆ ENABLE_METAL_GPUPROFILE

#define ENABLE_METAL_GPUPROFILE   (ENABLE_METAL_GPUEVENTS && 1)

◆ METAL_DEBUG_OPTION

#define METAL_DEBUG_OPTION (   Code)    Code

◆ METAL_DEBUG_OPTIONS

#define METAL_DEBUG_OPTIONS   !(UE_BUILD_SHIPPING || UE_BUILD_TEST)

◆ METAL_FATAL_ASSERT

#define METAL_FATAL_ASSERT (   Condition,
  Format,
  ... 
)    if (!(Condition)) { METAL_FATAL_ERROR(Format, __VA_ARGS__); }

◆ METAL_FATAL_ERROR

#define METAL_FATAL_ERROR (   Format,
  ... 
)    UE_LOG(LogMetal, Fatal, Format, __VA_ARGS__)

◆ METAL_GPUPROFILE

#define METAL_GPUPROFILE (   Code)

◆ METAL_IGNORED

#define METAL_IGNORED (   Func)

◆ METAL_NEW_NONNULL_DECL

#define METAL_NEW_NONNULL_DECL   (__clang_major__ >= 9)

◆ METAL_RHI_RAYTRACING

#define METAL_RHI_RAYTRACING   (METAL_USE_METAL_SHADER_CONVERTER)

◆ METAL_SUPPORTS_CAPTURE_MANAGER

#define METAL_SUPPORTS_CAPTURE_MANAGER   1

◆ METAL_SUPPORTS_INDIRECT_ARGUMENT_BUFFERS

#define METAL_SUPPORTS_INDIRECT_ARGUMENT_BUFFERS   1

◆ METAL_SUPPORTS_TILE_SHADERS

#define METAL_SUPPORTS_TILE_SHADERS   1

◆ METAL_TO_UNREAL_BUFFER_INDEX

#define METAL_TO_UNREAL_BUFFER_INDEX (   Index)    ((MaxMetalStreams - 1) - Index)

◆ METAL_USE_METAL_SHADER_CONVERTER

#define METAL_USE_METAL_SHADER_CONVERTER   PLATFORM_SUPPORTS_BINDLESS_RENDERING

◆ NOT_SUPPORTED

#define NOT_SUPPORTED (   Func)    UE_LOG(LogMetal, Fatal, TEXT("'%s' is not supported"), TEXT(Func));

◆ UNREAL_TO_METAL_BUFFER_INDEX

#define UNREAL_TO_METAL_BUFFER_INDEX (   Index)    ((MaxMetalStreams - 1) - Index)

Enumeration Type Documentation

◆ EMetalShaderStages

Enumerator
Vertex 
Pixel 
Compute 
Num 

◆ EMTLTextureType

Enumerator
EMTLTextureTypeCubeArray 

Function Documentation

◆ AllowMSAA()

bool AllowMSAA ( )

◆ DECLARE_DELEGATE_OneParam()

DECLARE_DELEGATE_OneParam ( FMetalCommandBufferCompletionHandler  ,
MTL::CommandBuffer *   
)

◆ DECLARE_LOG_CATEGORY_EXTERN()

DECLARE_LOG_CATEGORY_EXTERN ( LogMetal  ,
Display  ,
All   
)

◆ FStringToNSString()

FORCEINLINE NS::String * FStringToNSString ( const FString &  InputString)

◆ GetMetalCubeFace()

FORCEINLINE int32 GetMetalCubeFace ( ECubeFace  Face)

◆ GetMetalPixelFormatKey()

uint8 GetMetalPixelFormatKey ( MTL::PixelFormat  Format)

◆ GetMetalRTLoadAction()

FORCEINLINE MTL::LoadAction GetMetalRTLoadAction ( ERenderTargetLoadAction  LoadAction)

◆ GetMetalShaderFrequency()

FORCEINLINE EMetalShaderStages GetMetalShaderFrequency ( EShaderFrequency  Stage)

◆ GetMetalSurfaceFromRHITexture()

FMetalSurface * GetMetalSurfaceFromRHITexture ( FRHITexture Texture)

Given a pointer to a RHI texture that was created by the Metal RHI, returns a pointer to the FMetalTextureBase it encapsulates.

◆ GetRHIShaderFrequency()

FORCEINLINE EShaderFrequency GetRHIShaderFrequency ( EMetalShaderStages  Stage)

◆ IsMetalBindlessEnabled()

FORCEINLINE bool IsMetalBindlessEnabled ( )

◆ MetalIsSafeToUseRHIThreadResources()

FORCEINLINE bool MetalIsSafeToUseRHIThreadResources ( )

◆ NSStringToFString()

FORCEINLINE FString NSStringToFString ( NS::String InputString)

◆ ShouldUseMemoryless()

bool ShouldUseMemoryless ( ETextureCreateFlags  Flags)

◆ TranslatePrimitiveType()

MTL::PrimitiveType TranslatePrimitiveType ( uint32  PrimitiveType)

◆ UEToMetalFormat()

MTL::PixelFormat UEToMetalFormat ( FMetalDevice Device,
EPixelFormat  UEFormat,
bool  bSRGB 
)

◆ ValidateVersion()

MTL::LanguageVersion ValidateVersion ( uint32  Version)

Variable Documentation

◆ BufferBackedLinearTextureOffsetAlignment

const uint32 BufferBackedLinearTextureOffsetAlignment = 64

◆ BufferOffsetAlignment

const uint32 BufferOffsetAlignment = 16

◆ GIsMetalInitialized

bool GIsMetalInitialized
extern

◆ GMetalBufferFormats

FMetalBufferFormat GMetalBufferFormats[PF_MAX]
extern

◆ GMetalCommandBufferDebuggingEnabled

bool GMetalCommandBufferDebuggingEnabled
extern

◆ GMetalSupportsCaptureManager

bool GMetalSupportsCaptureManager
extern

◆ MaxMetalStreams

const uint32 MaxMetalStreams = 30

◆ MetalBufferBytesSize

const uint32 MetalBufferBytesSize = BufferOffsetAlignment * 32

◆ MetalBufferPageSize

const uint32 MetalBufferPageSize = 4096