- UE 5.3
- XCode
I want to include /Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h
into my C++ based project. Hence I added MetalRHI
in my Build.cs file as below.
PrivateDependencyModuleNames.AddRange(new string[] { "MetalRHI"});
Now this header file can be found, but it internally depends on mtlpp.hpp
which is a third-party C++ wrapper of MetalAPI
#include "MetalResources.h"
Hence I added mtlpp
into PrivateDependencyModuleNames as well.
PrivateDependencyModuleNames.AddRange(new string[] { "MetalRHI", "mtlpp" });
Now there are a lot of compliation errors. how to include MetalResources.h from MetalRHI?
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:268:10 conversion from 'const FMetalTexture' to 'void *' is ambiguous
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:327:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:424:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:435:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:469:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:551:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:619:10 unknown type name 'FMetalSamplerState'; did you mean 'FRHISamplerState'?
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:624:10 unknown type name 'FMetalRasterizerState'; did you mean 'FRHIRasterizerState'?
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:629:10 unknown type name 'FMetalDepthStencilState'; did you mean 'FRHIDepthStencilState'?
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:634:10 unknown type name 'FMetalBlendState'; did you mean 'FRHIBlendState'?
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:656:5 'METAL_RHI_RAYTRACING' is not defined, evaluates to 0 [-Werror,-Wundef]
Then I changed the include part of code to
#define METAL_RHI_RAYTRACING 0
#include "MetalState.h"
#include "MetalResources.h"
Now only one error is left
/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h:268:10 conversion from 'const FMetalTexture' to 'void *' is ambiguous
It is from UE’s header file of this [line].
(https://github.com/EpicGames/UnrealEngine/blob/072300df18a94f18077ca20a14224b5d99fee872/Engine/Source/Runtime/Apple/MetalRHI/Public/MetalResources.h#L268).
Thanks in advance