UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MetalCompiledShaderCache.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 MetalCompiledShaderCache.h: Metal RHI Compiled Shader Cache.
5=============================================================================*/
6
7#pragma once
8
10#include "Misc/ScopeRWLock.h"
11#include "MetalRHIPrivate.h"
12
14{
15public:
17 {
18 // VOID
19 }
20
22 {
23 // VOID
24 }
25
27 {
28 FRWScopeLock ScopedLock(Lock, SLT_ReadOnly);
29 MTLFunctionPtr Func = Cache.FindRef(Key);
30 return Func;
31 }
32
34 {
35 FRWScopeLock ScopedLock(Lock, SLT_ReadOnly);
36 MTLLibraryPtr Lib = LibCache.FindRef(Function->functionType());
37 return Lib;
38 }
39
41 {
42 FRWScopeLock ScopedLock(Lock, SLT_Write);
43 if (Cache.FindRef(Key).get() == nullptr)
44 {
45 Cache.Add(Key, Function);
46 LibCache.Add(Function->functionType(), Lib);
47 }
48 }
49
50private:
51 FRWLock Lock;
54};
55
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
FMetalCompiledShaderCache & GetMetalCompiledShaderCache()
Definition MetalCompiledShaderCache.cpp:11
@ SLT_ReadOnly
Definition ScopeRWLock.h:138
@ SLT_Write
Definition ScopeRWLock.h:139
Definition ScopeRWLock.h:199
Definition UnrealString.h.inl:34
Definition CriticalSection.h:14
Definition MetalCompiledShaderCache.h:14
FMetalCompiledShaderCache()
Definition MetalCompiledShaderCache.h:16
MTLFunctionPtr FindRef(FMetalCompiledShaderKey const &Key)
Definition MetalCompiledShaderCache.h:26
~FMetalCompiledShaderCache()
Definition MetalCompiledShaderCache.h:21
void Add(FMetalCompiledShaderKey Key, MTLLibraryPtr Lib, MTLFunctionPtr Function)
Definition MetalCompiledShaderCache.h:40
MTLLibraryPtr FindLibrary(MTLFunctionPtr Function)
Definition MetalCompiledShaderCache.h:33
Definition MetalCompiledShaderKey.h:13