diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 10 | ||||
| -rw-r--r-- | src/video_core/engines/sw_blitter/converter.cpp | 22 | ||||
| -rw-r--r-- | src/yuzu_cmd/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | 6 |
5 files changed, 23 insertions, 21 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index c96d9eef3..9779378be 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <algorithm> | 4 | #include <algorithm> |
| 5 | 5 | ||
| 6 | #include "common/polyfill_ranges.h" | ||
| 6 | #include "common/thread.h" | 7 | #include "common/thread.h" |
| 7 | #include "core/hid/emulated_controller.h" | 8 | #include "core/hid/emulated_controller.h" |
| 8 | #include "core/hid/input_converter.h" | 9 | #include "core/hid/input_converter.h" |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 6ecc8dbff..b9bad63ac 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -284,9 +284,15 @@ if (MSVC) | |||
| 284 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data | 284 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 285 | ) | 285 | ) |
| 286 | else() | 286 | else() |
| 287 | target_compile_options(video_core PRIVATE | 287 | if (APPLE) |
| 288 | -Werror=conversion | 288 | # error: declaration shadows a typedef in 'interval_base_set<SubType, DomainT, Compare, Interval, Alloc>' |
| 289 | # error: implicit conversion loses integer precision: 'int' to 'boost::icl::bound_type' (aka 'unsigned char') | ||
| 290 | target_compile_options(video_core PRIVATE -Wno-shadow -Wno-unused-local-typedef) | ||
| 291 | else() | ||
| 292 | target_compile_options(video_core PRIVATE -Werror=conversion) | ||
| 293 | endif() | ||
| 289 | 294 | ||
| 295 | target_compile_options(video_core PRIVATE | ||
| 290 | -Wno-sign-conversion | 296 | -Wno-sign-conversion |
| 291 | ) | 297 | ) |
| 292 | 298 | ||
diff --git a/src/video_core/engines/sw_blitter/converter.cpp b/src/video_core/engines/sw_blitter/converter.cpp index cd46dfd4f..2419b5632 100644 --- a/src/video_core/engines/sw_blitter/converter.cpp +++ b/src/video_core/engines/sw_blitter/converter.cpp | |||
| @@ -2,12 +2,12 @@ | |||
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include <array> | 4 | #include <array> |
| 5 | #include <bit> | ||
| 6 | #include <cmath> | 5 | #include <cmath> |
| 7 | #include <span> | 6 | #include <span> |
| 8 | #include <unordered_map> | 7 | #include <unordered_map> |
| 9 | 8 | ||
| 10 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/bit_cast.h" | ||
| 11 | #include "video_core/engines/sw_blitter/converter.h" | 11 | #include "video_core/engines/sw_blitter/converter.h" |
| 12 | #include "video_core/surface.h" | 12 | #include "video_core/surface.h" |
| 13 | #include "video_core/textures/decoders.h" | 13 | #include "video_core/textures/decoders.h" |
| @@ -693,21 +693,21 @@ private: | |||
| 693 | return shifted_value >> shift_amount; | 693 | return shifted_value >> shift_amount; |
| 694 | }; | 694 | }; |
| 695 | const auto force_to_fp16 = [](f32 base_value) { | 695 | const auto force_to_fp16 = [](f32 base_value) { |
| 696 | u32 tmp = std::bit_cast<u32>(base_value); | 696 | u32 tmp = Common::BitCast<u32>(base_value); |
| 697 | constexpr size_t fp32_mantissa_bits = 23; | 697 | constexpr size_t fp32_mantissa_bits = 23; |
| 698 | constexpr size_t fp16_mantissa_bits = 10; | 698 | constexpr size_t fp16_mantissa_bits = 10; |
| 699 | constexpr size_t mantissa_mask = | 699 | constexpr size_t mantissa_mask = |
| 700 | ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); | 700 | ~((1ULL << (fp32_mantissa_bits - fp16_mantissa_bits)) - 1ULL); |
| 701 | tmp = tmp & static_cast<u32>(mantissa_mask); | 701 | tmp = tmp & static_cast<u32>(mantissa_mask); |
| 702 | // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM | 702 | // TODO: force the exponent within the range of half float. Not needed in UNORM / SNORM |
| 703 | return std::bit_cast<f32>(tmp); | 703 | return Common::BitCast<f32>(tmp); |
| 704 | }; | 704 | }; |
| 705 | const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { | 705 | const auto from_fp_n = [&sign_extend](u32 base_value, size_t bits, size_t mantissa) { |
| 706 | constexpr size_t fp32_mantissa_bits = 23; | 706 | constexpr size_t fp32_mantissa_bits = 23; |
| 707 | size_t shift_towards = fp32_mantissa_bits - mantissa; | 707 | size_t shift_towards = fp32_mantissa_bits - mantissa; |
| 708 | const u32 new_value = | 708 | const u32 new_value = |
| 709 | static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); | 709 | static_cast<u32>(sign_extend(base_value, bits) << shift_towards) & (~(1U << 31)); |
| 710 | return std::bit_cast<f32>(new_value); | 710 | return Common::BitCast<f32>(new_value); |
| 711 | }; | 711 | }; |
| 712 | const auto calculate_snorm = [&]() { | 712 | const auto calculate_snorm = [&]() { |
| 713 | return static_cast<f32>( | 713 | return static_cast<f32>( |
| @@ -737,13 +737,13 @@ private: | |||
| 737 | out_component = force_to_fp16(out_component); | 737 | out_component = force_to_fp16(out_component); |
| 738 | } else if constexpr (component_types[which_component] == ComponentType::FLOAT) { | 738 | } else if constexpr (component_types[which_component] == ComponentType::FLOAT) { |
| 739 | if constexpr (component_sizes[which_component] == 32) { | 739 | if constexpr (component_sizes[which_component] == 32) { |
| 740 | out_component = std::bit_cast<f32>(value); | 740 | out_component = Common::BitCast<f32>(value); |
| 741 | } else if constexpr (component_sizes[which_component] == 16) { | 741 | } else if constexpr (component_sizes[which_component] == 16) { |
| 742 | static constexpr u32 sign_mask = 0x8000; | 742 | static constexpr u32 sign_mask = 0x8000; |
| 743 | static constexpr u32 mantissa_mask = 0x8000; | 743 | static constexpr u32 mantissa_mask = 0x8000; |
| 744 | out_component = std::bit_cast<f32>(((value & sign_mask) << 16) | | 744 | out_component = Common::BitCast<f32>(((value & sign_mask) << 16) | |
| 745 | (((value & 0x7c00) + 0x1C000) << 13) | | 745 | (((value & 0x7c00) + 0x1C000) << 13) | |
| 746 | ((value & mantissa_mask) << 13)); | 746 | ((value & mantissa_mask) << 13)); |
| 747 | } else { | 747 | } else { |
| 748 | out_component = from_fp_n(value, component_sizes[which_component], | 748 | out_component = from_fp_n(value, component_sizes[which_component], |
| 749 | component_sizes[which_component] - 5); | 749 | component_sizes[which_component] - 5); |
| @@ -771,7 +771,7 @@ private: | |||
| 771 | }; | 771 | }; |
| 772 | const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { | 772 | const auto to_fp_n = [](f32 base_value, size_t bits, size_t mantissa) { |
| 773 | constexpr size_t fp32_mantissa_bits = 23; | 773 | constexpr size_t fp32_mantissa_bits = 23; |
| 774 | u32 tmp_value = std::bit_cast<u32>(std::max(base_value, 0.0f)); | 774 | u32 tmp_value = Common::BitCast<u32>(std::max(base_value, 0.0f)); |
| 775 | size_t shift_towards = fp32_mantissa_bits - mantissa; | 775 | size_t shift_towards = fp32_mantissa_bits - mantissa; |
| 776 | return tmp_value >> shift_towards; | 776 | return tmp_value >> shift_towards; |
| 777 | }; | 777 | }; |
| @@ -799,13 +799,13 @@ private: | |||
| 799 | insert_to_word(tmp_word); | 799 | insert_to_word(tmp_word); |
| 800 | } else if constexpr (component_types[which_component] == ComponentType::FLOAT) { | 800 | } else if constexpr (component_types[which_component] == ComponentType::FLOAT) { |
| 801 | if constexpr (component_sizes[which_component] == 32) { | 801 | if constexpr (component_sizes[which_component] == 32) { |
| 802 | u32 tmp_word = std::bit_cast<u32>(in_component); | 802 | u32 tmp_word = Common::BitCast<u32>(in_component); |
| 803 | insert_to_word(tmp_word); | 803 | insert_to_word(tmp_word); |
| 804 | } else if constexpr (component_sizes[which_component] == 16) { | 804 | } else if constexpr (component_sizes[which_component] == 16) { |
| 805 | static constexpr u32 sign_mask = 0x8000; | 805 | static constexpr u32 sign_mask = 0x8000; |
| 806 | static constexpr u32 mantissa_mask = 0x03ff; | 806 | static constexpr u32 mantissa_mask = 0x03ff; |
| 807 | static constexpr u32 exponent_mask = 0x7c00; | 807 | static constexpr u32 exponent_mask = 0x7c00; |
| 808 | const u32 tmp_word = std::bit_cast<u32>(in_component); | 808 | const u32 tmp_word = Common::BitCast<u32>(in_component); |
| 809 | const u32 half = ((tmp_word >> 16) & sign_mask) | | 809 | const u32 half = ((tmp_word >> 16) & sign_mask) | |
| 810 | ((((tmp_word & 0x7f800000) - 0x38000000) >> 13) & exponent_mask) | | 810 | ((((tmp_word & 0x7f800000) - 0x38000000) >> 13) & exponent_mask) | |
| 811 | ((tmp_word >> 13) & mantissa_mask); | 811 | ((tmp_word >> 13) & mantissa_mask); |
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index 13b673186..607b4e6aa 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt | |||
| @@ -46,8 +46,9 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR}) | |||
| 46 | target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) | 46 | target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) |
| 47 | 47 | ||
| 48 | if (YUZU_USE_EXTERNAL_SDL2) | 48 | if (YUZU_USE_EXTERNAL_SDL2) |
| 49 | target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2) | 49 | target_link_libraries(yuzu-cmd PRIVATE SDL2-static) |
| 50 | target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include) | 50 | else() |
| 51 | target_link_libraries(yuzu-cmd PRIVATE SDL2) | ||
| 51 | endif() | 52 | endif() |
| 52 | 53 | ||
| 53 | if(UNIX AND NOT APPLE) | 54 | if(UNIX AND NOT APPLE) |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp index 0d580fe4f..9ed47d453 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | |||
| @@ -12,12 +12,6 @@ | |||
| 12 | #include "video_core/renderer_vulkan/renderer_vulkan.h" | 12 | #include "video_core/renderer_vulkan/renderer_vulkan.h" |
| 13 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" | 13 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" |
| 14 | 14 | ||
| 15 | #ifdef YUZU_USE_EXTERNAL_SDL2 | ||
| 16 | // Include this before SDL.h to prevent the external from including a dummy | ||
| 17 | #define USING_GENERATED_CONFIG_H | ||
| 18 | #include <SDL_config.h> | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #include <SDL.h> | 15 | #include <SDL.h> |
| 22 | #include <SDL_syswm.h> | 16 | #include <SDL_syswm.h> |
| 23 | 17 | ||