yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #9374 from liamwhite/externals

externals: update dynarmic, SDL2
This commit is contained in:
liamwhite 2022-12-04 10:44:12 -05:00 committed by GitHub
commit 02b10a6e4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 29 deletions

View File

@ -3,6 +3,10 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
# Dynarmic has cmake_minimum_required(3.12) and we may want to override
# some of its variables, which is only possible in 3.13+
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/find-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/find-modules")
@ -71,7 +75,8 @@ if (YUZU_USE_PRECOMPILED_HEADERS)
# buildcache does not properly cache PCH files, leading to compilation errors. # buildcache does not properly cache PCH files, leading to compilation errors.
# See https://github.com/mbitsnbites/buildcache/discussions/230 # See https://github.com/mbitsnbites/buildcache/discussions/230
message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH") message(WARNING "buildcache does not properly support Precompiled Headers. Disabling PCH")
set(YUZU_USE_PRECOMPILED_HEADERS OFF) set(DYNARMIC_USE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
set(YUZU_USE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE)
endif() endif()
endif() endif()
if (YUZU_USE_PRECOMPILED_HEADERS) if (YUZU_USE_PRECOMPILED_HEADERS)
@ -444,7 +449,7 @@ if (TARGET Boost::boost)
endif() endif()
# Ensure libusb is properly configured (based on dolphin libusb include) # Ensure libusb is properly configured (based on dolphin libusb include)
if(NOT APPLE AND NOT YUZU_USE_BUNDLED_LIBUSB) if(NOT YUZU_USE_BUNDLED_LIBUSB)
find_package(PkgConfig) find_package(PkgConfig)
if (PKG_CONFIG_FOUND AND NOT CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD") if (PKG_CONFIG_FOUND AND NOT CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
pkg_check_modules(LIBUSB QUIET libusb-1.0>=1.0.24) pkg_check_modules(LIBUSB QUIET libusb-1.0>=1.0.24)
@ -454,7 +459,8 @@ if(NOT APPLE AND NOT YUZU_USE_BUNDLED_LIBUSB)
if (LIBUSB_FOUND) if (LIBUSB_FOUND)
add_library(usb INTERFACE) add_library(usb INTERFACE)
target_include_directories(usb INTERFACE "${LIBUSB_INCLUDE_DIRS}") target_include_directories(usb INTERFACE "${LIBUSB_INCLUDEDIR}" "${LIBUSB_INCLUDE_DIRS}")
target_link_directories(usb INTERFACE "${LIBUSB_LIBRARY_DIRS}")
target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}") target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}")
else() else()
message(WARNING "libusb not found, falling back to externals") message(WARNING "libusb not found, falling back to externals")

View File

@ -12,9 +12,6 @@ endif()
# Dynarmic # Dynarmic
if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
if (ARCHITECTURE_arm64)
set(DYNARMIC_FRONTENDS "A32")
endif()
set(DYNARMIC_NO_BUNDLED_FMT ON) set(DYNARMIC_NO_BUNDLED_FMT ON)
set(DYNARMIC_IGNORE_ASSERTS ON CACHE BOOL "" FORCE) set(DYNARMIC_IGNORE_ASSERTS ON CACHE BOOL "" FORCE)
add_subdirectory(dynarmic) add_subdirectory(dynarmic)
@ -72,6 +69,7 @@ if (YUZU_USE_EXTERNAL_SDL2)
endif() endif()
add_subdirectory(SDL EXCLUDE_FROM_ALL) add_subdirectory(SDL EXCLUDE_FROM_ALL)
target_link_directories(SDL2-static INTERFACE "${SDL2_BINARY_DIR}")
endif() endif()
# ENet # ENet

2
externals/SDL vendored

@ -1 +1 @@
Subproject commit b424665e0899769b200231ba943353a5fee1b6b6 Subproject commit f17058b562c8a1090c0c996b42982721ace90903

2
externals/dynarmic vendored

@ -1 +1 @@
Subproject commit a5b57bb9cd1500a6e0a3c800b35c1984211dff1d Subproject commit a76a2fff534b5584c9921bc5c060e910e95b7738

View File

@ -3,6 +3,7 @@
#include <algorithm> #include <algorithm>
#include "common/polyfill_ranges.h"
#include "common/thread.h" #include "common/thread.h"
#include "core/hid/emulated_controller.h" #include "core/hid/emulated_controller.h"
#include "core/hid/input_converter.h" #include "core/hid/input_converter.h"

View File

@ -284,9 +284,15 @@ if (MSVC)
/we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data
) )
else() else()
target_compile_options(video_core PRIVATE if (APPLE)
-Werror=conversion # error: declaration shadows a typedef in 'interval_base_set<SubType, DomainT, Compare, Interval, Alloc>'
# error: implicit conversion loses integer precision: 'int' to 'boost::icl::bound_type' (aka 'unsigned char')
target_compile_options(video_core PRIVATE -Wno-shadow -Wno-unused-local-typedef)
else()
target_compile_options(video_core PRIVATE -Werror=conversion)
endif()
target_compile_options(video_core PRIVATE
-Wno-sign-conversion -Wno-sign-conversion
) )

View File

