From 8b6e22473e070044d9464627626115d45e692e9c Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 31 Jan 2023 14:31:17 +0100 Subject: [PATCH] Fix clang-cl compile errors Unfortunately clang-cl doesn't support __FUNCTION__ macro concat. Some SSE stuff in mathlib/navmesh rendering also needs to be made portable at some point. --- r5dev/codecs/Miles/miles_impl.cpp | 8 ++++---- r5dev/engine/host_state.cpp | 18 +++++++++--------- r5dev/mathlib/ssemath.h | 16 ++++++++-------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/r5dev/codecs/Miles/miles_impl.cpp b/r5dev/codecs/Miles/miles_impl.cpp index de373ef7..d6ae2055 100644 --- a/r5dev/codecs/Miles/miles_impl.cpp +++ b/r5dev/codecs/Miles/miles_impl.cpp @@ -19,12 +19,12 @@ void AIL_LogFunc(int64_t nLogLevel, const char* pszMessage) //----------------------------------------------------------------------------- bool Miles_Initialize() { - DevMsg(eDLL_T::AUDIO, __FUNCTION__": initializing Miles Sound System\n"); + DevMsg(eDLL_T::AUDIO, "%s: initializing Miles Sound System\n", __FUNCTION__); bool bResult = v_Miles_Initialize(); - bResult ? DevMsg(eDLL_T::AUDIO, __FUNCTION__": %s\n", "initialized successfully") - : Warning(eDLL_T::AUDIO, __FUNCTION__": %s\n", "failed to initialize"); + bResult ? DevMsg(eDLL_T::AUDIO, "%s: %s\n", __FUNCTION__, "initialized successfully") + : Warning(eDLL_T::AUDIO, "%s: %s\n", __FUNCTION__, "failed to initialize"); return bResult; } @@ -32,7 +32,7 @@ bool Miles_Initialize() void MilesQueueEventRun(Miles::Queue* queue, const char* eventName) { if(miles_debug->GetBool()) - DevMsg(eDLL_T::AUDIO, __FUNCTION__": running event '%s'\n", eventName); + DevMsg(eDLL_T::AUDIO, "%s: running event '%s'\n", __FUNCTION__, eventName); v_MilesQueueEventRun(queue, eventName); } diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 74f1011d..3b5e79ec 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -139,13 +139,13 @@ FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurren } case HostStates_t::HS_GAME_SHUTDOWN: { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Shutdown host game\n"); + DevMsg(eDLL_T::ENGINE, "%s: Shutdown host game\n", __FUNCTION__); CHostState_State_GameShutDown(g_pHostState); break; } case HostStates_t::HS_RESTART: { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Restarting state machine\n"); + DevMsg(eDLL_T::ENGINE, "%s: Restarting state machine\n", __FUNCTION__); #ifndef DEDICATED CL_EndMovie(); #endif // !DEDICATED @@ -155,7 +155,7 @@ FORCEINLINE void CHostState::FrameUpdate(CHostState* pHostState, double flCurren } case HostStates_t::HS_SHUTDOWN: { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Shutdown state machine\n"); + DevMsg(eDLL_T::ENGINE, "%s: Shutdown state machine\n", __FUNCTION__); #ifndef DEDICATED CL_EndMovie(); #endif // !DEDICATED @@ -357,7 +357,7 @@ FORCEINLINE void CHostState::GameShutDown(void) //----------------------------------------------------------------------------- FORCEINLINE void CHostState::State_NewGame(void) { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Loading level: '%s'\n", g_pHostState->m_levelName); + DevMsg(eDLL_T::ENGINE, "%s: Loading level: '%s'\n", __FUNCTION__, g_pHostState->m_levelName); LARGE_INTEGER time{}; uint16_t nSplitScreenPlayers = m_nSplitScreenPlayers; @@ -373,7 +373,7 @@ FORCEINLINE void CHostState::State_NewGame(void) if (!CModelLoader__Map_IsValid(g_pModelLoader, m_levelName) // Check if map is valid and if we can start a new game. || !Host_NewGame(m_levelName, nullptr, m_bBackgroundLevel, nSplitScreenPlayers, time) || !g_pServerGameClients) { - Error(eDLL_T::ENGINE, NO_ERROR, __FUNCTION__": Error: Level not valid\n"); + Error(eDLL_T::ENGINE, NO_ERROR, "%s: Error: Level not valid\n", __FUNCTION__); #ifndef DEDICATED SCR_EndLoadingPlaque(); #endif // !DEDICATED @@ -395,7 +395,7 @@ FORCEINLINE void CHostState::State_NewGame(void) //----------------------------------------------------------------------------- FORCEINLINE void CHostState::State_ChangeLevelSP(void) { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Changing singleplayer level to: '%s'\n", m_levelName); + DevMsg(eDLL_T::ENGINE, "%s: Changing singleplayer level to: '%s'\n", __FUNCTION__, m_levelName); m_flShortFrameTime = 1.5; // Set frame time. if (CModelLoader__Map_IsValid(g_pModelLoader, m_levelName)) // Check if map is valid and if we can start a new game. @@ -404,7 +404,7 @@ FORCEINLINE void CHostState::State_ChangeLevelSP(void) } else { - Error(eDLL_T::ENGINE, NO_ERROR, __FUNCTION__": Error: Unable to find level: '%s'\n", m_levelName); + Error(eDLL_T::ENGINE, NO_ERROR, "%s: Error: unable to find level: '%s'\n", __FUNCTION__, m_levelName); } m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run. @@ -421,7 +421,7 @@ FORCEINLINE void CHostState::State_ChangeLevelSP(void) //----------------------------------------------------------------------------- FORCEINLINE void CHostState::State_ChangeLevelMP(void) { - DevMsg(eDLL_T::ENGINE, __FUNCTION__": Changing multiplayer level to: '%s'\n", m_levelName); + DevMsg(eDLL_T::ENGINE, "%s: Changing multiplayer level to: '%s'\n", __FUNCTION__, m_levelName); m_flShortFrameTime = 0.5; // Set frame time. #ifndef CLIENT_DLL @@ -436,7 +436,7 @@ FORCEINLINE void CHostState::State_ChangeLevelMP(void) } else { - Error(eDLL_T::ENGINE, NO_ERROR, __FUNCTION__": Error: Unable to find level: '%s'\n", m_levelName); + Error(eDLL_T::ENGINE, NO_ERROR, "%s: Error: unable to find level: '%s'\n", __FUNCTION__, m_levelName); } m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run. diff --git a/r5dev/mathlib/ssemath.h b/r5dev/mathlib/ssemath.h index 0bf4d751..c36e624b 100644 --- a/r5dev/mathlib/ssemath.h +++ b/r5dev/mathlib/ssemath.h @@ -941,7 +941,7 @@ FORCEINLINE void StoreAligned3SIMD(VectorAligned* RESTRICT pSIMD, const fltx4& a // pDestination[0], pDestination[1], pDestination[2], pDestination[3] // The Vectors are assumed to be unaligned. FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { StoreUnaligned3SIMD(pDestination->Base(), a); StoreUnaligned3SIMD((pDestination + 1)->Base(), b); @@ -955,7 +955,7 @@ FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 // The Vectors are assumed to start on an ALIGNED address, that is, // pDestination is 16-byte aligned (though obviously pDestination+1 is not). FORCEINLINE void StoreFourAlignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { StoreUnaligned3SIMD(pDestination->Base(), a); StoreUnaligned3SIMD((pDestination + 1)->Base(), b); @@ -1975,7 +1975,7 @@ FORCEINLINE fltx4 LoadGatherSIMD(const float& x, const float& y, const float& z, // pDestination[0], pDestination[1], pDestination[2], pDestination[3] // The Vectors are assumed to be unaligned. FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { StoreUnaligned3SIMD(pDestination->Base(), a); StoreUnaligned3SIMD((pDestination + 1)->Base(), b); @@ -1989,7 +1989,7 @@ FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 // The Vectors are assumed to start on an ALIGNED address, that is, // pDestination is 16-byte aligned (though obviously pDestination+1 is not). FORCEINLINE void StoreFourAlignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { StoreUnaligned3SIMD(pDestination->Base(), a); StoreUnaligned3SIMD((pDestination + 1)->Base(), b); @@ -3029,7 +3029,7 @@ FORCEINLINE void StoreAligned3SIMD(VectorAligned* RESTRICT pSIMD, const fltx4& a // pDestination[0], pDestination[1], pDestination[2], pDestination[3] // The Vectors are assumed to be unaligned. FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { // since four Vec3s == 48 bytes, we can use full-vector stores here, so long as // we arrange the data properly first. @@ -3054,7 +3054,7 @@ FORCEINLINE void StoreFourUnalignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 // The Vectors are assumed to start on an ALIGNED address, that is, // pDestination is 16-byte aligned (though obviously pDestination+1 is not). FORCEINLINE void StoreFourAlignedVector3SIMD(fltx4 a, fltx4 b, fltx4 c, FLTX4 d, // first three passed by copy (deliberate) - Vector* const pDestination) + Vector3D* const pDestination) { // since four Vec3s == 48 bytes, we can use full-vector stores here, so long as // we arrange the data properly first. @@ -4986,7 +4986,7 @@ public: } #if !defined(__SPU__) - /// Store a FourVectors into four NON-CONTIGUOUS Vector*'s. + /// Store a FourVectors into four NON-CONTIGUOUS Vector3D*'s. FORCEINLINE void StoreUnalignedVector3SIMD(Vector3D* RESTRICT out0, Vector3D* RESTRICT out1, Vector3D* RESTRICT out2, Vector3D* RESTRICT out3) const; #endif @@ -5299,7 +5299,7 @@ FORCEINLINE FourVectors VectorNormalizeFast(const FourVectors& src) } #if !defined(__SPU__) -/// Store a FourVectors into four NON-CONTIGUOUS Vector*'s. +/// Store a FourVectors into four NON-CONTIGUOUS Vector3D*'s. FORCEINLINE void FourVectors::StoreUnalignedVector3SIMD(Vector3D* RESTRICT out0, Vector3D* RESTRICT out1, Vector3D* RESTRICT out2, Vector3D* RESTRICT out3) const { #ifdef _X360