mirror of
https://git.suyu.dev/suyu/suyu
synced 2025-12-08 22:02:07 -06:00
Compare commits
10 Commits
niansa-app
...
ccache-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44a2e172ed | ||
|
|
90ab1c3882 | ||
|
|
aa20f384dc | ||
|
|
e29c55dd98 | ||
|
|
3037f0b869 | ||
|
|
8b8aa84e70 | ||
|
|
95bd1120a7 | ||
|
|
9895cc94d0 | ||
|
|
84aa715eb1 | ||
|
|
b09f9ee1f4 |
@@ -1,20 +1,24 @@
|
|||||||
#!/bin/bash -ex
|
#!/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
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
# Exit on error, rather than continuing with the rest of the script.
|
# Exit on error, rather than continuing with the rest of the script.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Old versions of ccache don't include the -v argument. Keep it only with -s
|
||||||
ccache -s
|
ccache -s
|
||||||
|
|
||||||
mkdir build || true && cd build
|
mkdir build || true && cd build
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DBoost_USE_STATIC_LIBS=ON \
|
-DBoost_USE_STATIC_LIBS=ON \
|
||||||
|
-DSUYU_USE_PRECOMPILED_HEADERS=OFF \
|
||||||
|
-DDYNARMIC_USE_PRECOMPILED_HEADERS=OFF \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-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_FLAGS="-march=x86-64-v2" \
|
||||||
-DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ \
|
|
||||||
-DCMAKE_C_COMPILER=/usr/lib/ccache/gcc \
|
|
||||||
-DCMAKE_INSTALL_PREFIX="/usr" \
|
-DCMAKE_INSTALL_PREFIX="/usr" \
|
||||||
-DDISPLAY_VERSION=$1 \
|
-DDISPLAY_VERSION=$1 \
|
||||||
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
|
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=OFF \
|
||||||
@@ -24,6 +28,7 @@ cmake .. \
|
|||||||
-DSUYU_USE_BUNDLED_FFMPEG=ON \
|
-DSUYU_USE_BUNDLED_FFMPEG=ON \
|
||||||
-DSUYU_ENABLE_LTO=ON \
|
-DSUYU_ENABLE_LTO=ON \
|
||||||
-DSUYU_CRASH_DUMPS=ON \
|
-DSUYU_CRASH_DUMPS=ON \
|
||||||
|
-DUSE_CCACHE=ON \
|
||||||
-GNinja
|
-GNinja
|
||||||
|
|
||||||
ninja
|
ninja
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -37,3 +37,9 @@ CMakeSettings.json
|
|||||||
# Windows global filetypes
|
# Windows global filetypes
|
||||||
Thumbs.db
|
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
52
.gitlab-ci.yml
Normal file → Executable file
@@ -2,26 +2,66 @@ stages:
|
|||||||
- format
|
- format
|
||||||
- build
|
- 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:
|
clang-format:
|
||||||
stage: format
|
stage: format
|
||||||
image: suyuemu/cibuild:linux-x64
|
image: registry.gitlab.com/ddutchie/ci-docker:clangformat
|
||||||
|
#TODO: SET THIS TO FALSE!!!
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
variables:
|
|
||||||
RELEASE_NAME: mainline
|
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --depth 1 --recursive
|
- git submodule update --init --depth 1 --recursive
|
||||||
- bash .ci/scripts/format/script.sh
|
- bash .ci/scripts/format/script.sh
|
||||||
|
|
||||||
|
#LINUX BUILD - BUILDS LINUX APPIMAGE
|
||||||
build-linux:
|
build-linux:
|
||||||
stage: build
|
stage: build
|
||||||
image: suyuemu/cibuild:linux-x64
|
image: registry.gitlab.com/ddutchie/ci-docker:linux-x64
|
||||||
resource_group: linux-ci
|
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:
|
variables:
|
||||||
RELEASE_NAME: mainline
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
GIT_SUBMODULE_DEPTH: 1
|
||||||
|
RELEASE_NAME: mainline
|
||||||
script:
|
script:
|
||||||
- git submodule update --init --depth 1 --recursive
|
|
||||||
- bash .ci/scripts/linux/docker.sh
|
- bash .ci/scripts/linux/docker.sh
|
||||||
- bash .ci/scripts/linux/upload.sh
|
- bash .ci/scripts/linux/upload.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- artifacts/*
|
- 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
7
.gitmodules
vendored
@@ -7,6 +7,9 @@
|
|||||||
[submodule "cubeb"]
|
[submodule "cubeb"]
|
||||||
path = externals/cubeb
|
path = externals/cubeb
|
||||||
url = https://github.com/mozilla/cubeb.git
|
url = https://github.com/mozilla/cubeb.git
|
||||||
|
[submodule "dynarmic"]
|
||||||
|
path = externals/dynarmic
|
||||||
|
url = https://gitlab.com/suyu-emu/dynarmic.git
|
||||||
[submodule "libusb"]
|
[submodule "libusb"]
|
||||||
path = externals/libusb/libusb
|
path = externals/libusb/libusb
|
||||||
url = https://github.com/libusb/libusb.git
|
url = https://github.com/libusb/libusb.git
|
||||||
@@ -64,7 +67,3 @@
|
|||||||
[submodule "Vulkan-Utility-Libraries"]
|
[submodule "Vulkan-Utility-Libraries"]
|
||||||
path = externals/Vulkan-Utility-Libraries
|
path = externals/Vulkan-Utility-Libraries
|
||||||
url = https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git
|
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
|
|
||||||
|
|||||||
@@ -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)
|
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)
|
set(DEFAULT_ENABLE_OPENSSL ON)
|
||||||
if (ANDROID OR WIN32 OR APPLE)
|
if (ANDROID OR WIN32 OR APPLE)
|
||||||
# - Windows defaults to the Schannel backend.
|
# - 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"
|
install(FILES "dist/org.suyu_emu.suyu.metainfo.xml"
|
||||||
DESTINATION "share/metainfo")
|
DESTINATION "share/metainfo")
|
||||||
endif()
|
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()
|
||||||
|
|||||||
@@ -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
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
# This function downloads a binary library package from our external repo.
|
# This function downloads a binary library package from our external repo.
|
||||||
@@ -17,6 +17,9 @@ if (WIN32)
|
|||||||
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
set(package_repo "ext-linux-bin/-/raw/main/")
|
set(package_repo "ext-linux-bin/-/raw/main/")
|
||||||
set(package_extension ".tar.xz")
|
set(package_extension ".tar.xz")
|
||||||
|
# elseif (APPLE)
|
||||||
|
# set(package_repo "ext-osx-bin/-/raw/main/")
|
||||||
|
# set(package_extension ".dmg")
|
||||||
elseif (ANDROID)
|
elseif (ANDROID)
|
||||||
set(package_repo "ext-android-bin/-/raw/main/")
|
set(package_repo "ext-android-bin/-/raw/main/")
|
||||||
set(package_extension ".tar.xz")
|
set(package_extension ".tar.xz")
|
||||||
|
|||||||
BIN
dist/suyu.icns
vendored
BIN
dist/suyu.icns
vendored
Binary file not shown.
2
externals/dynarmic
vendored
2
externals/dynarmic
vendored
Submodule externals/dynarmic updated: f35a122a46...ba8192d890
@@ -254,14 +254,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||||||
)
|
)
|
||||||
endif()
|
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 PUBLIC Boost::context Boost::headers fmt::fmt microprofile stb::headers Threads::Threads)
|
||||||
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)
|
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
|
||||||
target_link_static_library(common PRIVATE LLVM::Demangle)
|
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
# For ASharedMemory_create
|
# For ASharedMemory_create
|
||||||
|
|||||||
@@ -357,7 +357,7 @@ if (APPLE)
|
|||||||
|
|
||||||
if (NOT USE_SYSTEM_MOLTENVK)
|
if (NOT USE_SYSTEM_MOLTENVK)
|
||||||
set(MOLTENVK_PLATFORM "macOS")
|
set(MOLTENVK_PLATFORM "macOS")
|
||||||
set(MOLTENVK_VERSION "v1.2.7")
|
set(MOLTENVK_VERSION "v1.2.8")
|
||||||
download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
|
download_moltenvk_external(${MOLTENVK_PLATFORM} ${MOLTENVK_VERSION})
|
||||||
endif()
|
endif()
|
||||||
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
||||||
|
|||||||
@@ -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
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
|
|
||||||
#include "common/fs/fs.h"
|
#include "common/fs/fs.h"
|
||||||
#include "common/fs/path_util.h"
|
#include "common/fs/path_util.h"
|
||||||
|
#include "common/logging/log.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/patch_manager.h"
|
#include "core/file_sys/patch_manager.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
|||||||
@@ -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
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
@@ -217,7 +217,166 @@ bool DecoderContext::OpenContext(const Decoder& decoder) {
|
|||||||
|
|
||||||
return true;
|
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) {
|
bool DecoderContext::SendPacket(const Packet& packet) {
|
||||||
m_temp_frame = std::make_shared<Frame>();
|
m_temp_frame = std::make_shared<Frame>();
|
||||||
m_got_frame = 0;
|
m_got_frame = 0;
|
||||||
@@ -227,8 +386,10 @@ bool DecoderContext::SendPacket(const Packet& packet) {
|
|||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
||||||
m_decode_order = true;
|
m_decode_order = true;
|
||||||
const int ret = avcodec_send_frame(m_codec_context, m_temp_frame->GetFrame());
|
auto* codec{ffcodec(m_decoder.GetCodec())};
|
||||||
if (ret < 0) {
|
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));
|
LOG_DEBUG(Service_NVDRV, "avcodec_send_packet error {}", AVError(ret));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -250,6 +411,7 @@ std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
|
|||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
||||||
m_decode_order = true;
|
m_decode_order = true;
|
||||||
|
auto* codec{ffcodec(m_decoder.GetCodec())};
|
||||||
int ret{0};
|
int ret{0};
|
||||||
|
|
||||||
if (m_got_frame == 0) {
|
if (m_got_frame == 0) {
|
||||||
@@ -257,7 +419,7 @@ std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
|
|||||||
auto* pkt = packet.GetPacket();
|
auto* pkt = packet.GetPacket();
|
||||||
pkt->data = nullptr;
|
pkt->data = nullptr;
|
||||||
pkt->size = 0;
|
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;
|
m_codec_context->has_b_frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|||||||
@@ -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
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -580,6 +580,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
|||||||
VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
|
VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Mesa RadV drivers still have broken extendedDynamicState3ColorBlendEquation support.
|
||||||
if (extensions.extended_dynamic_state3 && is_radv) {
|
if (extensions.extended_dynamic_state3 && is_radv) {
|
||||||
LOG_WARNING(Render_Vulkan, "RADV has broken extendedDynamicState3ColorBlendEquation");
|
LOG_WARNING(Render_Vulkan, "RADV has broken extendedDynamicState3ColorBlendEquation");
|
||||||
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
|
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
|
||||||
@@ -594,13 +595,16 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
|
|||||||
dynamic_state3_enables = false;
|
dynamic_state3_enables = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (extensions.extended_dynamic_state3 && is_amd_driver) {
|
// In the past, AMD proprietary drivers had broken extendedDynamicState3ColorBlendEquation
|
||||||
LOG_WARNING(Render_Vulkan,
|
// support. It should work now, even with MSAA surfaces. Uncomment the following code any new
|
||||||
"AMD drivers have broken extendedDynamicState3ColorBlendEquation");
|
// drivers by AMD bring back the issue as a regression.
|
||||||
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
|
// if (extensions.extended_dynamic_state3 && is_amd_driver) {
|
||||||
features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false;
|
// LOG_WARNING(Render_Vulkan,
|
||||||
dynamic_state3_blending = false;
|
// "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) {
|
if (extensions.vertex_input_dynamic_state && is_radv) {
|
||||||
// TODO(ameerj): Blacklist only offending driver versions
|
// TODO(ameerj): Blacklist only offending driver versions
|
||||||
// TODO(ameerj): Confirm if RDNA1 is affected
|
// TODO(ameerj): Confirm if RDNA1 is affected
|
||||||
|
|||||||
Reference in New Issue
Block a user