From 483e8770013b78cd0a5b76b709d5a1495f2437a6 Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Wed, 4 Oct 2023 22:32:43 +0100 Subject: [PATCH 1/3] externals: allow users to use system JSON headers (nlohmann-json3) (#7042) --- CMakeLists.txt | 1 + externals/CMakeLists.txt | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e27b1caf1..67f380bc23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)" option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF) option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF) option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF) +option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of the bundled one)" OFF) if (CITRA_USE_PRECOMPILED_HEADERS) message(STATUS "Using Precompiled Headers.") diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 7e3a0e7d7d..5a2548bcaf 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -175,7 +175,16 @@ endif() # JSON add_library(json-headers INTERFACE) -target_include_directories(json-headers INTERFACE ./json) +if (USE_SYSTEM_JSON) + find_package(nlohmann_json REQUIRED) + target_link_libraries(json-headers INTERFACE nlohmann_json::nlohmann_json) + get_target_property(NLOHMANN_PREFIX nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES) + # The nlohmann-json3 package expects "#include " + # Citra uses "#include " so we have to add this manually + target_include_directories(json-headers SYSTEM INTERFACE "${NLOHMANN_PREFIX}/nlohmann") +else() + target_include_directories(json-headers SYSTEM INTERFACE ./json) +endif() # OpenSSL if (USE_SYSTEM_OPENSSL) From 053b3618dc654e65bfa3f4d158a4322b74ae6dbe Mon Sep 17 00:00:00 2001 From: SachinVin <26602104+SachinVin@users.noreply.github.com> Date: Thu, 5 Oct 2023 22:58:26 +0530 Subject: [PATCH 2/3] Android: gl_shader_decompiler.cpp: get rid of the not-so-accurate multiplication (#7011) --- .../shader/generator/glsl_shader_decompiler.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/video_core/shader/generator/glsl_shader_decompiler.cpp b/src/video_core/shader/generator/glsl_shader_decompiler.cpp index ee012589b0..4c8dffd64b 100644 --- a/src/video_core/shader/generator/glsl_shader_decompiler.cpp +++ b/src/video_core/shader/generator/glsl_shader_decompiler.cpp @@ -828,13 +828,6 @@ private: void Generate() { if (sanitize_mul) { -#ifdef ANDROID - // Use a cheaper sanitize_mul on Android, as mobile GPUs struggle here - // This seems to be sufficient at least for Ocarina of Time and Attack on Titan accurate - // multiplication bugs - shader.AddLine( - "#define sanitize_mul(lhs, rhs) mix(lhs * rhs, vec4(0.0), isnan(lhs * rhs))"); -#else shader.AddLine("vec4 sanitize_mul(vec4 lhs, vec4 rhs) {{"); ++shader.scope; shader.AddLine("vec4 product = lhs * rhs;"); @@ -842,7 +835,6 @@ private: "isnan(lhs)), isnan(product));"); --shader.scope; shader.AddLine("}}\n"); -#endif } shader.AddLine("vec4 get_offset_register(int base_index, int offset) {{"); From 7931aac3b72d08edad9b164dded06ed7bea56aac Mon Sep 17 00:00:00 2001 From: Castor215 <132155746+Castor215@users.noreply.github.com> Date: Fri, 6 Oct 2023 00:41:07 +0100 Subject: [PATCH 3/3] externals: require cpp-httplib >= 0.14.1 (#7043) --- externals/CMakeLists.txt | 9 +++++++-- externals/cmake-modules/FindCppHttp.cmake | 10 ++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 5a2548bcaf..9f50bbc73d 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -209,8 +209,13 @@ endif() # httplib add_library(httplib INTERFACE) if(USE_SYSTEM_CPP_HTTPLIB) - find_package(CppHttp REQUIRED) - target_link_libraries(httplib INTERFACE cpp-httplib::cpp-httplib) + find_package(CppHttp 0.14.1) + if(CppHttp_FOUND) + target_link_libraries(httplib INTERFACE cpp-httplib::cpp-httplib) + else() + message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...") + target_include_directories(httplib INTERFACE ./httplib) + endif() else() target_include_directories(httplib INTERFACE ./httplib) endif() diff --git a/externals/cmake-modules/FindCppHttp.cmake b/externals/cmake-modules/FindCppHttp.cmake index b91cc9f6e1..fe17c8babf 100644 --- a/externals/cmake-modules/FindCppHttp.cmake +++ b/externals/cmake-modules/FindCppHttp.cmake @@ -14,14 +14,8 @@ if(NOT CppHttp_FOUND) /usr/lib /usr/local/lib ) - - if(CPP-HTTP_INCLUDE_DIR AND CPP-HTTP_LIBRARIES) - set(CppHttp_FOUND TRUE CACHE INTERNAL "cpp-httplib found") - message(STATUS "Found cpp-httplib: ${CPP-HTTP_INCLUDE_DIR}, ${CPP-HTTP_LIBRARIES}") - else() - set(CppHttp_FOUND FALSE CACHE INTERNAL "cpp-httplib found") - message(STATUS "Cpp-httplib not found.") - endif() + + find_package_handle_standard_args(CppHttp REQUIRED_VARS CPP-HTTP_INCLUDE_DIR CPP-HTTP_LIBRARIES VERSION_VAR HTTP_TMP_VERSION) endif()