diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/thread.cpp | 12 | ||||
| -rw-r--r-- | src/common/thread.h | 9 | ||||
| -rw-r--r-- | src/core/cpu_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 3 | ||||
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 114 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_device.cpp | 15 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 2 |
7 files changed, 92 insertions, 65 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp index 8e5935e6a..d2c1ac60d 100644 --- a/src/common/thread.cpp +++ b/src/common/thread.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/common_funcs.h" | ||
| 6 | #include "common/logging/log.h" | ||
| 5 | #include "common/thread.h" | 7 | #include "common/thread.h" |
| 6 | #ifdef __APPLE__ | 8 | #ifdef __APPLE__ |
| 7 | #include <mach/mach.h> | 9 | #include <mach/mach.h> |
| @@ -19,6 +21,8 @@ | |||
| 19 | #include <unistd.h> | 21 | #include <unistd.h> |
| 20 | #endif | 22 | #endif |
| 21 | 23 | ||
| 24 | #include <string> | ||
| 25 | |||
| 22 | #ifdef __FreeBSD__ | 26 | #ifdef __FreeBSD__ |
| 23 | #define cpu_set_t cpuset_t | 27 | #define cpu_set_t cpuset_t |
| 24 | #endif | 28 | #endif |
| @@ -110,6 +114,14 @@ void SetCurrentThreadName(const char* name) { | |||
| 110 | pthread_set_name_np(pthread_self(), name); | 114 | pthread_set_name_np(pthread_self(), name); |
| 111 | #elif defined(__NetBSD__) | 115 | #elif defined(__NetBSD__) |
| 112 | pthread_setname_np(pthread_self(), "%s", (void*)name); | 116 | pthread_setname_np(pthread_self(), "%s", (void*)name); |
| 117 | #elif defined(__linux__) | ||
| 118 | // Linux limits thread names to 15 characters and will outright reject any | ||
| 119 | // attempt to set a longer name with ERANGE. | ||
| 120 | std::string truncated(name, std::min(strlen(name), static_cast<size_t>(15))); | ||
| 121 | if (int e = pthread_setname_np(pthread_self(), truncated.c_str())) { | ||
| 122 | errno = e; | ||
| 123 | LOG_ERROR(Common, "Failed to set thread name to '{}': {}", truncated, GetLastErrorMsg()); | ||
| 124 | } | ||
| 113 | #else | 125 | #else |
| 114 | pthread_setname_np(pthread_self(), name); | 126 | pthread_setname_np(pthread_self(), name); |
| 115 | #endif | 127 | #endif |
diff --git a/src/common/thread.h b/src/common/thread.h index 52b359413..a8c17c71a 100644 --- a/src/common/thread.h +++ b/src/common/thread.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <atomic> | ||
| 7 | #include <chrono> | 8 | #include <chrono> |
| 8 | #include <condition_variable> | 9 | #include <condition_variable> |
| 9 | #include <cstddef> | 10 | #include <cstddef> |
| @@ -25,13 +26,13 @@ public: | |||
| 25 | 26 | ||
| 26 | void Wait() { | 27 | void Wait() { |
| 27 | std::unique_lock lk{mutex}; | 28 | std::unique_lock lk{mutex}; |
| 28 | condvar.wait(lk, [&] { return is_set; }); | 29 | condvar.wait(lk, [&] { return is_set.load(); }); |
| 29 | is_set = false; | 30 | is_set = false; |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | bool WaitFor(const std::chrono::nanoseconds& time) { | 33 | bool WaitFor(const std::chrono::nanoseconds& time) { |
| 33 | std::unique_lock lk{mutex}; | 34 | std::unique_lock lk{mutex}; |
| 34 | if (!condvar.wait_for(lk, time, [this] { return is_set; })) | 35 | if (!condvar.wait_for(lk, time, [this] { return is_set.load(); })) |
| 35 | return false; | 36 | return false; |
| 36 | is_set = false; | 37 | is_set = false; |
| 37 | return true; | 38 | return true; |
| @@ -40,7 +41,7 @@ public: | |||
| 40 | template <class Clock, class Duration> | 41 | template <class Clock, class Duration> |
| 41 | bool WaitUntil(const std::chrono::time_point<Clock, Duration>& time) { | 42 | bool WaitUntil(const std::chrono::time_point<Clock, Duration>& time) { |
| 42 | std::unique_lock lk{mutex}; | 43 | std::unique_lock lk{mutex}; |
| 43 | if (!condvar.wait_until(lk, time, [this] { return is_set; })) | 44 | if (!condvar.wait_until(lk, time, [this] { return is_set.load(); })) |
| 44 | return false; | 45 | return false; |
| 45 | is_set = false; | 46 | is_set = false; |
| 46 | return true; | 47 | return true; |
| @@ -54,9 +55,9 @@ public: | |||
| 54 | } | 55 | } |
| 55 | 56 | ||
| 56 | private: | 57 | private: |
| 57 | bool is_set = false; | ||
| 58 | std::condition_variable condvar; | 58 | std::condition_variable condvar; |
| 59 | std::mutex mutex; | 59 | std::mutex mutex; |
| 60 | std::atomic_bool is_set{false}; | ||
| 60 | }; | 61 | }; |
| 61 | 62 | ||
| 62 | class Barrier { | 63 | class Barrier { |
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp index ef0bae556..688b99eba 100644 --- a/src/core/cpu_manager.cpp +++ b/src/core/cpu_manager.cpp | |||
| @@ -328,7 +328,7 @@ void CpuManager::RunThread(std::size_t core) { | |||
| 328 | system.RegisterCoreThread(core); | 328 | system.RegisterCoreThread(core); |
| 329 | std::string name; | 329 | std::string name; |
| 330 | if (is_multicore) { | 330 | if (is_multicore) { |
| 331 | name = "yuzu:CoreCPUThread_" + std::to_string(core); | 331 | name = "yuzu:CPUCore_" + std::to_string(core); |
| 332 | } else { | 332 | } else { |
| 333 | name = "yuzu:CPUThread"; | 333 | name = "yuzu:CPUThread"; |
| 334 | } | 334 | } |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index cabe8d418..f2b0fe2fd 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -219,6 +219,7 @@ struct KernelCore::Impl { | |||
| 219 | return static_cast<u32>(system.GetCpuManager().CurrentCore()); | 219 | return static_cast<u32>(system.GetCpuManager().CurrentCore()); |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
| 222 | std::unique_lock lock{register_thread_mutex}; | ||
| 222 | const auto it = host_thread_ids.find(this_id); | 223 | const auto it = host_thread_ids.find(this_id); |
| 223 | if (it == host_thread_ids.end()) { | 224 | if (it == host_thread_ids.end()) { |
| 224 | return Core::INVALID_HOST_THREAD_ID; | 225 | return Core::INVALID_HOST_THREAD_ID; |
| @@ -324,7 +325,7 @@ struct KernelCore::Impl { | |||
| 324 | std::unordered_map<std::thread::id, u32> host_thread_ids; | 325 | std::unordered_map<std::thread::id, u32> host_thread_ids; |
| 325 | u32 registered_thread_ids{Core::Hardware::NUM_CPU_CORES}; | 326 | u32 registered_thread_ids{Core::Hardware::NUM_CPU_CORES}; |
| 326 | std::bitset<Core::Hardware::NUM_CPU_CORES> registered_core_threads; | 327 | std::bitset<Core::Hardware::NUM_CPU_CORES> registered_core_threads; |
| 327 | std::mutex register_thread_mutex; | 328 | mutable std::mutex register_thread_mutex; |
| 328 | 329 | ||
| 329 | // Kernel memory management | 330 | // Kernel memory management |
| 330 | std::unique_ptr<Memory::MemoryManager> memory_manager; | 331 | std::unique_ptr<Memory::MemoryManager> memory_manager; |
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index c8d9eb2bc..a9e676f4b 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <array> | ||
| 6 | #include <atomic> | 7 | #include <atomic> |
| 7 | #include <cmath> | 8 | #include <cmath> |
| 8 | #include <functional> | 9 | #include <functional> |
| @@ -358,7 +359,7 @@ public: | |||
| 358 | return std::make_tuple(x / r * (r - deadzone) / (1 - deadzone), | 359 | return std::make_tuple(x / r * (r - deadzone) / (1 - deadzone), |
| 359 | y / r * (r - deadzone) / (1 - deadzone)); | 360 | y / r * (r - deadzone) / (1 - deadzone)); |
| 360 | } | 361 | } |
| 361 | return std::make_tuple<float, float>(0.0f, 0.0f); | 362 | return {}; |
| 362 | } | 363 | } |
| 363 | 364 | ||
| 364 | bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { | 365 | bool GetAnalogDirectionStatus(Input::AnalogDirection direction) const override { |
| @@ -574,10 +575,10 @@ std::vector<Common::ParamPackage> SDLState::GetInputDevices() { | |||
| 574 | 575 | ||
| 575 | namespace { | 576 | namespace { |
| 576 | Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid, u8 axis, | 577 | Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid, u8 axis, |
| 577 | float value = 0.1) { | 578 | float value = 0.1f) { |
| 578 | Common::ParamPackage params({{"engine", "sdl"}}); | 579 | Common::ParamPackage params({{"engine", "sdl"}}); |
| 579 | params.Set("port", port); | 580 | params.Set("port", port); |
| 580 | params.Set("guid", guid); | 581 | params.Set("guid", std::move(guid)); |
| 581 | params.Set("axis", axis); | 582 | params.Set("axis", axis); |
| 582 | if (value > 0) { | 583 | if (value > 0) { |
| 583 | params.Set("direction", "+"); | 584 | params.Set("direction", "+"); |
| @@ -592,7 +593,7 @@ Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid | |||
| 592 | Common::ParamPackage BuildButtonParamPackageForButton(int port, std::string guid, u8 button) { | 593 | Common::ParamPackage BuildButtonParamPackageForButton(int port, std::string guid, u8 button) { |
| 593 | Common::ParamPackage params({{"engine", "sdl"}}); | 594 | Common::ParamPackage params({{"engine", "sdl"}}); |
| 594 | params.Set("port", port); | 595 | params.Set("port", port); |
| 595 | params.Set("guid", guid); | 596 | params.Set("guid", std::move(guid)); |
| 596 | params.Set("button", button); | 597 | params.Set("button", button); |
| 597 | return params; | 598 | return params; |
| 598 | } | 599 | } |
| @@ -601,7 +602,7 @@ Common::ParamPackage BuildHatParamPackageForButton(int port, std::string guid, u | |||
| 601 | Common::ParamPackage params({{"engine", "sdl"}}); | 602 | Common::ParamPackage params({{"engine", "sdl"}}); |
| 602 | 603 | ||
| 603 | params.Set("port", port); | 604 | params.Set("port", port); |
| 604 | params.Set("guid", guid); | 605 | params.Set("guid", std::move(guid)); |
| 605 | params.Set("hat", hat); | 606 | params.Set("hat", hat); |
| 606 | switch (value) { | 607 | switch (value) { |
| 607 | case SDL_HAT_UP: | 608 | case SDL_HAT_UP: |
| @@ -670,55 +671,62 @@ Common::ParamPackage BuildParamPackageForAnalog(int port, const std::string& gui | |||
| 670 | } // Anonymous namespace | 671 | } // Anonymous namespace |
| 671 | 672 | ||
| 672 | ButtonMapping SDLState::GetButtonMappingForDevice(const Common::ParamPackage& params) { | 673 | ButtonMapping SDLState::GetButtonMappingForDevice(const Common::ParamPackage& params) { |
| 673 | // This list is missing ZL/ZR since those are not considered buttons in SDL GameController. | ||
| 674 | // We will add those afterwards | ||
| 675 | // This list also excludes Screenshot since theres not really a mapping for that | ||
| 676 | std::unordered_map<Settings::NativeButton::Values, SDL_GameControllerButton> | ||
| 677 | switch_to_sdl_button = { | ||
| 678 | {Settings::NativeButton::A, SDL_CONTROLLER_BUTTON_B}, | ||
| 679 | {Settings::NativeButton::B, SDL_CONTROLLER_BUTTON_A}, | ||
| 680 | {Settings::NativeButton::X, SDL_CONTROLLER_BUTTON_Y}, | ||
| 681 | {Settings::NativeButton::Y, SDL_CONTROLLER_BUTTON_X}, | ||
| 682 | {Settings::NativeButton::LStick, SDL_CONTROLLER_BUTTON_LEFTSTICK}, | ||
| 683 | {Settings::NativeButton::RStick, SDL_CONTROLLER_BUTTON_RIGHTSTICK}, | ||
| 684 | {Settings::NativeButton::L, SDL_CONTROLLER_BUTTON_LEFTSHOULDER}, | ||
| 685 | {Settings::NativeButton::R, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER}, | ||
| 686 | {Settings::NativeButton::Plus, SDL_CONTROLLER_BUTTON_START}, | ||
| 687 | {Settings::NativeButton::Minus, SDL_CONTROLLER_BUTTON_BACK}, | ||
| 688 | {Settings::NativeButton::DLeft, SDL_CONTROLLER_BUTTON_DPAD_LEFT}, | ||
| 689 | {Settings::NativeButton::DUp, SDL_CONTROLLER_BUTTON_DPAD_UP}, | ||
| 690 | {Settings::NativeButton::DRight, SDL_CONTROLLER_BUTTON_DPAD_RIGHT}, | ||
| 691 | {Settings::NativeButton::DDown, SDL_CONTROLLER_BUTTON_DPAD_DOWN}, | ||
| 692 | {Settings::NativeButton::SL, SDL_CONTROLLER_BUTTON_LEFTSHOULDER}, | ||
| 693 | {Settings::NativeButton::SR, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER}, | ||
| 694 | {Settings::NativeButton::Home, SDL_CONTROLLER_BUTTON_GUIDE}, | ||
| 695 | }; | ||
| 696 | if (!params.Has("guid") || !params.Has("port")) { | 674 | if (!params.Has("guid") || !params.Has("port")) { |
| 697 | return {}; | 675 | return {}; |
| 698 | } | 676 | } |
| 699 | const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0)); | 677 | const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0)); |
| 700 | auto controller = joystick->GetSDLGameController(); | 678 | auto* controller = joystick->GetSDLGameController(); |
| 701 | if (!controller) { | 679 | if (controller == nullptr) { |
| 702 | return {}; | 680 | return {}; |
| 703 | } | 681 | } |
| 704 | 682 | ||
| 705 | ButtonMapping mapping{}; | 683 | // This list is missing ZL/ZR since those are not considered buttons in SDL GameController. |
| 684 | // We will add those afterwards | ||
| 685 | // This list also excludes Screenshot since theres not really a mapping for that | ||
| 686 | using ButtonBindings = | ||
| 687 | std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerButton>, 17>; | ||
| 688 | static constexpr ButtonBindings switch_to_sdl_button{{ | ||
| 689 | {Settings::NativeButton::A, SDL_CONTROLLER_BUTTON_B}, | ||
| 690 | {Settings::NativeButton::B, SDL_CONTROLLER_BUTTON_A}, | ||
| 691 | {Settings::NativeButton::X, SDL_CONTROLLER_BUTTON_Y}, | ||
| 692 | {Settings::NativeButton::Y, SDL_CONTROLLER_BUTTON_X}, | ||
| 693 | {Settings::NativeButton::LStick, SDL_CONTROLLER_BUTTON_LEFTSTICK}, | ||
| 694 | {Settings::NativeButton::RStick, SDL_CONTROLLER_BUTTON_RIGHTSTICK}, | ||
| 695 | {Settings::NativeButton::L, SDL_CONTROLLER_BUTTON_LEFTSHOULDER}, | ||
| 696 | {Settings::NativeButton::R, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER}, | ||
| 697 | {Settings::NativeButton::Plus, SDL_CONTROLLER_BUTTON_START}, | ||
| 698 | {Settings::NativeButton::Minus, SDL_CONTROLLER_BUTTON_BACK}, | ||
| 699 | {Settings::NativeButton::DLeft, SDL_CONTROLLER_BUTTON_DPAD_LEFT}, | ||
| 700 | {Settings::NativeButton::DUp, SDL_CONTROLLER_BUTTON_DPAD_UP}, | ||
| 701 | {Settings::NativeButton::DRight, SDL_CONTROLLER_BUTTON_DPAD_RIGHT}, | ||
| 702 | {Settings::NativeButton::DDown, SDL_CONTROLLER_BUTTON_DPAD_DOWN}, | ||
| 703 | {Settings::NativeButton::SL, SDL_CONTROLLER_BUTTON_LEFTSHOULDER}, | ||
| 704 | {Settings::NativeButton::SR, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER}, | ||
| 705 | {Settings::NativeButton::Home, SDL_CONTROLLER_BUTTON_GUIDE}, | ||
| 706 | }}; | ||
| 707 | |||
| 708 | // Add the missing bindings for ZL/ZR | ||
| 709 | using ZBindings = | ||
| 710 | std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerAxis>, 2>; | ||
| 711 | static constexpr ZBindings switch_to_sdl_axis{{ | ||
| 712 | {Settings::NativeButton::ZL, SDL_CONTROLLER_AXIS_TRIGGERLEFT}, | ||
| 713 | {Settings::NativeButton::ZR, SDL_CONTROLLER_AXIS_TRIGGERRIGHT}, | ||
| 714 | }}; | ||
| 715 | |||
| 716 | ButtonMapping mapping; | ||
| 717 | mapping.reserve(switch_to_sdl_button.size() + switch_to_sdl_axis.size()); | ||
| 718 | |||
| 706 | for (const auto& [switch_button, sdl_button] : switch_to_sdl_button) { | 719 | for (const auto& [switch_button, sdl_button] : switch_to_sdl_button) { |
| 707 | const auto& binding = SDL_GameControllerGetBindForButton(controller, sdl_button); | 720 | const auto& binding = SDL_GameControllerGetBindForButton(controller, sdl_button); |
| 708 | mapping[switch_button] = | 721 | mapping.insert_or_assign( |
| 709 | BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding); | 722 | switch_button, |
| 723 | BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding)); | ||
| 710 | } | 724 | } |
| 711 | |||
| 712 | // Add the missing bindings for ZL/ZR | ||
| 713 | std::unordered_map<Settings::NativeButton::Values, SDL_GameControllerAxis> switch_to_sdl_axis = | ||
| 714 | { | ||
| 715 | {Settings::NativeButton::ZL, SDL_CONTROLLER_AXIS_TRIGGERLEFT}, | ||
| 716 | {Settings::NativeButton::ZR, SDL_CONTROLLER_AXIS_TRIGGERRIGHT}, | ||
| 717 | }; | ||
| 718 | for (const auto& [switch_button, sdl_axis] : switch_to_sdl_axis) { | 725 | for (const auto& [switch_button, sdl_axis] : switch_to_sdl_axis) { |
| 719 | const auto& binding = SDL_GameControllerGetBindForAxis(controller, sdl_axis); | 726 | const auto& binding = SDL_GameControllerGetBindForAxis(controller, sdl_axis); |
| 720 | mapping[switch_button] = | 727 | mapping.insert_or_assign( |
| 721 | BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding); | 728 | switch_button, |
| 729 | BuildParamPackageForBinding(joystick->GetPort(), joystick->GetGUID(), binding)); | ||
| 722 | } | 730 | } |
| 723 | 731 | ||
| 724 | return mapping; | 732 | return mapping; |
| @@ -729,8 +737,8 @@ AnalogMapping SDLState::GetAnalogMappingForDevice(const Common::ParamPackage& pa | |||
| 729 | return {}; | 737 | return {}; |
| 730 | } | 738 | } |
| 731 | const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0)); | 739 | const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0)); |
| 732 | auto controller = joystick->GetSDLGameController(); | 740 | auto* controller = joystick->GetSDLGameController(); |
| 733 | if (!controller) { | 741 | if (controller == nullptr) { |
| 734 | return {}; | 742 | return {}; |
| 735 | } | 743 | } |
| 736 | 744 | ||
| @@ -739,16 +747,18 @@ AnalogMapping SDLState::GetAnalogMappingForDevice(const Common::ParamPackage& pa | |||
| 739 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTX); | 747 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTX); |
| 740 | const auto& binding_left_y = | 748 | const auto& binding_left_y = |
| 741 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTY); | 749 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTY); |
| 742 | mapping[Settings::NativeAnalog::LStick] = | 750 | mapping.insert_or_assign(Settings::NativeAnalog::LStick, |
| 743 | BuildParamPackageForAnalog(joystick->GetPort(), joystick->GetGUID(), | 751 | BuildParamPackageForAnalog(joystick->GetPort(), joystick->GetGUID(), |
| 744 | binding_left_x.value.axis, binding_left_y.value.axis); | 752 | binding_left_x.value.axis, |
| 753 | binding_left_y.value.axis)); | ||
| 745 | const auto& binding_right_x = | 754 | const auto& binding_right_x = |
| 746 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_RIGHTX); | 755 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_RIGHTX); |
| 747 | const auto& binding_right_y = | 756 | const auto& binding_right_y = |
| 748 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_RIGHTY); | 757 | SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_RIGHTY); |
| 749 | mapping[Settings::NativeAnalog::RStick] = | 758 | mapping.insert_or_assign(Settings::NativeAnalog::RStick, |
| 750 | BuildParamPackageForAnalog(joystick->GetPort(), joystick->GetGUID(), | 759 | BuildParamPackageForAnalog(joystick->GetPort(), joystick->GetGUID(), |
| 751 | binding_right_x.value.axis, binding_right_y.value.axis); | 760 | binding_right_x.value.axis, |
| 761 | binding_right_y.value.axis)); | ||
| 752 | return mapping; | 762 | return mapping; |
| 753 | } | 763 | } |
| 754 | 764 | ||
| @@ -784,7 +794,7 @@ public: | |||
| 784 | } | 794 | } |
| 785 | return {}; | 795 | return {}; |
| 786 | } | 796 | } |
| 787 | std::optional<Common::ParamPackage> FromEvent(const SDL_Event& event) { | 797 | [[nodiscard]] std::optional<Common::ParamPackage> FromEvent(const SDL_Event& event) const { |
| 788 | switch (event.type) { | 798 | switch (event.type) { |
| 789 | case SDL_JOYAXISMOTION: | 799 | case SDL_JOYAXISMOTION: |
| 790 | if (std::abs(event.jaxis.value / 32767.0) < 0.5) { | 800 | if (std::abs(event.jaxis.value / 32767.0) < 0.5) { |
| @@ -795,7 +805,7 @@ public: | |||
| 795 | case SDL_JOYHATMOTION: | 805 | case SDL_JOYHATMOTION: |
| 796 | return {SDLEventToButtonParamPackage(state, event)}; | 806 | return {SDLEventToButtonParamPackage(state, event)}; |
| 797 | } | 807 | } |
| 798 | return {}; | 808 | return std::nullopt; |
| 799 | } | 809 | } |
| 800 | }; | 810 | }; |
| 801 | 811 | ||
diff --git a/src/video_core/renderer_vulkan/vk_device.cpp b/src/video_core/renderer_vulkan/vk_device.cpp index 030b4dbd3..4205bd573 100644 --- a/src/video_core/renderer_vulkan/vk_device.cpp +++ b/src/video_core/renderer_vulkan/vk_device.cpp | |||
| @@ -380,6 +380,14 @@ bool VKDevice::Create() { | |||
| 380 | 380 | ||
| 381 | CollectTelemetryParameters(); | 381 | CollectTelemetryParameters(); |
| 382 | 382 | ||
| 383 | if (ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_AMD_PROPRIETARY_KHR) { | ||
| 384 | // AMD's proprietary driver supports VK_EXT_extended_dynamic_state but the <stride> field | ||
| 385 | // seems to be bugged. Blacklisting it for now. | ||
| 386 | LOG_WARNING(Render_Vulkan, | ||
| 387 | "Blacklisting AMD proprietary from VK_EXT_extended_dynamic_state"); | ||
| 388 | ext_extended_dynamic_state = false; | ||
| 389 | } | ||
| 390 | |||
| 383 | graphics_queue = logical.GetQueue(graphics_family); | 391 | graphics_queue = logical.GetQueue(graphics_family); |
| 384 | present_queue = logical.GetQueue(present_family); | 392 | present_queue = logical.GetQueue(present_family); |
| 385 | 393 | ||
| @@ -691,12 +699,7 @@ std::vector<const char*> VKDevice::LoadExtensions() { | |||
| 691 | } | 699 | } |
| 692 | } | 700 | } |
| 693 | 701 | ||
| 694 | if (has_ext_extended_dynamic_state && driver_id == VK_DRIVER_ID_AMD_PROPRIETARY) { | 702 | if (has_ext_extended_dynamic_state) { |
| 695 | // AMD's proprietary driver supports VK_EXT_extended_dynamic_state but the <stride> field | ||
| 696 | // seems to be bugged. Blacklisting it for now. | ||
| 697 | LOG_WARNING(Render_Vulkan, | ||
| 698 | "Blacklisting AMD proprietary from VK_EXT_extended_dynamic_state"); | ||
| 699 | } else if (has_ext_extended_dynamic_state) { | ||
| 700 | VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state; | 703 | VkPhysicalDeviceExtendedDynamicStateFeaturesEXT dynamic_state; |
| 701 | dynamic_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; | 704 | dynamic_state.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT; |
| 702 | dynamic_state.pNext = nullptr; | 705 | dynamic_state.pNext = nullptr; |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 32b548c56..21707e451 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -452,7 +452,7 @@ void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) { | |||
| 452 | int active_points = 0; | 452 | int active_points = 0; |
| 453 | 453 | ||
| 454 | // average all active touch points | 454 | // average all active touch points |
| 455 | for (const auto tp : event->touchPoints()) { | 455 | for (const auto& tp : event->touchPoints()) { |
| 456 | if (tp.state() & (Qt::TouchPointPressed | Qt::TouchPointMoved | Qt::TouchPointStationary)) { | 456 | if (tp.state() & (Qt::TouchPointPressed | Qt::TouchPointMoved | Qt::TouchPointStationary)) { |
| 457 | active_points++; | 457 | active_points++; |
| 458 | pos += tp.pos(); | 458 | pos += tp.pos(); |