mirror of
https://github.com/citra-emu/citra-canary.git
synced 2024-12-23 17:15:38 +00:00
Merge pull request #6240 from Steveice10/universal
ci: Generate universal macOS build.
This commit is contained in:
commit
e60a816d89
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
export Qt5_DIR=$(brew --prefix)/opt/qt5
|
|
||||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||||
# ccache configurations
|
# ccache configurations
|
||||||
export CCACHE_CPP2=yes
|
export CCACHE_CPP2=yes
|
||||||
|
@ -16,13 +15,17 @@ export ASM="clang"
|
||||||
ccache -s
|
ccache -s
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
|
# TODO: CryptoPP and LibreSSL ASM disabled due to platform detection issues in build.
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
|
||||||
-DENABLE_QT_TRANSLATION=ON \
|
-DENABLE_QT_TRANSLATION=ON \
|
||||||
-DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
|
-DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \
|
||||||
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
|
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
|
||||||
-DUSE_DISCORD_PRESENCE=ON \
|
-DUSE_DISCORD_PRESENCE=ON \
|
||||||
-DENABLE_FFMPEG_AUDIO_DECODER=ON \
|
-DENABLE_FFMPEG_AUDIO_DECODER=ON \
|
||||||
-DENABLE_FFMPEG_VIDEO_DUMPER=ON \
|
-DENABLE_FFMPEG_VIDEO_DUMPER=ON \
|
||||||
|
-DCRYPTOPP_OPT_DISABLE_ASM=ON \
|
||||||
|
-DENABLE_ASM=OFF \
|
||||||
-GNinja
|
-GNinja
|
||||||
ninja
|
ninja
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
|
|
||||||
brew update
|
brew install ccache ninja || true
|
||||||
brew unlink python@2 || true
|
|
||||||
rm '/usr/local/bin/2to3' || true
|
|
||||||
brew install qt5 p7zip ccache ninja || true
|
|
||||||
pip3 install macpack
|
pip3 install macpack
|
||||||
|
|
||||||
export SDL_VER=2.0.16
|
export FFMPEG_VER=5.1
|
||||||
export FFMPEG_VER=4.4
|
export QT_VER=5.15.8
|
||||||
|
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cd tmp/
|
cd tmp/
|
||||||
|
|
||||||
# install SDL
|
|
||||||
wget https://github.com/SachinVin/ext-macos-bin/raw/main/sdl2/sdl-${SDL_VER}.7z
|
|
||||||
7z x sdl-${SDL_VER}.7z
|
|
||||||
cp -rv $(pwd)/sdl-${SDL_VER}/* /
|
|
||||||
|
|
||||||
# install FFMPEG
|
# install FFMPEG
|
||||||
wget https://github.com/SachinVin/ext-macos-bin/raw/main/ffmpeg/ffmpeg-${FFMPEG_VER}.7z
|
wget https://github.com/SachinVin/ext-macos-bin/raw/main/ffmpeg/ffmpeg-${FFMPEG_VER}.7z
|
||||||
7z x ffmpeg-${FFMPEG_VER}.7z
|
7z x ffmpeg-${FFMPEG_VER}.7z
|
||||||
cp -rv $(pwd)/ffmpeg-${FFMPEG_VER}/* /
|
cp -rv $(pwd)/ffmpeg-${FFMPEG_VER}/* /
|
||||||
|
|
||||||
|
# install Qt
|
||||||
|
wget https://github.com/SachinVin/ext-macos-bin/raw/main/qt/qt-${QT_VER}.7z
|
||||||
|
7z x qt-${QT_VER}.7z
|
||||||
|
sudo cp -rv $(pwd)/qt-${QT_VER}/* /usr/local/
|
||||||
|
|
|
@ -15,7 +15,7 @@ cp build/bin/Release/citra-room "$REV_NAME"
|
||||||
# move libs into folder for deployment
|
# move libs into folder for deployment
|
||||||
macpack "${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt" -d "../Frameworks"
|
macpack "${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt" -d "../Frameworks"
|
||||||
# move qt frameworks into app bundle for deployment
|
# move qt frameworks into app bundle for deployment
|
||||||
$(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" -executable="${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt"
|
macdeployqt "${REV_NAME}/citra-qt.app" -executable="${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt"
|
||||||
|
|
||||||
# move libs into folder for deployment
|
# move libs into folder for deployment
|
||||||
macpack "${REV_NAME}/citra" -d "libs"
|
macpack "${REV_NAME}/citra" -d "libs"
|
||||||
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -12,7 +12,7 @@
|
||||||
url = https://github.com/catchorg/Catch2
|
url = https://github.com/catchorg/Catch2
|
||||||
[submodule "dynarmic"]
|
[submodule "dynarmic"]
|
||||||
path = externals/dynarmic
|
path = externals/dynarmic
|
||||||
url = https://github.com/citra-emu/dynarmic.git
|
url = https://github.com/merryhime/dynarmic.git
|
||||||
[submodule "xbyak"]
|
[submodule "xbyak"]
|
||||||
path = externals/xbyak
|
path = externals/xbyak
|
||||||
url = https://github.com/herumi/xbyak.git
|
url = https://github.com/herumi/xbyak.git
|
||||||
|
|
|
@ -146,14 +146,14 @@ function(detect_architecture symbol arch)
|
||||||
# CMake's crazy scope rules will keep it defined
|
# CMake's crazy scope rules will keep it defined
|
||||||
if (ARCHITECTURE_${arch})
|
if (ARCHITECTURE_${arch})
|
||||||
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
set(ARCHITECTURE "${arch}" PARENT_SCOPE)
|
||||||
set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
|
|
||||||
add_definitions(-DARCHITECTURE_${arch}=1)
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if (NOT ENABLE_GENERIC)
|
if (NOT ENABLE_GENERIC)
|
||||||
if (MSVC)
|
if (CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(ARCHITECTURE "${CMAKE_OSX_ARCHITECTURES}")
|
||||||
|
elseif (MSVC)
|
||||||
detect_architecture("_M_AMD64" x86_64)
|
detect_architecture("_M_AMD64" x86_64)
|
||||||
detect_architecture("_M_IX86" x86)
|
detect_architecture("_M_IX86" x86)
|
||||||
detect_architecture("_M_ARM" arm)
|
detect_architecture("_M_ARM" arm)
|
||||||
|
@ -167,8 +167,6 @@ if (NOT ENABLE_GENERIC)
|
||||||
endif()
|
endif()
|
||||||
if (NOT DEFINED ARCHITECTURE)
|
if (NOT DEFINED ARCHITECTURE)
|
||||||
set(ARCHITECTURE "GENERIC")
|
set(ARCHITECTURE "GENERIC")
|
||||||
set(ARCHITECTURE_GENERIC 1)
|
|
||||||
add_definitions(-DARCHITECTURE_GENERIC=1)
|
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "Target architecture: ${ARCHITECTURE}")
|
message(STATUS "Target architecture: ${ARCHITECTURE}")
|
||||||
|
|
||||||
|
@ -194,7 +192,7 @@ find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if (ENABLE_QT)
|
if (ENABLE_QT)
|
||||||
if (CITRA_USE_BUNDLED_QT)
|
if (CITRA_USE_BUNDLED_QT)
|
||||||
if (MSVC_VERSION GREATER_EQUAL 1920 AND ARCHITECTURE_x86_64)
|
if (MSVC_VERSION GREATER_EQUAL 1920 AND "x86_64" IN_LIST ARCHITECTURE)
|
||||||
set(QT_VER qt-5.15.7-msvc2019_64)
|
set(QT_VER qt-5.15.7-msvc2019_64)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.")
|
||||||
|
@ -231,7 +229,7 @@ endif()
|
||||||
|
|
||||||
if (ENABLE_FFMPEG)
|
if (ENABLE_FFMPEG)
|
||||||
if (CITRA_USE_BUNDLED_FFMPEG)
|
if (CITRA_USE_BUNDLED_FFMPEG)
|
||||||
if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
|
if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND "x86_64" IN_LIST ARCHITECTURE)
|
||||||
set(FFmpeg_VER "ffmpeg-4.1-win64")
|
set(FFmpeg_VER "ffmpeg-4.1-win64")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "No bundled FFmpeg binaries for your toolchain. Disable CITRA_USE_BUNDLED_FFMPEG and provide your own.")
|
message(FATAL_ERROR "No bundled FFmpeg binaries for your toolchain. Disable CITRA_USE_BUNDLED_FFMPEG and provide your own.")
|
||||||
|
|
12
externals/CMakeLists.txt
vendored
12
externals/CMakeLists.txt
vendored
|
@ -33,21 +33,17 @@ add_subdirectory(cryptopp)
|
||||||
|
|
||||||
# fmt and Xbyak need to be added before dynarmic
|
# fmt and Xbyak need to be added before dynarmic
|
||||||
# libfmt
|
# libfmt
|
||||||
|
option(FMT_INSTALL "" ON)
|
||||||
add_subdirectory(fmt)
|
add_subdirectory(fmt)
|
||||||
|
|
||||||
# Xbyak
|
# Xbyak
|
||||||
if (ARCHITECTURE_x86_64)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
add_library(xbyak INTERFACE)
|
add_subdirectory(xbyak)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/xbyak/include)
|
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xbyak/xbyak DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/xbyak/include)
|
|
||||||
target_include_directories(xbyak SYSTEM INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/xbyak/include)
|
|
||||||
target_compile_definitions(xbyak INTERFACE XBYAK_NO_OP_NAMES)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Dynarmic
|
# Dynarmic
|
||||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
|
||||||
set(DYNARMIC_TESTS OFF)
|
set(DYNARMIC_TESTS OFF)
|
||||||
set(DYNARMIC_NO_BUNDLED_FMT ON)
|
|
||||||
set(DYNARMIC_FRONTENDS "A32")
|
set(DYNARMIC_FRONTENDS "A32")
|
||||||
add_subdirectory(dynarmic)
|
add_subdirectory(dynarmic)
|
||||||
endif()
|
endif()
|
||||||
|
|
2
externals/dynarmic
vendored
2
externals/dynarmic
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 7a926d689bcc1cc39dd26d5bba379dffcc6815a3
|
Subproject commit 9af4b970d302389829448a30608c7cb4fce9b662
|
2
externals/xbyak
vendored
2
externals/xbyak
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 48457bfa0ded67bb4ae2d4c141c36b35469257ee
|
Subproject commit a1ac3750f9a639b5a6c6d6c7da4259b8d6790989
|
|
@ -60,6 +60,7 @@
|
||||||
#include "citra_qt/uisettings.h"
|
#include "citra_qt/uisettings.h"
|
||||||
#include "citra_qt/updater/updater.h"
|
#include "citra_qt/updater/updater.h"
|
||||||
#include "citra_qt/util/clickable_label.h"
|
#include "citra_qt/util/clickable_label.h"
|
||||||
|
#include "common/arch.h"
|
||||||
#include "common/common_paths.h"
|
#include "common/common_paths.h"
|
||||||
#include "common/detached_tasks.h"
|
#include "common/detached_tasks.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
|
@ -73,7 +74,7 @@
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
#include "common/x64/cpu_detect.h"
|
#include "common/x64/cpu_detect.h"
|
||||||
#endif
|
#endif
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
@ -204,7 +205,7 @@ GMainWindow::GMainWindow()
|
||||||
|
|
||||||
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
|
LOG_INFO(Frontend, "Citra Version: {} | {}-{}", Common::g_build_fullname, Common::g_scm_branch,
|
||||||
Common::g_scm_desc);
|
Common::g_scm_desc);
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
const auto& caps = Common::GetCPUCaps();
|
const auto& caps = Common::GetCPUCaps();
|
||||||
std::string cpu_string = caps.cpu_string;
|
std::string cpu_string = caps.cpu_string;
|
||||||
if (caps.avx || caps.avx2 || caps.avx512) {
|
if (caps.avx || caps.avx2 || caps.avx512) {
|
||||||
|
|
|
@ -54,6 +54,8 @@ add_custom_command(OUTPUT scm_rev.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(common STATIC
|
add_library(common STATIC
|
||||||
|
aarch64/cpu_detect.cpp
|
||||||
|
aarch64/cpu_detect.h
|
||||||
alignment.h
|
alignment.h
|
||||||
announce_multiplayer_room.h
|
announce_multiplayer_room.h
|
||||||
archives.h
|
archives.h
|
||||||
|
@ -124,34 +126,21 @@ add_library(common STATIC
|
||||||
timer.h
|
timer.h
|
||||||
vector_math.h
|
vector_math.h
|
||||||
web_result.h
|
web_result.h
|
||||||
|
x64/cpu_detect.cpp
|
||||||
|
x64/cpu_detect.h
|
||||||
|
x64/xbyak_abi.h
|
||||||
|
x64/xbyak_util.h
|
||||||
zstd_compression.cpp
|
zstd_compression.cpp
|
||||||
zstd_compression.h
|
zstd_compression.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ARCHITECTURE_x86_64)
|
|
||||||
target_sources(common
|
|
||||||
PRIVATE
|
|
||||||
x64/cpu_detect.cpp
|
|
||||||
|
|
||||||
x64/cpu_detect.h
|
|
||||||
x64/xbyak_abi.h
|
|
||||||
x64/xbyak_util.h
|
|
||||||
)
|
|
||||||
elseif(ARCHITECTURE_arm64)
|
|
||||||
target_sources(common
|
|
||||||
PRIVATE
|
|
||||||
aarch64/cpu_detect.cpp
|
|
||||||
aarch64/cpu_detect.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
create_target_directory_groups(common)
|
create_target_directory_groups(common)
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC fmt::fmt microprofile Boost::boost Boost::serialization)
|
target_link_libraries(common PUBLIC fmt::fmt microprofile Boost::boost Boost::serialization)
|
||||||
target_link_libraries(common PRIVATE libzstd_static)
|
target_link_libraries(common PRIVATE libzstd_static)
|
||||||
set_target_properties(common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
set_target_properties(common PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
target_link_libraries(common PRIVATE xbyak)
|
target_link_libraries(common PRIVATE xbyak)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2+
|
// Licensed under GPLv2+
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(arm64)
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -110,3 +113,5 @@ const CPUCaps& GetCPUCaps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(arm64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(arm64)
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
@ -29,3 +32,5 @@ struct CPUCaps {
|
||||||
const CPUCaps& GetCPUCaps();
|
const CPUCaps& GetCPUCaps();
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(arm64)
|
||||||
|
|
13
src/common/arch.h
Normal file
13
src/common/arch.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2023 Citra Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <boost/predef.h>
|
||||||
|
|
||||||
|
#define CITRA_ARCH(NAME) (CITRA_ARCH_##NAME)
|
||||||
|
|
||||||
|
#define CITRA_ARCH_x86_64 BOOST_ARCH_X86_64
|
||||||
|
#define CITRA_ARCH_arm64 \
|
||||||
|
(BOOST_ARCH_ARM >= BOOST_VERSION_NUMBER(8, 0, 0) && BOOST_ARCH_WORD_BITS == 64)
|
|
@ -5,8 +5,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "common/arch.h"
|
||||||
|
|
||||||
#if !defined(ARCHITECTURE_x86_64)
|
#if !CITRA_ARCH(x86_64)
|
||||||
#include <cstdlib> // for exit
|
#include <cstdlib> // for exit
|
||||||
#endif
|
#endif
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -36,7 +37,7 @@
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
#define Crash() __asm__ __volatile__("int $3")
|
#define Crash() __asm__ __volatile__("int $3")
|
||||||
#else
|
#else
|
||||||
#define Crash() exit(1)
|
#define Crash() exit(1)
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "common/arch.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
#include "common/telemetry.h"
|
#include "common/telemetry.h"
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
#include "common/x64/cpu_detect.h"
|
#include "common/x64/cpu_detect.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ void AppendBuildInfo(FieldCollection& fc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppendCPUInfo(FieldCollection& fc) {
|
void AppendCPUInfo(FieldCollection& fc) {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
fc.AddField(FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
|
fc.AddField(FieldType::UserSystem, "CPU_Model", Common::GetCPUCaps().cpu_string);
|
||||||
fc.AddField(FieldType::UserSystem, "CPU_BrandString", Common::GetCPUCaps().brand_string);
|
fc.AddField(FieldType::UserSystem, "CPU_BrandString", Common::GetCPUCaps().brand_string);
|
||||||
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
|
fc.AddField(FieldType::UserSystem, "CPU_Extension_x64_AES", Common::GetCPUCaps().aes);
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/x64/cpu_detect.h"
|
#include "common/x64/cpu_detect.h"
|
||||||
|
@ -144,3 +147,5 @@ const CPUCaps& GetCPUCaps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
/// x86/x64 CPU capabilities that may be detected by this module
|
/// x86/x64 CPU capabilities that may be detected by this module
|
||||||
|
@ -33,3 +36,5 @@ struct CPUCaps {
|
||||||
const CPUCaps& GetCPUCaps();
|
const CPUCaps& GetCPUCaps();
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
#include <xbyak/xbyak.h>
|
#include <xbyak/xbyak.h>
|
||||||
|
@ -228,3 +231,5 @@ inline void ABI_PopRegistersAndAdjustStack(Xbyak::CodeGenerator& code, std::bits
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common::X64
|
} // namespace Common::X64
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <xbyak/xbyak.h>
|
#include <xbyak/xbyak.h>
|
||||||
#include "common/x64/xbyak_abi.h"
|
#include "common/x64/xbyak_abi.h"
|
||||||
|
@ -45,3 +48,5 @@ inline void CallFarFunction(Xbyak::CodeGenerator& code, const T f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Common::X64
|
} // namespace Common::X64
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -488,7 +488,7 @@ if (ENABLE_WEB_SERVICE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
|
||||||
target_sources(core PRIVATE
|
target_sources(core PRIVATE
|
||||||
arm/dynarmic/arm_dynarmic.cpp
|
arm/dynarmic/arm_dynarmic.cpp
|
||||||
arm/dynarmic/arm_dynarmic.h
|
arm/dynarmic/arm_dynarmic.h
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64)
|
||||||
#include "core/arm/dynarmic/arm_exclusive_monitor.h"
|
#include "core/arm/dynarmic/arm_exclusive_monitor.h"
|
||||||
#endif
|
#endif
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
|
@ -14,7 +15,7 @@ ExclusiveMonitor::~ExclusiveMonitor() = default;
|
||||||
|
|
||||||
std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::MemorySystem& memory,
|
std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::MemorySystem& memory,
|
||||||
std::size_t num_cores) {
|
std::size_t num_cores) {
|
||||||
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
#if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64)
|
||||||
if (Settings::values.use_cpu_jit) {
|
if (Settings::values.use_cpu_jit) {
|
||||||
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
|
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,12 @@
|
||||||
#include "audio_core/dsp_interface.h"
|
#include "audio_core/dsp_interface.h"
|
||||||
#include "audio_core/hle/hle.h"
|
#include "audio_core/hle/hle.h"
|
||||||
#include "audio_core/lle/lle.h"
|
#include "audio_core/lle/lle.h"
|
||||||
|
#include "common/arch.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/texture.h"
|
#include "common/texture.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/exclusive_monitor.h"
|
||||||
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
#if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64)
|
||||||
#include "core/arm/dynarmic/arm_dynarmic.h"
|
#include "core/arm/dynarmic/arm_dynarmic.h"
|
||||||
#endif
|
#endif
|
||||||
#include "core/arm/dyncom/arm_dyncom.h"
|
#include "core/arm/dyncom/arm_dyncom.h"
|
||||||
|
@ -372,7 +373,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window,
|
||||||
|
|
||||||
exclusive_monitor = MakeExclusiveMonitor(*memory, num_cores);
|
exclusive_monitor = MakeExclusiveMonitor(*memory, num_cores);
|
||||||
if (Settings::values.use_cpu_jit) {
|
if (Settings::values.use_cpu_jit) {
|
||||||
#if defined(ARCHITECTURE_x86_64) || defined(ARCHITECTURE_arm64)
|
#if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64)
|
||||||
for (u32 i = 0; i < num_cores; ++i) {
|
for (u32 i = 0; i < num_cores; ++i) {
|
||||||
cpu_cores.push_back(std::make_shared<ARM_Dynarmic>(
|
cpu_cores.push_back(std::make_shared<ARM_Dynarmic>(
|
||||||
this, *memory, i, timing->GetTimer(i), *exclusive_monitor));
|
this, *memory, i, timing->GetTimer(i), *exclusive_monitor));
|
||||||
|
|
|
@ -12,15 +12,9 @@ add_executable(tests
|
||||||
precompiled_headers.h
|
precompiled_headers.h
|
||||||
audio_core/audio_fixures.h
|
audio_core/audio_fixures.h
|
||||||
audio_core/decoder_tests.cpp
|
audio_core/decoder_tests.cpp
|
||||||
|
video_core/shader/shader_jit_x64_compiler.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
|
||||||
target_sources(tests
|
|
||||||
PRIVATE
|
|
||||||
video_core/shader/shader_jit_x64_compiler.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
create_target_directory_groups(tests)
|
create_target_directory_groups(tests)
|
||||||
|
|
||||||
target_link_libraries(tests PRIVATE common core video_core audio_core)
|
target_link_libraries(tests PRIVATE common core video_core audio_core)
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -158,3 +161,5 @@ TEST_CASE("Nested Loop", "[video_core][shader][shader_jit]") {
|
||||||
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
|
REQUIRE(shader_unit_jit.registers.output[0].x.ToFloat32() == Catch::Approx(expected_out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -87,6 +87,10 @@ add_library(video_core STATIC
|
||||||
shader/shader.h
|
shader/shader.h
|
||||||
shader/shader_interpreter.cpp
|
shader/shader_interpreter.cpp
|
||||||
shader/shader_interpreter.h
|
shader/shader_interpreter.h
|
||||||
|
shader/shader_jit_x64.cpp
|
||||||
|
shader/shader_jit_x64_compiler.cpp
|
||||||
|
shader/shader_jit_x64.h
|
||||||
|
shader/shader_jit_x64_compiler.h
|
||||||
swrasterizer/clipper.cpp
|
swrasterizer/clipper.cpp
|
||||||
swrasterizer/clipper.h
|
swrasterizer/clipper.h
|
||||||
swrasterizer/framebuffer.cpp
|
swrasterizer/framebuffer.cpp
|
||||||
|
@ -144,24 +148,13 @@ add_dependencies(video_core shaders)
|
||||||
|
|
||||||
target_include_directories(video_core PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
target_include_directories(video_core PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if(ARCHITECTURE_x86_64)
|
|
||||||
target_sources(video_core
|
|
||||||
PRIVATE
|
|
||||||
shader/shader_jit_x64.cpp
|
|
||||||
shader/shader_jit_x64_compiler.cpp
|
|
||||||
|
|
||||||
shader/shader_jit_x64.h
|
|
||||||
shader/shader_jit_x64_compiler.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
create_target_directory_groups(video_core)
|
create_target_directory_groups(video_core)
|
||||||
|
|
||||||
target_link_libraries(video_core PUBLIC common core)
|
target_link_libraries(video_core PUBLIC common core)
|
||||||
target_link_libraries(video_core PRIVATE glad nihstro-headers Boost::serialization)
|
target_link_libraries(video_core PRIVATE glad nihstro-headers Boost::serialization)
|
||||||
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
|
||||||
|
|
||||||
if (ARCHITECTURE_x86_64)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
target_link_libraries(video_core PUBLIC xbyak)
|
target_link_libraries(video_core PUBLIC xbyak)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include "common/arch.h"
|
||||||
#include "common/bit_set.h"
|
#include "common/bit_set.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
|
@ -12,9 +13,9 @@
|
||||||
#include "video_core/regs_shader.h"
|
#include "video_core/regs_shader.h"
|
||||||
#include "video_core/shader/shader.h"
|
#include "video_core/shader/shader.h"
|
||||||
#include "video_core/shader/shader_interpreter.h"
|
#include "video_core/shader/shader_interpreter.h"
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
#include "video_core/shader/shader_jit_x64.h"
|
#include "video_core/shader/shader_jit_x64.h"
|
||||||
#endif // ARCHITECTURE_x86_64
|
#endif // CITRA_ARCH(x86_64)
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
namespace Pica::Shader {
|
namespace Pica::Shader {
|
||||||
|
@ -134,13 +135,13 @@ void GSUnitState::ConfigOutput(const ShaderRegs& config) {
|
||||||
|
|
||||||
MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
|
MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
static std::unique_ptr<JitX64Engine> jit_engine;
|
static std::unique_ptr<JitX64Engine> jit_engine;
|
||||||
#endif // ARCHITECTURE_x86_64
|
#endif // CITRA_ARCH(x86_64)
|
||||||
static InterpreterEngine interpreter_engine;
|
static InterpreterEngine interpreter_engine;
|
||||||
|
|
||||||
ShaderEngine* GetEngine() {
|
ShaderEngine* GetEngine() {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
// TODO(yuriks): Re-initialize on each change rather than being persistent
|
// TODO(yuriks): Re-initialize on each change rather than being persistent
|
||||||
if (VideoCore::g_shader_jit_enabled) {
|
if (VideoCore::g_shader_jit_enabled) {
|
||||||
if (jit_engine == nullptr) {
|
if (jit_engine == nullptr) {
|
||||||
|
@ -148,15 +149,15 @@ ShaderEngine* GetEngine() {
|
||||||
}
|
}
|
||||||
return jit_engine.get();
|
return jit_engine.get();
|
||||||
}
|
}
|
||||||
#endif // ARCHITECTURE_x86_64
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
return &interpreter_engine;
|
return &interpreter_engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#if CITRA_ARCH(x86_64)
|
||||||
jit_engine = nullptr;
|
jit_engine = nullptr;
|
||||||
#endif // ARCHITECTURE_x86_64
|
#endif // CITRA_ARCH(x86_64)
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Pica::Shader
|
} // namespace Pica::Shader
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "video_core/shader/shader.h"
|
#include "video_core/shader/shader.h"
|
||||||
#include "video_core/shader/shader_jit_x64.h"
|
#include "video_core/shader/shader_jit_x64.h"
|
||||||
|
@ -43,3 +46,5 @@ void JitX64Engine::Run(const ShaderSetup& setup, UnitState& state) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Pica::Shader
|
} // namespace Pica::Shader
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
@ -26,3 +29,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Pica::Shader
|
} // namespace Pica::Shader
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -1131,3 +1134,5 @@ Xbyak::Label JitShader::CompilePrelude_Exp2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Pica::Shader
|
} // namespace Pica::Shader
|
||||||
|
|
||||||
|
#endif // CITRA_ARCH(x86_64)
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/arch.h"
|
||||||
|
#if CITRA_ARCH(x86_64)
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
@ -138,3 +141,5 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Pica::Shader
|
} // namespace Pica::Shader
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue