1
0
mirror of https://git.suyu.dev/suyu/suyu synced 2025-12-08 13:52:08 -06:00

10 Commits

Author SHA1 Message Date
Fijxu
44a2e172ed fix: Use chmod inside the CCACHE directory
If we need to replace the docker image for any reason, the user will
(probably) be different. This ensures that the CCACHE directory can be
read and writen by any user of the docker image being used in the CI.
2024-03-14 20:32:16 -03:00
Fijxu
90ab1c3882 fix: Re add CMAKE_CXX_COMPILER and CMAKE_C_COMPILER. Now pointing to
GCC12.
2024-03-14 20:08:51 -03:00
Fijxu
aa20f384dc feature: Store CCACHE cache in CI Cache. 2024-03-14 19:45:27 -03:00
ddutchie
e29c55dd98 CI Changes to Alow Building Linux and Android [From FORK] 2024-03-14 21:35:22 +00:00
niansa
3037f0b869 Fix clang-format error 2024-03-14 11:14:50 +01:00
Alessio
8b8aa84e70 fix for amd video playback (green videos) 2024-03-13 23:50:47 +00:00
Alessio
95bd1120a7 Vulkan dynamic state 3 blending should work correctly in AMD proprietary drivers now 2024-03-13 23:46:14 +00:00
Amir Abravesh
9895cc94d0 Updating moltenVK and macOS icon 2024-03-13 13:00:31 +00:00
Fijxu
84aa715eb1 feature: Use CCACHE if possible 2024-03-13 08:16:00 +00:00
Fijxu
b09f9ee1f4 Fix: add missing log.h header file 2024-03-13 05:45:06 +00:00
14 changed files with 268 additions and 37 deletions

View File

@@ -1,20 +1,24 @@
#!/bin/bash -ex
# SPDX-FileCopyrightText: 2019 yuzu Emulator Project & 2024 suyu Emulator Project
# SPDX-FileCopyrightText: 2019 yuzu Emulator Project
# SPDX-FileCopyrightText: 2024 suyu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# Exit on error, rather than continuing with the rest of the script.
set -e
# Old versions of ccache don't include the -v argument. Keep it only with -s
ccache -s
mkdir build || true && cd build
cmake .. \
-DBoost_USE_STATIC_LIBS=ON \
-DSUYU_USE_PRECOMPILED_HEADERS=OFF \
-DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER=/usr/local/bin/g++ \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc \
-DCMAKE_CXX_FLAGS="-march=x86-64-v2" \
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \
-DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DDISPLAY_VERSION=$1 \
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
@@ -24,6 +28,7 @@ cmake .. \
-DSUYU_USE_BUNDLED_FFMPEG=ON \
-DSUYU_ENABLE_LTO=ON \
-DSUYU_CRASH_DUMPS=ON \
-DUSE_CCACHE=ON \
-GNinja
ninja

6
.gitignore vendored
View File

@@ -37,3 +37,9 @@ CMakeSettings.json
# Windows global filetypes
Thumbs.db
# Local Gitlab CI Runner
.gitlab-ci-local/
# clangd compile_commands.json
# https://clangd.llvm.org/installation.html#project-setup
compile_commands.json

52
.gitlab-ci.yml Normal file → Executable file
View File

