diff options
m--------- | externals/cubeb | 0 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 25 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_swapchain.cpp | 4 | ||||
-rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 19 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_hotkeys.cpp | 65 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_hotkeys.h | 2 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 18 | ||||
-rw-r--r-- | src/yuzu/main.h | 3 |
8 files changed, 83 insertions, 53 deletions
diff --git a/externals/cubeb b/externals/cubeb -Subproject 75d9d125ee655ef80f3bfcd97ae5a805931042b +Subproject 2d817de7c58b33a7c045edf873f3f9c98e4a208 diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 64bd2f6a5..8d3a9736b 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -348,25 +348,12 @@ void RasterizerVulkan::Clear(u32 layer_count) { const u32 color_attachment = regs.clear_surface.RT; if (use_color && framebuffer->HasAspectColorBit(color_attachment)) { - VkClearValue clear_value; - bool is_integer = false; - bool is_signed = false; - size_t int_size = 8; - for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) { - const auto& this_rt = regs.rt[i]; - if (this_rt.Address() == 0) { - continue; - } - if (this_rt.format == Tegra::RenderTargetFormat::NONE) { - continue; - } - const auto format = - VideoCore::Surface::PixelFormatFromRenderTargetFormat(this_rt.format); - is_integer = IsPixelFormatInteger(format); - is_signed = IsPixelFormatSignedInteger(format); - int_size = PixelComponentSizeBitsInteger(format); - break; - } + const auto format = + VideoCore::Surface::PixelFormatFromRenderTargetFormat(regs.rt[color_attachment].format); + bool is_integer = IsPixelFormatInteger(format); + bool is_signed = IsPixelFormatSignedInteger(format); + size_t int_size = PixelComponentSizeBitsInteger(format); + VkClearValue clear_value{}; if (!is_integer) { std::memcpy(clear_value.color.float32, regs.clear_color.data(), regs.clear_color.size() * sizeof(f32)); diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index 1e80ce463..8c0dec590 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -34,8 +34,8 @@ VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats) return found != formats.end() ? *found : formats[0]; } -static constexpr VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox, - bool has_fifo_relaxed) { +static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox, + bool has_fifo_relaxed) { // Mailbox doesn't lock the application like FIFO (vsync) // FIFO present mode locks the framerate to the monitor's refresh rate Settings::VSyncMode setting = [has_imm, has_mailbox]() { diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 161f050b8..f6e6f2736 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -406,6 +406,14 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false; features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false; dynamic_state3_blending = false; + + const u32 version = (properties.properties.driverVersion << 3) >> 3; + if (version < VK_MAKE_API_VERSION(0, 23, 1, 0)) { + LOG_WARNING(Render_Vulkan, + "RADV versions older than 23.1.0 have broken depth clamp dynamic state"); + features.extended_dynamic_state3.extendedDynamicState3DepthClampEnable = false; + dynamic_state3_enables = false; + } } if (extensions.vertex_input_dynamic_state && is_radv) { // TODO(ameerj): Blacklist only offending driver versions @@ -463,6 +471,17 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); must_emulate_bgr565 = true; } + if (extensions.push_descriptor && is_intel_anv) { + const u32 version = (properties.properties.driverVersion << 3) >> 3; + if (version >= VK_MAKE_API_VERSION(0, 22, 3, 0)) { + // Disable VK_KHR_push_descriptor due to + // mesa/mesa/-/commit/ff91c5ca42bc80aa411cb3fd8f550aa6fdd16bdc + LOG_WARNING(Render_Vulkan, + "ANV drivers 22.3.0 and later have broken VK_KHR_push_descriptor"); + extensions.push_descriptor = false; + loaded_extensions.erase(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME); + } + } if (is_mvk) { LOG_WARNING(Render_Vulkan, "MVK driver breaks when using more than 16 vertex attributes/bindings"); diff --git a/src/yuzu/configuration/configure_hotkeys.cpp b/src/yuzu/configuration/configure_hotkeys.cpp index daa77a8f8..0b2a965f8 100644 --- a/src/yuzu/configuration/configure_hotkeys.cpp +++ b/src/yuzu/configuration/configure_hotkeys.cpp @@ -48,7 +48,9 @@ ConfigureHotkeys::ConfigureHotkeys(Core::HID::HIDCore& hid_core, QWidget* parent connect(poll_timer.get(), &QTimer::timeout, [this] { const auto buttons = controller->GetNpadButtons(); - if (buttons.raw != Core::HID::NpadButton::None) { + const auto home_pressed = controller->GetHomeButtons().home != 0; + const auto capture_pressed = controller->GetCaptureButtons().capture != 0; + if (home_pressed || capture_pressed) { SetPollingResult(buttons.raw, false); return; } @@ -154,8 +156,10 @@ void ConfigureHotkeys::ConfigureController(QModelIndex index) { model->setData(index, previous_key); return; } - - const QString button_string = tr("Home+%1").arg(GetButtonName(button)); + const auto home_pressed = this->controller->GetHomeButtons().home != 0; + const auto capture_pressed = this->controller->GetCaptureButtons().capture != 0; + const QString button_string = + GetButtonCombinationName(button, home_pressed, capture_pressed); const auto [key_sequence_used, used_action] = IsUsedControllerKey(button_string); @@ -174,72 +178,83 @@ void ConfigureHotkeys::ConfigureController(QModelIndex index) { poll_timer->start(200); // Check for new inputs every 200ms // We need to disable configuration to be able to read npad buttons controller->DisableConfiguration(); - controller->DisableSystemButtons(); } void ConfigureHotkeys::SetPollingResult(Core::HID::NpadButton button, const bool cancel) { timeout_timer->stop(); poll_timer->stop(); + (*input_setter)(button, cancel); // Re-Enable configuration controller->EnableConfiguration(); - controller->EnableSystemButtons(); - - (*input_setter)(button, cancel); input_setter = std::nullopt; } -QString ConfigureHotkeys::GetButtonName(Core::HID::NpadButton button) const { +QString ConfigureHotkeys::GetButtonCombinationName(Core::HID::NpadButton button, + const bool home = false, + const bool capture = false) const { Core::HID::NpadButtonState state{button}; + QString button_combination; + if (home) { + button_combination.append(QStringLiteral("Home+")); + } + if (capture) { + button_combination.append(QStringLiteral("Screenshot+")); + } if (state.a) { - return QStringLiteral("A"); + button_combination.append(QStringLiteral("A+")); } if (state.b) { - return QStringLiteral("B"); + button_combination.append(QStringLiteral("B+")); } if (state.x) { - return QStringLiteral("X"); + button_combination.append(QStringLiteral("X+")); } if (state.y) { - return QStringLiteral("Y"); + button_combination.append(QStringLiteral("Y+")); } if (state.l || state.right_sl || state.left_sl) { - return QStringLiteral("L"); + button_combination.append(QStringLiteral("L+")); } if (state.r || state.right_sr || state.left_sr) { - return QStringLiteral("R"); + button_combination.append(QStringLiteral("R+")); } if (state.zl) { - return QStringLiteral("ZL"); + button_combination.append(QStringLiteral("ZL+")); } if (state.zr) { - return QStringLiteral("ZR"); + button_combination.append(QStringLiteral("ZR+")); } if (state.left) { - return QStringLiteral("Dpad_Left"); + button_combination.append(QStringLiteral("Dpad_Left+")); } if (state.right) { - return QStringLiteral("Dpad_Right"); + button_combination.append(QStringLiteral("Dpad_Right+")); } if (state.up) { - return QStringLiteral("Dpad_Up"); + button_combination.append(QStringLiteral("Dpad_Up+")); } if (state.down) { - return QStringLiteral("Dpad_Down"); + button_combination.append(QStringLiteral("Dpad_Down+")); } if (state.stick_l) { - return QStringLiteral("Left_Stick"); + button_combination.append(QStringLiteral("Left_Stick+")); } if (state.stick_r) { - return QStringLiteral("Right_Stick"); + button_combination.append(QStringLiteral("Right_Stick+")); } if (state.minus) { - return QStringLiteral("Minus"); + button_combination.append(QStringLiteral("Minus+")); } if (state.plus) { - return QStringLiteral("Plus"); + button_combination.append(QStringLiteral("Plus+")); + } + if (button_combination.isEmpty()) { + return tr("Invalid"); + } else { + button_combination.chop(1); + return button_combination; } - return tr("Invalid"); } std::pair<bool, QString> ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { diff --git a/src/yuzu/configuration/configure_hotkeys.h b/src/yuzu/configuration/configure_hotkeys.h index e8e414320..5fd1bcbfe 100644 --- a/src/yuzu/configuration/configure_hotkeys.h +++ b/src/yuzu/configuration/configure_hotkeys.h @@ -59,7 +59,7 @@ private: QStandardItemModel* model; void SetPollingResult(Core::HID::NpadButton button, bool cancel); - QString GetButtonName(Core::HID::NpadButton button) const; + QString GetButtonCombinationName(Core::HID::NpadButton button, bool home, bool capture) const; Core::HID::EmulatedController* controller; std::unique_ptr<QTimer> timeout_timer; std::unique_ptr<QTimer> poll_timer; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d932e33a7..4489f43af 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1164,7 +1164,8 @@ void GMainWindow::InitializeRecentFileMenuActions() { UpdateRecentFiles(); } -void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name) { +void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name, + const bool tas_allowed) { static const QString main_window = QStringLiteral("Main Window"); action->setShortcut(hotkey_registry.GetKeySequence(main_window, action_name)); action->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, action_name)); @@ -1176,7 +1177,14 @@ void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name const auto* controller_hotkey = hotkey_registry.GetControllerHotkey(main_window, action_name, controller); connect( - controller_hotkey, &ControllerShortcut::Activated, this, [action] { action->trigger(); }, + controller_hotkey, &ControllerShortcut::Activated, this, + [action, tas_allowed, this] { + auto [tas_status, current_tas_frame, total_tas_frames] = + input_subsystem->GetTas()->GetStatus(); + if (tas_allowed || tas_status == InputCommon::TasInput::TasState::Stopped) { + action->trigger(); + } + }, Qt::QueuedConnection); } @@ -1193,9 +1201,9 @@ void GMainWindow::InitializeHotkeys() { LinkActionShortcut(ui->action_Show_Status_Bar, QStringLiteral("Toggle Status Bar")); LinkActionShortcut(ui->action_Fullscreen, QStringLiteral("Fullscreen")); LinkActionShortcut(ui->action_Capture_Screenshot, QStringLiteral("Capture Screenshot")); - LinkActionShortcut(ui->action_TAS_Start, QStringLiteral("TAS Start/Stop")); - LinkActionShortcut(ui->action_TAS_Record, QStringLiteral("TAS Record")); - LinkActionShortcut(ui->action_TAS_Reset, QStringLiteral("TAS Reset")); + LinkActionShortcut(ui->action_TAS_Start, QStringLiteral("TAS Start/Stop"), true); + LinkActionShortcut(ui->action_TAS_Record, QStringLiteral("TAS Record"), true); + LinkActionShortcut(ui->action_TAS_Reset, QStringLiteral("TAS Reset"), true); static const QString main_window = QStringLiteral("Main Window"); const auto connect_shortcut = [&]<typename Fn>(const QString& action_name, const Fn& function) { diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 7b23f2a59..17631a2d9 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -214,7 +214,8 @@ public slots: private: /// Updates an action's shortcut and text to reflect an updated hotkey from the hotkey registry. - void LinkActionShortcut(QAction* action, const QString& action_name); + void LinkActionShortcut(QAction* action, const QString& action_name, + const bool tas_allowed = false); void RegisterMetaTypes(); |