diff --git a/CMakeModules/DuckStationBuildOptions.cmake b/CMakeModules/DuckStationBuildOptions.cmake index a89fefce8..19b8d2a6f 100644 --- a/CMakeModules/DuckStationBuildOptions.cmake +++ b/CMakeModules/DuckStationBuildOptions.cmake @@ -5,6 +5,7 @@ option(BUILD_NOGUI_FRONTEND "Build the NoGUI frontend" OFF) option(BUILD_QT_FRONTEND "Build the Qt frontend" ON) option(BUILD_REGTEST "Build regression test runner" OFF) option(BUILD_TESTS "Build unit tests" OFF) +option(DISABLE_SSE4 "Build with SSE4 instructions disabled, reduces performance" OFF) if(LINUX OR BSD) option(ENABLE_X11 "Support X11 window system" ON) diff --git a/CMakeModules/DuckStationBuildSummary.cmake b/CMakeModules/DuckStationBuildSummary.cmake index a2e91e8b7..69d0d17fc 100644 --- a/CMakeModules/DuckStationBuildSummary.cmake +++ b/CMakeModules/DuckStationBuildSummary.cmake @@ -38,8 +38,7 @@ It does **not** use the LSB subdirectories of bin, share, etc, so you should dis endif() if(NOT IS_SUPPORTED_COMPILER) - message(WARNING " -*************** UNSUPPORTED CONFIGURATION *************** + message(WARNING "*************** UNSUPPORTED CONFIGURATION *************** You are not compiling DuckStation with a supported compiler. It may not even build successfully. DuckStation only supports the Clang and MSVC compilers. @@ -48,11 +47,18 @@ No support will be provided, continue at your own risk. endif() if(WIN32) - message(WARNING " -*************** UNSUPPORTED CONFIGURATION *************** + message(WARNING "*************** UNSUPPORTED CONFIGURATION *************** You are compiling DuckStation with CMake on Windows. It may not even build successfully. DuckStation only supports MSBuild on Windows. No support will be provided, continue at your own risk. *********************************************************") endif() + +if(CPU_ARCH_X64 AND DISABLE_SSE4) + message(WARNING "*********************** WARNING *********************** +SSE4 instructions are disabled. This will result in +reduced performance. You should not enable this option +unless you have a pre-2008 CPU. +*******************************************************") +endif() diff --git a/CMakeModules/DuckStationUtils.cmake b/CMakeModules/DuckStationUtils.cmake index bd6d1add7..f0e810b28 100644 --- a/CMakeModules/DuckStationUtils.cmake +++ b/CMakeModules/DuckStationUtils.cmake @@ -69,7 +69,7 @@ function(detect_architecture) CMAKE_SIZEOF_VOID_P EQUAL 8) message(STATUS "Building x86_64 binaries.") set(CPU_ARCH_X64 TRUE PARENT_SCOPE) - if(NOT MSVC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if(NOT MSVC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT DISABLE_SSE4) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse4.1" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1" PARENT_SCOPE) endif() diff --git a/src/core/system.cpp b/src/core/system.cpp index 38e182c40..800463b88 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -357,17 +357,19 @@ bool System::Internal::PerformEarlyHardwareChecks(Error* error) #ifdef CPU_ARCH_SSE41 if (!cpuinfo_has_x86_sse4_1()) { - Error::SetStringFmt(error, "Your CPU does not support the SSE4.1 instruction set, which is required for this " - "version of DuckStation.\nPlease download and switch to the legacy SSE2 version.\nYou " - "can download this from https://www.duckstation.org/ under \"Other Platforms\"."); + Error::SetStringFmt( + error, "

Your CPU does not support the SSE4.1 instruction set.

SSE4.1 is required for this version of " + "DuckStation. Please download and switch to the legacy SSE2 version.

You can download this from www.duckstation.org under \"Other Platforms\"."); return false; } #else if (cpuinfo_has_x86_sse4_1()) { - Error::SetStringFmt(error, "You are running the legacy SSE2 DuckStation executable on a CPU that supports the " - "SSE4.1 instruction set.\nPlease download and switch the regular, non-SSE2 " - "version.\nYou can download this from https://www.duckstation.org/."); + Error::SetStringFmt( + error, "You are running the legacy SSE2 DuckStation executable on a CPU that supports the " + "SSE4.1 instruction set.\nPlease download and switch to the regular, non-SSE2 version.\nYou can download " + "this from www.duckstation.org."); } #endif #endif diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index bb8ed0930..0a4a68a12 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -2550,13 +2550,14 @@ int main(int argc, char* argv[]) CrashHandler::Install(&Bus::CleanupMemoryMap); QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); - QtHost::RegisterTypes(); QApplication app(argc, argv); - if (!QtHost::PerformEarlyHardwareChecks()) return EXIT_FAILURE; + // Type registration has to happen after hardware checks, clang emits ptest instructions otherwise. + QtHost::RegisterTypes(); + std::shared_ptr autoboot; if (!QtHost::ParseCommandLineParametersAndInitializeConfig(app, autoboot)) return EXIT_FAILURE;