@ -2,12 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
#include <array> #include <array>
#include <bit>
#include <cmath> #include <cmath>
#include <span> #include <span>
#include <unordered_map> #include <unordered_map>
#include "common/assert.h" #include "common/assert.h"
#include "common/bit_cast.h"
#include "video_core/engines/sw_blitter/converter.h" #include "video_core/engines/sw_blitter/converter.h"
#include "video_core/surface.h" #include "video_core/surface.h"
#include "video_core/textures/decoders.h" #include "video_core/textures/decoders.h"
@ -693,21 +693,21 @@ private:
return shifted_value >> shift_amount; return shifted_value >> shift_amount;
}; };
const auto force_to_fp16 = [](f32 base_value) { const auto force_to_fp16 = [](f32 base_value) {
u32 tmp = std::bit_cast<u32>(base_value); u32 tmp = Common::BitCast<u32>(base_value);
constexpr size_t fp32_mantissa_bits = 23; constexpr size_t fp32_mantissa_bits = 23;
constexpr size_t fp16_mantissa_bits = 10; constexpr size_t fp16_mantissa_bits = 10;
constexpr size_t mantissa_mask = constexpr size_t mantissa_mask =
~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL);
tmp = tmp & static_cast<u32>(mantissa_mask); tmp = tmp & static_cast<u32>(mantissa_mask);
// TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM
return std::bit_cast<f32>(tmp); return Common::BitCast<f32>(tmp);
}; };
const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) {
constexpr size_t fp32_mantissa_bits = 23; constexpr size_t fp32_mantissa_bits = 23;
size_t shift_towards = fp32_mantissa_bits - mantissa; size_t shift_towards = fp32_mantissa_bits - mantissa;
const u32 new_value = const u32 new_value =
static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31));
return std::bit_cast<f32>(new_value); return Common::BitCast<f32>(new_value);
}; };
const auto calculate_snorm = [&]() { const auto calculate_snorm = [&]() {
return static_cast<f32>( return static_cast<f32>(
@ -737,13 +737,13 @@ private:
out_component = force_to_fp16(out_component); out_component = force_to_fp16(out_component);
} else if constexpr (component_types[which_component] == ComponentType::FLOAT) { } else if constexpr (component_types[which_component] == ComponentType::FLOAT) {
if constexpr (component_sizes[which_component] == 32) { if constexpr (component_sizes[which_component] == 32) {
out_component = std::bit_cast<f32>(value); out_component = Common::BitCast<f32>(value);
} else if constexpr (component_sizes[which_component] == 16) { } else if constexpr (component_sizes[which_component] == 16) {
static constexpr u32 sign_mask = 0x8000; static constexpr u32 sign_mask = 0x8000;
static constexpr u32 mantissa_mask = 0x8000; static constexpr u32 mantissa_mask = 0x8000;
out_component = std::bit_cast<f32>(((value & sign_mask) << 16) | out_component = Common::BitCast<f32>(((value & sign_mask) << 16) |
(((value & 0x7c00) + 0x1C000) << 13) | (((value & 0x7c00) + 0x1C000) << 13) |
((value & mantissa_mask) << 13)); ((value & mantissa_mask) << 13));
} else { } else {
out_component = from_fp_n(value, component_sizes[which_component], out_component = from_fp_n(value, component_sizes[which_component],
component_sizes[which_component] - 5); component_sizes[which_component] - 5);
@ -771,7 +771,7 @@ private:
}; };
const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) {
constexpr size_t fp32_mantissa_bits = 23; constexpr size_t fp32_mantissa_bits = 23;
u32 tmp_value = std::bit_cast<u32>(std::max(base_value, 0.0f)); u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f));
size_t shift_towards = fp32_mantissa_bits - mantissa; size_t shift_towards = fp32_mantissa_bits - mantissa;
return tmp_value >> shift_towards; return tmp_value >> shift_towards;
}; };
@ -799,13 +799,13 @@ private:
insert_to_word(tmp_word); insert_to_word(tmp_word);
} else if constexpr (component_types[which_component] == ComponentType::FLOAT) { } else if constexpr (component_types[which_component] == ComponentType::FLOAT) {
if constexpr (component_sizes[which_component] == 32) { if constexpr (component_sizes[which_component] == 32) {
u32 tmp_word = std::bit_cast<u32>(in_component); u32 tmp_word = Common::BitCast<u32>(in_component);
insert_to_word(tmp_word); insert_to_word(tmp_word);
} else if constexpr (component_sizes[which_component] == 16) { } else if constexpr (component_sizes[which_component] == 16) {
static constexpr u32 sign_mask = 0x8000; static constexpr u32 sign_mask = 0x8000;
static constexpr u32 mantissa_mask = 0x03ff; static constexpr u32 mantissa_mask = 0x03ff;
static constexpr u32 exponent_mask = 0x7c00; static constexpr u32 exponent_mask = 0x7c00;
const u32 tmp_word = std::bit_cast<u32>(in_component); const u32 tmp_word = Common::BitCast<u32>(in_component);
const u32 half = ((tmp_word >> 16) & sign_mask) | const u32 half = ((tmp_word >> 16) & sign_mask) |
((((tmp_word & 0x7f800000) - 0x38000000) >> 13) & exponent_mask) | ((((tmp_word & 0x7f800000) - 0x38000000) >> 13) & exponent_mask) |
((tmp_word >> 13) & mantissa_mask); ((tmp_word >> 13) & mantissa_mask);

View File

@ -46,8 +46,9 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
if (YUZU_USE_EXTERNAL_SDL2) if (YUZU_USE_EXTERNAL_SDL2)
target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2) target_link_libraries(yuzu-cmd PRIVATE SDL2-static)
target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include) else()
target_link_libraries(yuzu-cmd PRIVATE SDL2)
endif() endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)

View File

@ -12,12 +12,6 @@
#include "video_core/renderer_vulkan/renderer_vulkan.h" #include "video_core/renderer_vulkan/renderer_vulkan.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
#ifdef YUZU_USE_EXTERNAL_SDL2
// Include this before SDL.h to prevent the external from including a dummy
#define USING_GENERATED_CONFIG_H
#include <SDL_config.h>
#endif
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>