@@ -2,26 +2,66 @@ stages:
- format
- build
variables:
# https://docs.gitlab.com/ee/ci/runners/configure_runners.html
TRANSFER_METER_FREQUENCY: "2s"
ARTIFACT_COMPRESSION_LEVEL: "fast"
CACHE_COMPRESSION_LEVEL: "fastest"
CACHE_REQUEST_TIMEOUT: 5
# Use FASTZIP for faster compression in cache and artifacts
# https://docs.gitlab.com/runner/configuration/feature-flags.html#available-feature-flags
FF_USE_FASTZIP: true
# Our Variables
CACHE_DIR: "$CI_PROJECT_DIR/ccache"
CCACHE_DIR: $CACHE_DIR
#CLANG FORMAT - CHECKS CODE FOR FORMATTING ISSUES
clang-format:
stage: format
image: suyuemu/cibuild:linux-x64
image: registry.gitlab.com/ddutchie/ci-docker:clangformat
#TODO: SET THIS TO FALSE!!!
allow_failure: true
variables:
RELEASE_NAME: mainline
script:
- git submodule update --init --depth 1 --recursive
- bash .ci/scripts/format/script.sh
#LINUX BUILD - BUILDS LINUX APPIMAGE
build-linux:
stage: build
image: suyuemu/cibuild:linux-x64
image: registry.gitlab.com/ddutchie/ci-docker:linux-x64
resource_group: linux-ci
cache:
key: "$CI_COMMIT_REF_NAME-ccache"
paths:
- $CACHE_DIR
before_script:
- mkdir -p $CACHE_DIR
- chmod -R 777 $CACHE_DIR
- ls -la $CACHE_DIR
variables:
RELEASE_NAME: mainline
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_DEPTH: 1
RELEASE_NAME: mainline
script:
- git submodule update --init --depth 1 --recursive
- bash .ci/scripts/linux/docker.sh
- bash .ci/scripts/linux/upload.sh
artifacts:
paths:
- artifacts/*
#ANDROID BUILD - BUILDS APK
android:
stage: build
image: registry.gitlab.com/ddutchie/ci-docker:android-x64
script:
- apt-get update -y
- git submodule update --init --recursive
- export ANDROID_HOME="/usr/lib/android-sdk/"
- echo y | sdkmanager --sdk_root=/usr/lib/android-sdk --licenses
- bash ./.ci/scripts/android/build.sh
- bash ./.ci/scripts/android/upload.sh
artifacts:
paths:
- artifacts/*

7
.gitmodules vendored
View File

@@ -7,6 +7,9 @@
[submodule "cubeb"]
path = externals/cubeb
url = https://github.com/mozilla/cubeb.git
[submodule "dynarmic"]
path = externals/dynarmic
url = https://gitlab.com/suyu-emu/dynarmic.git
[submodule "libusb"]
path = externals/libusb/libusb
url = https://github.com/libusb/libusb.git
@@ -64,7 +67,3 @@
[submodule "Vulkan-Utility-Libraries"]
path = externals/Vulkan-Utility-Libraries
url = https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
[submodule "externals/dynarmic"]
path = externals/dynarmic
url = https://gitlab.com/suyu-emu/dynarmic.git
branch = stable

View File

@@ -70,6 +70,8 @@ CMAKE_DEPENDENT_OPTION(SUYU_USE_FASTER_LD "Check if a faster linker is available
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF)
option(USE_CCACHE "Use CCache for faster building" ON)
set(DEFAULT_ENABLE_OPENSSL ON)
if (ANDROID OR WIN32 OR APPLE)
# - Windows defaults to the Schannel backend.
@@ -733,3 +735,17 @@ if(ENABLE_QT AND UNIX AND NOT APPLE)
install(FILES "dist/org.suyu_emu.suyu.metainfo.xml"
DESTINATION "share/metainfo")
endif()
# Enable CCACHE. Linux only for now.
if (USE_CCACHE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
if (SUYU_USE_PRECOMPILED_HEADERS)
message(NOTICE "To make use of CCache, set SUYU_USE_PRECOMPILED_HEADERS to OFF or else, it will barely be functional")
endif()
message(STATUS "CCache found.")
else()
message(STATUS "CCache has not been found and it will not be used. Install CCache or set USE_CCACHE to OFF")
endif()
endif()

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2017 yuzu Emulator Project
# SPDX-FileCopyrightText: 2017 yuzu Emulator Project & 2024 suyu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
# This function downloads a binary library package from our external repo.
@@ -17,6 +17,9 @@ if (WIN32)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(package_repo "ext-linux-bin/-/raw/main/")
set(package_extension ".tar.xz")
# elseif (APPLE)
# set(package_repo "ext-osx-bin/-/raw/main/")
# set(package_extension ".dmg")
elseif (ANDROID)
set(package_repo "ext-android-bin/-/raw/main/")
set(package_extension ".tar.xz")

BIN
dist/suyu.icns vendored

Binary file not shown.

View File

@@ -254,14 +254,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
)
endif()
function (target_link_static_library TARGET MODE LIBRARY)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
target_link_libraries(${TARGET} ${MODE} ${LIBRARY})
endfunction()
target_link_libraries(common PUBLIC Boost::context Boost::headers fmt::fmt microprofile stb::headers Threads::Threads)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
target_link_static_library(common PRIVATE LLVM::Demangle)
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
if (ANDROID)
# For ASharedMemory_create

View File

@@ -357,7 +357,7 @@ if (APPLE)
if (NOT USE_SYSTEM_MOLTENVK)
set(MOLTENVK_PLATFORM "macOS")
set(MOLTENVK_VERSION "v1.2.7")
set(MOLTENVK_VERSION "v1.2.8")
download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
endif()
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)

View File

@@ -1,4 +1,5 @@
// SPDX-FileCopyrightText: 2016 Citra Emulator Project & 2024 suyu Emulator Project
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-FileCopyrightText: 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
@@ -24,6 +25,7 @@
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/logging/log.h"
#include "core/core.h"
#include "core/file_sys/patch_manager.h"
#include "core/loader/loader.h"

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project & 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/assert.h"
@@ -217,7 +217,166 @@ bool DecoderContext::OpenContext(const Decoder& decoder) {
return true;
}
#ifndef ANDROID
// Nasty but allows linux builds to pass.
// Requires double checks when FFMPEG gets updated.
// Hopefully a future FFMPEG update will all and expose a solution in the public API.
namespace {
typedef struct FFCodecDefault {
const char* key;
const char* value;
} FFCodecDefault;
typedef struct FFCodec {
/**
* The public AVCodec. See codec.h for it.
*/
AVCodec p;
/**
* Internal codec capabilities FF_CODEC_CAP_*.
*/
unsigned caps_internal : 29;
/**
* This field determines the type of the codec (decoder/encoder)
* and also the exact callback cb implemented by the codec.
* cb_type uses enum FFCodecType values.
*/
unsigned cb_type : 3;
int priv_data_size;
/**
* @name Frame-level threading support functions
* @{
*/
/**
* Copy necessary context variables from a previous thread context to the current one.
* If not defined, the next thread will start automatically; otherwise, the codec
* must call ff_thread_finish_setup().
*
* dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
*/
int (*update_thread_context)(struct AVCodecContext* dst, const struct AVCodecContext* src);
/**
* Copy variables back to the user-facing context
*/
int (*update_thread_context_for_user)(struct AVCodecContext* dst,
const struct AVCodecContext* src);
/** @} */
/**
* Private codec-specific defaults.
*/
const FFCodecDefault* defaults;
/**
* Initialize codec static data, called from av_codec_iterate().
*
* This is not intended for time consuming operations as it is
* run for every codec regardless of that codec being used.
*/
void (*init_static_data)(struct FFCodec* codec);
int (*init)(struct AVCodecContext*);
union {
/**
* Decode to an AVFrame.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE.
*
* @param avctx codec context
* @param[out] frame AVFrame for output
* @param[out] got_frame_ptr decoder sets to 0 or 1 to indicate that
* a non-empty frame was returned in frame.
* @param[in] avpkt AVPacket containing the data to be decoded
* @return amount of bytes read from the packet on success,
* negative error code on failure
*/
int (*decode)(struct AVCodecContext* avctx, struct AVFrame* frame, int* got_frame_ptr,
struct AVPacket* avpkt);
/**
* Decode subtitle data to an AVSubtitle.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE_SUB.
*
* Apart from that this is like the decode callback.
*/
int (*decode_sub)(struct AVCodecContext* avctx, struct AVSubtitle* sub, int* got_frame_ptr,
const struct AVPacket* avpkt);
/**
* Decode API with decoupled packet/frame dataflow.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME.
*
* This function is called to get one output frame. It should call
* ff_decode_get_packet() to obtain input data.
*/
int (*receive_frame)(struct AVCodecContext* avctx, struct AVFrame* frame);
/**
* Encode data to an AVPacket.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE
*
* @param avctx codec context
* @param[out] avpkt output AVPacket
* @param[in] frame AVFrame containing the input to be encoded
* @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
* non-empty packet was returned in avpkt.
* @return 0 on success, negative error code on failure
*/
int (*encode)(struct AVCodecContext* avctx, struct AVPacket* avpkt,
const struct AVFrame* frame, int* got_packet_ptr);
/**
* Encode subtitles to a raw buffer.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE_SUB.
*/
int (*encode_sub)(struct AVCodecContext* avctx, uint8_t* buf, int buf_size,
const struct AVSubtitle* sub);
/**
* Encode API with decoupled frame/packet dataflow.
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_PACKET.
*
* This function is called to get one output packet.
* It should call ff_encode_get_frame() to obtain input data.
*/
int (*receive_packet)(struct AVCodecContext* avctx, struct AVPacket* avpkt);
} cb;
int (*close)(struct AVCodecContext*);
/**
* Flush buffers.
* Will be called when seeking
*/
void (*flush)(struct AVCodecContext*);
/**
* Decoding only, a comma-separated list of bitstream filters to apply to
* packets before decoding.
*/
const char* bsfs;
/**
* Array of pointers to hardware configurations supported by the codec,
* or NULL if no hardware supported. The array is terminated by a NULL
* pointer.
*
* The user can only access this field via avcodec_get_hw_config().
*/
const struct AVCodecHWConfigInternal* const* hw_configs;
/**
* List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
*/
const uint32_t* codec_tags;
} FFCodec;
static av_always_inline const FFCodec* ffcodec(const AVCodec* codec) {
return (const FFCodec*)codec;
}
} // namespace
#endif
bool DecoderContext::SendPacket(const Packet& packet) {
m_temp_frame = std::make_shared<Frame>();
m_got_frame = 0;
@@ -227,8 +386,10 @@ bool DecoderContext::SendPacket(const Packet& packet) {
#ifndef ANDROID
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
m_decode_order = true;
const int ret = avcodec_send_frame(m_codec_context, m_temp_frame->GetFrame());
if (ret < 0) {
auto* codec{ffcodec(m_decoder.GetCodec())};
if (const int ret = codec->cb.decode(m_codec_context, m_temp_frame->GetFrame(),
&m_got_frame, packet.GetPacket());
ret < 0) {
LOG_DEBUG(Service_NVDRV, "avcodec_send_packet error {}", AVError(ret));
return false;
}
@@ -250,6 +411,7 @@ std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
#ifndef ANDROID
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
m_decode_order = true;
auto* codec{ffcodec(m_decoder.GetCodec())};
int ret{0};
if (m_got_frame == 0) {
@@ -257,7 +419,7 @@ std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
auto* pkt = packet.GetPacket();
pkt->data = nullptr;
pkt->size = 0;
ret = avcodec_receive_packet(m_codec_context, pkt);
ret = codec->cb.decode(m_codec_context, m_temp_frame->GetFrame(), &m_got_frame, pkt);
m_codec_context->has_b_frames = 0;
}

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project & 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include <algorithm>

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project & 2024 suyu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
@@ -580,6 +580,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
}
}
// Mesa RadV drivers still have broken extendedDynamicState3ColorBlendEquation support.
if (extensions.extended_dynamic_state3 && is_radv) {
LOG_WARNING(Render_Vulkan, "RADV has broken extendedDynamicState3ColorBlendEquation");
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
@@ -594,13 +595,16 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
dynamic_state3_enables = false;
}
}
if (extensions.extended_dynamic_state3 && is_amd_driver) {
LOG_WARNING(Render_Vulkan,
"AMD drivers have broken extendedDynamicState3ColorBlendEquation");
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false;
dynamic_state3_blending = false;
}
// In the past, AMD proprietary drivers had broken extendedDynamicState3ColorBlendEquation
// support. It should work now, even with MSAA surfaces. Uncomment the following code any new
// drivers by AMD bring back the issue as a regression.
// if (extensions.extended_dynamic_state3 && is_amd_driver) {
// LOG_WARNING(Render_Vulkan,
// "AMD drivers have broken extendedDynamicState3ColorBlendEquation");
// features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
// features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false;
// dynamic_state3_blending = false;
//}
if (extensions.vertex_input_dynamic_state && is_radv) {
// TODO(ameerj): Blacklist only offending driver versions
// TODO(ameerj): Confirm if RDNA1 is affected