UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MetalLLM.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "MetalRHIPrivate.h"
7#include "Apple/AppleLLM.h"
8#include "RHICoreStats.h"
9
10class FMetalBuffer;
12
13@interface FMetalDeallocHandler : FApplePlatformObject<NSObject>
14{
18-(void)dealloc;
19@end
20
21#if ENABLE_LOW_LEVEL_MEM_TRACKER
22
23#define LLM_SCOPE_METAL(Tag) LLM_SCOPE((ELLMTag)Tag)
24#define LLM_PLATFORM_SCOPE_METAL(Tag) LLM_PLATFORM_SCOPE((ELLMTag)Tag)
25
26enum class ELLMTagMetal : LLM_TAG_TYPE
27{
28 Buffers = (LLM_TAG_TYPE)ELLMTagApple::AppleMetalTagsStart,
30 Heaps,
31 RenderTargets,
32 AccelerationStructures,
33
34 Count
35};
36
37static_assert((int32)ELLMTagMetal::Count <= (int32)ELLMTagApple::AppleMetalTagsEnd, "too many ELLMTagMetal tags. Need to increase LLM_TAG_APPLE_NUM_METAL_TAGS_RESERVED");
38
39namespace MetalLLM
40{
41 void Initialise();
42}
43
44#else
45
46#define LLM_SCOPE_METAL(...)
47#define LLM_PLATFORM_SCOPE_METAL(...)
49#endif // #if ENABLE_LOW_LEVEL_MEM_TRACKER
50
51class FMetalDevice;
52// These work without the LLM module
53namespace MetalLLM
55 void LogAllocTexture(MTL::Texture* Texture);
56 void LogFreeTexture(MTL::Texture* Texture);
57 void LogAllocBufferNative(MTL::Buffer* Buffer);
58 void LogFreeBufferNative(MTL::Buffer* Buffer);
59 void LogAllocHeap(MTL::Heap* Heap);
60
61 void LogAliasTexture(MTL::Texture* Texture);
62}
63
64namespace MetalBufferStats
66 void UpdateBufferStats(const FRHIBufferDesc& BufferDesc, int64 BufferSize, bool bAllocating);
67 void UpdateUniformBufferStats(int64 BufferSize, bool bAllocating);
68}
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
TSharedPtr< FMetalBuffer, ESPMode::ThreadSafe > FMetalBufferPtr
Definition MetalLLM.h:11
Definition ApplePlatformMemory.cpp:106
Definition MetalResources.h:54
Definition MetalLLM.cpp:57
dispatch_block_t Block
Definition MetalLLM.h:16
Definition MetalDevice.h:102
Definition SharedPointer.h:692
void Initialise(bool wait_for_connect=false)
Definition MetalLLM.h:66
void UpdateBufferStats(const FRHIBufferDesc &BufferDesc, int64 BufferSize, bool bAllocating)
Definition MetalLLM.cpp:259
void UpdateUniformBufferStats(int64 BufferSize, bool bAllocating)
Definition MetalLLM.cpp:264
Definition MetalLLM.h:55
void LogFreeBufferNative(MTL::Buffer *Buffer)
Definition MetalLLM.cpp:215
void LogAllocBufferNative(MTL::Buffer *Buffer)
Definition MetalLLM.cpp:203
void LogAliasTexture(MTL::Texture *Texture)
Definition MetalLLM.cpp:254
void LogAllocTexture(MTL::Texture *Texture)
Definition MetalLLM.cpp:151
void LogAllocHeap(MTL::Heap *Heap)
Definition MetalLLM.cpp:227
void LogFreeTexture(MTL::Texture *Texture)
Definition MetalLLM.cpp:177
Definition RHIResources.h:1321