From df81fa11fc8972a5775a57ccde1e0ef8d7fbfe64 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:39:25 +0800 Subject: [PATCH 1/7] CMakeLists: Use imported version of Threads::Threads This requires bumping up to a minimum of CMake 3.1. The benefit of using the imported target is that you can switch to the -pthread compiler flag on request, which may be necessary for some systems if available. --- CMakeLists.txt | 8 +++++--- src/citra/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddde197606..019321ad89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ -# CMake 2.8.11 required for Qt5 settings to be applied automatically on -# dependent libraries. -cmake_minimum_required(VERSION 2.8.11) +# CMake 3.1 required for Qt5 settings to be applied automatically on +# dependent libraries and IMPORTED targets. +cmake_minimum_required(VERSION 3.1) function(download_bundled_external remote_path lib_name prefix_var) set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}") @@ -135,6 +135,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") find_package(OpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIR}) +# Prefer the -pthread flag on Linux. +set (THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) if (ENABLE_SDL2) diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 351752c1c8..43fa06b4ed 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(citra ${SDL2_LIBRARY} ${OPENGL_gl_LIBRARY} inih glad) if (MSVC) target_link_libraries(citra getopt) endif() -target_link_libraries(citra ${PLATFORM_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(citra ${PLATFORM_LIBRARIES} Threads::Threads) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") From ef6873980eb3854d351c319514fca4116165283c Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:40:14 +0800 Subject: [PATCH 2/7] assert: Allow UNREACHABLE_MSG to have just one argument --- src/common/assert.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/assert.h b/src/common/assert.h index d7f19f5eb6..cd9b819a97 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -39,7 +39,7 @@ static void assert_noinline_call(const Fn& fn) { }); } while (0) #define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") -#define UNREACHABLE_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__) +#define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__) #ifdef _DEBUG #define DEBUG_ASSERT(_a_) ASSERT(_a_) From e16541e47c657923ad5dedd64560afd0902cdda2 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:40:41 +0800 Subject: [PATCH 3/7] am: title_id is long long uint --- src/core/hle/service/am/am.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 9591522e54..3f71e7f2b2 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -43,7 +43,7 @@ void FindContentInfos(Service::Interface* self) { am_content_count[media_type] = cmd_buff[4]; cmd_buff[1] = RESULT_SUCCESS.raw; - LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, title_id=0x%016lx, content_cound=%u, content_ids_pointer=0x%08x, content_info_pointer=0x%08x", + LOG_WARNING(Service_AM, "(STUBBED) media_type=%u, title_id=0x%016llx, content_cound=%u, content_ids_pointer=0x%08x, content_info_pointer=0x%08x", media_type, title_id, am_content_count[media_type], content_ids_pointer, content_info_pointer); } From bbffa6ad6945f2ea91a61dc7ab45c0fd814fcf82 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:40:52 +0800 Subject: [PATCH 4/7] shader: Format string must be provided inline and not as a variable --- src/video_core/shader/shader_jit_x64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index b47d3beda6..d5a6a349cd 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -148,7 +148,7 @@ static Instruction GetVertexShaderInstruction(size_t offset) { } static void LogCritical(const char* msg) { - LOG_CRITICAL(HW_GPU, msg); + LOG_CRITICAL(HW_GPU, "%s", msg); } void JitShader::Compile_Assert(bool condition, const char* msg) { From c6709d97bce27f248b78374a531a3ee01275c65d Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:41:25 +0800 Subject: [PATCH 5/7] shader: Handle non-CALL opcodes with a break --- src/video_core/shader/shader_jit_x64.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index d5a6a349cd..9ee4065bf9 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -795,6 +795,8 @@ void JitShader::FindReturnOffsets() { case OpCode::Id::CALLU: return_offsets.push_back(instr.flow_control.dest_offset + instr.flow_control.num_instructions); break; + default: + break; } } From 656a4424332824c144ef5b91482ee2a8d89fc0fb Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Sun, 24 Apr 2016 23:41:44 +0800 Subject: [PATCH 6/7] shader: Shader size is long uint, not uint. --- src/video_core/shader/shader_jit_x64.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index 9ee4065bf9..b7747fa42d 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -856,7 +856,7 @@ void JitShader::Compile() { uintptr_t size = reinterpret_cast(GetCodePtr()) - reinterpret_cast(program); ASSERT_MSG(size <= MAX_SHADER_SIZE, "Compiled a shader that exceeds the allocated size!"); - LOG_DEBUG(HW_GPU, "Compiled shader size=%d", size); + LOG_DEBUG(HW_GPU, "Compiled shader size=%lu", size); } JitShader::JitShader() { From 599dc2bbb5e7325b9baa8d55ef17915dd283173d Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Mon, 25 Apr 2016 09:40:12 +0800 Subject: [PATCH 7/7] travis: Install cmake 3.1 --- .travis-deps.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis-deps.sh b/.travis-deps.sh index c7bb7e7857..4a79feb705 100755 --- a/.travis-deps.sh +++ b/.travis-deps.sh @@ -9,7 +9,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then export CXX=g++-5 mkdir -p $HOME/.local - curl -L http://www.cmake.org/files/v2.8/cmake-2.8.11-Linux-i386.tar.gz \ + curl -L http://www.cmake.org/files/v3.1/cmake-3.1.0-Linux-i386.tar.gz \ | tar -xz -C $HOME/.local --strip-components=1 ( @@ -20,6 +20,7 @@ if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then ) elif [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update > /dev/null # silence the very verbose output - brew install qt5 sdl2 dylibbundler + brew unlink cmake + brew install cmake31 qt5 sdl2 dylibbundler gem install xcpretty fi