diff --git a/CMakeLists.txt b/CMakeLists.txt index a47fe8af..b001421d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,15 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) if (MSVC) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CemuBin) # floating point model: precise, fiber safe optimizations - add_compile_options(/EHsc /fp:precise /GT) + add_compile_options(/EHsc /fp:precise) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # Speeds up static linking (especially helpful in incremental compilation) + if((CMAKE_LINKER MATCHES ".*lld-link.*") AND (CMAKE_AR MATCHES ".*llvm-lib.*")) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY STATIC_LIBRARY_OPTIONS /llvmlibthin) + endif() + else() + add_compile_options(/GT) + endif() if (PUBLIC_RELEASE) message(STATUS "Using additional optimization flags for MSVC") add_compile_options(/Oi /Ot) # enable intrinsic functions, favor speed diff --git a/dependencies/DirectX_2010/XAudio2.h b/dependencies/DirectX_2010/XAudio2.h index db0ebd8f..a42c0afc 100644 --- a/dependencies/DirectX_2010/XAudio2.h +++ b/dependencies/DirectX_2010/XAudio2.h @@ -48,10 +48,15 @@ //DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e); // XAudio 2.7 (June 2010 SDK) +#ifdef __clang__ +class __declspec(uuid("5a508685-a254-4fba-9b82-9a24b00306af")) XAudio2; extern "C" const GUID CLSID_XAudio2; +class __declspec(uuid("db05ea35-0329-4d4b-a53a-6dead03d3852")) XAudio2_Debug; extern "C" const GUID CLSID_XAudio2_Debug; +struct __declspec(uuid("8bcf1f58-9fe7-4583-8ac6-e2adc465c8bb")) IXAudio2; extern "C" const GUID IID_IXAudio2; +#else DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); DEFINE_CLSID(XAudio2_Debug, db05ea35, 0329, 4d4b, a5, 3a, 6d, ea, d0, 3d, 38, 52); DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); - +#endif // Ignore the rest of this header if only the GUID definitions were requested #ifndef GUID_DEFS_ONLY diff --git a/dependencies/ih264d/common/x86/ih264_platform_macros.h b/dependencies/ih264d/common/x86/ih264_platform_macros.h index 0b15cf5a..ebc1b106 100644 --- a/dependencies/ih264d/common/x86/ih264_platform_macros.h +++ b/dependencies/ih264d/common/x86/ih264_platform_macros.h @@ -40,6 +40,9 @@ #include #include +#if defined(_MSC_VER) && defined(__clang__) +#include +#endif #define CLIP_U8(x) CLIP3(0, UINT8_MAX, (x)) #define CLIP_S8(x) CLIP3(INT8_MIN, INT8_MAX, (x)) @@ -71,7 +74,7 @@ /* For MSVC x64 */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) static inline int __builtin_clz(unsigned x) { diff --git a/src/Cafe/HW/Espresso/PPCTimer.cpp b/src/Cafe/HW/Espresso/PPCTimer.cpp index bcf1a58d..2a1a7669 100644 --- a/src/Cafe/HW/Espresso/PPCTimer.cpp +++ b/src/Cafe/HW/Espresso/PPCTimer.cpp @@ -110,7 +110,8 @@ uint64 PPCTimer_tscToMicroseconds(uint64 us) uint64 remainder; -#if _MSC_VER < 1923 + +#if _MSC_VER < 1923 || defined(__clang__) const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder); #else const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder); @@ -158,7 +159,7 @@ uint64 PPCTimer_getFromRDTSC() #endif uint64 remainder; -#if _MSC_VER < 1923 +#if _MSC_VER < 1923 || defined(__clang__) uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder); #else uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder); diff --git a/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp b/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp index 151f0661..2caa2cd0 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp @@ -145,7 +145,7 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture) bool isCompressedFormat = hostTexture->IsCompressedFormat(); if( isCompressedFormat == false ) { - #if BOOST_OS_WINDOWS +#if BOOST_OS_WINDOWS if (_cpuExtension_AVX2) { __m256i h256 = { 0 }; @@ -157,7 +157,11 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture) readPtr += (288 / 32); h256 = _mm256_xor_si256(h256, temp); } +#ifdef __clang__ + hashVal = h256[0] + h256[1] + h256[2] + h256[3] + h256[4] + h256[5] + h256[6] + h256[7]; +#else hashVal = h256.m256i_u32[0] + h256.m256i_u32[1] + h256.m256i_u32[2] + h256.m256i_u32[3] + h256.m256i_u32[4] + h256.m256i_u32[5] + h256.m256i_u32[6] + h256.m256i_u32[7]; +#endif } #else if( false ) {} diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp index 80c72918..269f30e8 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp @@ -378,7 +378,7 @@ void OpenGLRenderer::GetVendorInformation() forceLog_printf("GL_RENDERER: %s", glRendererString ? glRendererString : "unknown"); forceLog_printf("GL_VERSION: %s", glVersionString ? glVersionString : "unknown"); - if(boost::icontains(glVersionString, "Mesa") || IsRunningInWine()) + if(boost::icontains(glVersionString, "Mesa")) { m_vendor = GfxVendor::Mesa; return; diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index e033d954..7c81a3c9 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -197,7 +197,9 @@ void VulkanRenderer::DetermineVendor() break; } - if (IsRunningInWine()) + VkDriverId driverId = driverProperties.driverID; + + if(driverId == VK_DRIVER_ID_MESA_RADV || driverId == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA) m_vendor = GfxVendor::Mesa; forceLog_printf("Using GPU: %s", properties.properties.deviceName); @@ -216,7 +218,7 @@ void VulkanRenderer::DetermineVendor() else { forceLog_printf("Driver version (as stored in device info): %08X", properties.properties.driverVersion); - + if(m_vendor == GfxVendor::Nvidia) { // if the driver does not support the extension, diff --git a/src/resource/cemu.rc b/src/resource/cemu.rc index 4781111d..aaa2a850 100644 Binary files a/src/resource/cemu.rc and b/src/resource/cemu.rc differ