summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp25
-rw-r--r--src/video_core/renderer_vulkan/vk_swapchain.cpp4
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp19
-rw-r--r--src/yuzu/configuration/configure_hotkeys.cpp65
-rw-r--r--src/yuzu/configuration/configure_hotkeys.h2
-rw-r--r--src/yuzu/main.cpp18
-rw-r--r--src/yuzu/main.h3
7 files changed, 83 insertions, 53 deletions
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) {
348 348
349 const u32 color_attachment = regs.clear_surface.RT; 349 const u32 color_attachment = regs.clear_surface.RT;
350 if (use_color && framebuffer->HasAspectColorBit(color_attachment)) { 350 if (use_color && framebuffer->HasAspectColorBit(color_attachment)) {
351 VkClearValue clear_value; 351 const auto format =
352 bool is_integer = false; 352 VideoCore::Surface::PixelFormatFromRenderTargetFormat(regs.rt[color_attachment].format);
353 bool is_signed = false; 353 bool is_integer = IsPixelFormatInteger(format);
354 size_t int_size = 8; 354 bool is_signed = IsPixelFormatSignedInteger(format);
355 for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) { 355 size_t int_size = PixelComponentSizeBitsInteger(format);
356 const auto& this_rt = regs.rt[i]; 356 VkClearValue clear_value{};
357 if (this_rt.Address() == 0) {
358 continue;
359 }
360 if (this_rt.format == Tegra::RenderTargetFormat::NONE) {
361 continue;
362 }
363 const auto format =
364 VideoCore::Surface::PixelFormatFromRenderTargetFormat(this_rt.format);
365 is_integer = IsPixelFormatInteger(format);
366 is_signed = IsPixelFormatSignedInteger(format);
367 int_size = PixelComponentSizeBitsInteger(format);
368 break;
369 }
370 if (!is_integer) { 357 if (!is_integer) {
371 std::memcpy(clear_value.color.float32, regs.clear_color.data(), 358 std::memcpy(clear_value.color.float32, regs.clear_color.data(),
372 regs.clear_color.size() * sizeof(f32)); 359 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)
34 return found != formats.end() ? *found : formats[0]; 34 return found != formats.end() ? *found : formats[0];
35} 35}
36 36
37static constexpr VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox, 37static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
38 bool has_fifo_relaxed) { 38 bool has_fifo_relaxed) {
39 // Mailbox doesn't lock the application like FIFO (vsync) 39 // Mailbox doesn't lock the application like FIFO (vsync)
40 // FIFO present mode locks the framerate to the monitor's refresh rate 40 // FIFO present mode locks the framerate to the monitor's refresh rate
41 Settings::VSyncMode setting = [has_imm, has_mailbox]() { 41 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
406 features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false; 406 features.extended_dynamic_state3.extendedDynamicState3ColorBlendEnable = false;
407 features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false; 407 features.extended_dynamic_state3.extendedDynamicState3ColorBlendEquation = false;
408 dynamic_state3_blending = false; 408 dynamic_state3_blending = false;
409
410 const u32 version = (properties.properties.driverVersion << 3) >> 3;
411 if (version < VK_MAKE_API_VERSION(0, 23, 1, 0)) {
412 LOG_WARNING(Render_Vulkan,
413 "RADV versions older than 23.1.0 have broken depth clamp dynamic state");
414 features.extended_dynamic_state3.extendedDynamicState3DepthClampEnable = false;
415 dynamic_state3_enables = false;
416 }
409 } 417 }
410 if (extensions.vertex_input_dynamic_state && is_radv) { 418 if (extensions.vertex_input_dynamic_state && is_radv) {
411 // TODO(ameerj): Blacklist only offending driver versions 419 // TODO(ameerj): Blacklist only offending driver versions
@@ -463,6 +471,17 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
463 LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format"); 471 LOG_WARNING(Render_Vulkan, "ANV driver does not support native BGR format");
464 must_emulate_bgr565 = true; 472 must_emulate_bgr565 = true;
465 } 473 }
474 if (extensions.push_descriptor && is_intel_anv) {
475 const u32 version = (properties.properties.driverVersion << 3) >> 3;
476 if (version >= VK_MAKE_API_VERSION(0, 22, 3, 0)) {
477 // Disable VK_KHR_push_descriptor due to
478 // mesa/mesa/-/commit/ff91c5ca42bc80aa411cb3fd8f550aa6fdd16bdc
479 LOG_WARNING(Render_Vulkan,
480 "ANV drivers 22.3.0 and later have broken VK_KHR_push_descriptor");
481 extensions.push_descriptor = false;
482 loaded_extensions.erase(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
483 }
484 }
466 if (is_mvk) { 485 if (is_mvk) {
467 LOG_WARNING(Render_Vulkan, 486 LOG_WARNING(Render_Vulkan,
468 "MVK driver breaks when using more than 16 vertex attributes/bindings"); 487 "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
48 48
49 connect(poll_timer.get(), &QTimer::timeout, [this] { 49 connect(poll_timer.get(), &QTimer::timeout, [this] {
50 const auto buttons = controller->GetNpadButtons(); 50 const auto buttons = controller->GetNpadButtons();
51 if (buttons.raw != Core::HID::NpadButton::None) { 51 const auto home_pressed = controller->GetHomeButtons().home != 0;
52 const auto capture_pressed = controller->GetCaptureButtons().capture != 0;
53 if (home_pressed || capture_pressed) {
52 SetPollingResult(buttons.raw, false); 54 SetPollingResult(buttons.raw, false);
53 return; 55 return;
54 } 56 }
@@ -154,8 +156,10 @@ void ConfigureHotkeys::ConfigureController(QModelIndex index) {
154 model->setData(index, previous_key); 156 model->setData(index, previous_key);
155 return; 157 return;
156 } 158 }
157 159 const auto home_pressed = this->controller->GetHomeButtons().home != 0;
158 const QString button_string = tr("Home+%1").arg(GetButtonName(button)); 160 const auto capture_pressed = this->controller->GetCaptureButtons().capture != 0;
161 const QString button_string =
162 GetButtonCombinationName(button, home_pressed, capture_pressed);
159 163
160 const auto [key_sequence_used, used_action] = IsUsedControllerKey(button_string); 164 const auto [key_sequence_used, used_action] = IsUsedControllerKey(button_string);
161 165
@@ -174,72 +178,83 @@ void ConfigureHotkeys::ConfigureController(QModelIndex index) {
174 poll_timer->start(200); // Check for new inputs every 200ms 178 poll_timer->start(200); // Check for new inputs every 200ms
175 // We need to disable configuration to be able to read npad buttons 179 // We need to disable configuration to be able to read npad buttons
176 controller->DisableConfiguration(); 180 controller->DisableConfiguration();
177 controller->DisableSystemButtons();
178} 181}
179 182
180void ConfigureHotkeys::SetPollingResult(Core::HID::NpadButton button, const bool cancel) { 183void ConfigureHotkeys::SetPollingResult(Core::HID::NpadButton button, const bool cancel) {
181 timeout_timer->stop(); 184 timeout_timer->stop();
182 poll_timer->stop(); 185 poll_timer->stop();
186 (*input_setter)(button, cancel);
183 // Re-Enable configuration 187 // Re-Enable configuration
184 controller->EnableConfiguration(); 188 controller->EnableConfiguration();
185 controller->EnableSystemButtons();
186
187 (*input_setter)(button, cancel);
188 189
189 input_setter = std::nullopt; 190 input_setter = std::nullopt;
190} 191}
191 192
192QString ConfigureHotkeys::GetButtonName(Core::HID::NpadButton button) const { 193QString ConfigureHotkeys::GetButtonCombinationName(Core::HID::NpadButton button,
194 const bool home = false,
195 const bool capture = false) const {
193 Core::HID::NpadButtonState state{button}; 196 Core::HID::NpadButtonState state{button};
197 QString button_combination;
198 if (home) {
199 button_combination.append(QStringLiteral("Home+"));
200 }
201 if (capture) {
202 button_combination.append(QStringLiteral("Screenshot+"));
203 }
194 if (state.a) { 204 if (state.a) {
195 return QStringLiteral("A"); 205 button_combination.append(QStringLiteral("A+"));
196 } 206 }
197 if (state.b) { 207 if (state.b) {
198 return QStringLiteral("B"); 208 button_combination.append(QStringLiteral("B+"));
199 } 209 }
200 if (state.x) { 210 if (state.x) {
201 return QStringLiteral("X"); 211 button_combination.append(QStringLiteral("X+"));
202 } 212 }
203 if (state.y) { 213 if (state.y) {
204 return QStringLiteral("Y"); 214 button_combination.append(QStringLiteral("Y+"));
205 } 215 }
206 if (state.l || state.right_sl || state.left_sl) { 216 if (state.l || state.right_sl || state.left_sl) {
207 return QStringLiteral("L"); 217 button_combination.append(QStringLiteral("L+"));
208 } 218 }
209 if (state.r || state.right_sr || state.left_sr) { 219 if (state.r || state.right_sr || state.left_sr) {
210 return QStringLiteral("R"); 220 button_combination.append(QStringLiteral("R+"));
211 } 221 }
212 if (state.zl) { 222 if (state.zl) {
213 return QStringLiteral("ZL"); 223 button_combination.append(QStringLiteral("ZL+"));
214 } 224 }
215 if (state.zr) { 225 if (state.zr) {
216 return QStringLiteral("ZR"); 226 button_combination.append(QStringLiteral("ZR+"));
217 } 227 }
218 if (state.left) { 228 if (state.left) {
219 return QStringLiteral("Dpad_Left"); 229 button_combination.append(QStringLiteral("Dpad_Left+"));
220 } 230 }
221 if (state.right) { 231 if (state.right) {
222 return QStringLiteral("Dpad_Right"); 232 button_combination.append(QStringLiteral("Dpad_Right+"));
223 } 233 }
224 if (state.up) { 234 if (state.up) {
225 return QStringLiteral("Dpad_Up"); 235 button_combination.append(QStringLiteral("Dpad_Up+"));
226 } 236 }
227 if (state.down) { 237 if (state.down) {
228 return QStringLiteral("Dpad_Down"); 238 button_combination.append(QStringLiteral("Dpad_Down+"));
229 } 239 }
230 if (state.stick_l) { 240 if (state.stick_l) {
231 return QStringLiteral("Left_Stick"); 241 button_combination.append(QStringLiteral("Left_Stick+"));
232 } 242 }
233 if (state.stick_r) { 243 if (state.stick_r) {
234 return QStringLiteral("Right_Stick"); 244 button_combination.append(QStringLiteral("Right_Stick+"));
235 } 245 }
236 if (state.minus) { 246 if (state.minus) {
237 return QStringLiteral("Minus"); 247 button_combination.append(QStringLiteral("Minus+"));
238 } 248 }
239 if (state.plus) { 249 if (state.plus) {
240 return QStringLiteral("Plus"); 250 button_combination.append(QStringLiteral("Plus+"));
251 }
252 if (button_combination.isEmpty()) {
253 return tr("Invalid");
254 } else {
255 button_combination.chop(1);
256 return button_combination;
241 } 257 }
242 return tr("Invalid");
243} 258}
244 259
245std::pair<bool, QString> ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const { 260std::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:
59 QStandardItemModel* model; 59 QStandardItemModel* model;
60 60
61 void SetPollingResult(Core::HID::NpadButton button, bool cancel); 61 void SetPollingResult(Core::HID::NpadButton button, bool cancel);
62 QString GetButtonName(Core::HID::NpadButton button) const; 62 QString GetButtonCombinationName(Core::HID::NpadButton button, bool home, bool capture) const;
63 Core::HID::EmulatedController* controller; 63 Core::HID::EmulatedController* controller;
64 std::unique_ptr<QTimer> timeout_timer; 64 std::unique_ptr<QTimer> timeout_timer;
65 std::unique_ptr<QTimer> poll_timer; 65 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() {
1164 UpdateRecentFiles(); 1164 UpdateRecentFiles();
1165} 1165}
1166 1166
1167void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name) { 1167void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name,
1168 const bool tas_allowed) {
1168 static const QString main_window = QStringLiteral("Main Window"); 1169 static const QString main_window = QStringLiteral("Main Window");
1169 action->setShortcut(hotkey_registry.GetKeySequence(main_window, action_name)); 1170 action->setShortcut(hotkey_registry.GetKeySequence(main_window, action_name));
1170 action->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, action_name)); 1171 action->setShortcutContext(hotkey_registry.GetShortcutContext(main_window, action_name));
@@ -1176,7 +1177,14 @@ void GMainWindow::LinkActionShortcut(QAction* action, const QString& action_name
1176 const auto* controller_hotkey = 1177 const auto* controller_hotkey =
1177 hotkey_registry.GetControllerHotkey(main_window, action_name, controller); 1178 hotkey_registry.GetControllerHotkey(main_window, action_name, controller);
1178 connect( 1179 connect(
1179 controller_hotkey, &ControllerShortcut::Activated, this, [action] { action->trigger(); }, 1180 controller_hotkey, &ControllerShortcut::Activated, this,
1181 [action, tas_allowed, this] {
1182 auto [tas_status, current_tas_frame, total_tas_frames] =
1183 input_subsystem->GetTas()->GetStatus();
1184 if (tas_allowed || tas_status == InputCommon::TasInput::TasState::Stopped) {
1185 action->trigger();
1186 }
1187 },
1180 Qt::QueuedConnection); 1188 Qt::QueuedConnection);
1181} 1189}
1182 1190
@@ -1193,9 +1201,9 @@ void GMainWindow::InitializeHotkeys() {
1193 LinkActionShortcut(ui->action_Show_Status_Bar, QStringLiteral("Toggle Status Bar")); 1201 LinkActionShortcut(ui->action_Show_Status_Bar, QStringLiteral("Toggle Status Bar"));
1194 LinkActionShortcut(ui->action_Fullscreen, QStringLiteral("Fullscreen")); 1202 LinkActionShortcut(ui->action_Fullscreen, QStringLiteral("Fullscreen"));
1195 LinkActionShortcut(ui->action_Capture_Screenshot, QStringLiteral("Capture Screenshot")); 1203 LinkActionShortcut(ui->action_Capture_Screenshot, QStringLiteral("Capture Screenshot"));
1196 LinkActionShortcut(ui->action_TAS_Start, QStringLiteral("TAS Start/Stop")); 1204 LinkActionShortcut(ui->action_TAS_Start, QStringLiteral("TAS Start/Stop"), true);
1197 LinkActionShortcut(ui->action_TAS_Record, QStringLiteral("TAS Record")); 1205 LinkActionShortcut(ui->action_TAS_Record, QStringLiteral("TAS Record"), true);
1198 LinkActionShortcut(ui->action_TAS_Reset, QStringLiteral("TAS Reset")); 1206 LinkActionShortcut(ui->action_TAS_Reset, QStringLiteral("TAS Reset"), true);
1199 1207
1200 static const QString main_window = QStringLiteral("Main Window"); 1208 static const QString main_window = QStringLiteral("Main Window");
1201 const auto connect_shortcut = [&]<typename Fn>(const QString& action_name, const Fn& function) { 1209 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:
214 214
215private: 215private:
216 /// Updates an action's shortcut and text to reflect an updated hotkey from the hotkey registry. 216 /// Updates an action's shortcut and text to reflect an updated hotkey from the hotkey registry.
217 void LinkActionShortcut(QAction* action, const QString& action_name); 217 void LinkActionShortcut(QAction* action, const QString& action_name,
218 const bool tas_allowed = false);
218 219
219 void RegisterMetaTypes(); 220 void RegisterMetaTypes();
220 221