Browse Source
Merge pull request #10125 from lat9nq/vsync-select
Merge pull request #10125 from lat9nq/vsync-select
configuration: Expose separate swap present modesnce_cpp
committed by
GitHub
22 changed files with 456 additions and 129 deletions
-
3src/common/settings.cpp
-
10src/common/settings.h
-
17src/core/telemetry_session.cpp
-
2src/video_core/renderer_vulkan/renderer_vulkan.cpp
-
71src/video_core/renderer_vulkan/vk_swapchain.cpp
-
6src/video_core/renderer_vulkan/vk_swapchain.h
-
6src/video_core/vulkan_common/vulkan_surface.cpp
-
9src/video_core/vulkan_common/vulkan_surface.h
-
2src/yuzu/CMakeLists.txt
-
90src/yuzu/bootmanager.cpp
-
26src/yuzu/bootmanager.h
-
10src/yuzu/configuration/config.cpp
-
166src/yuzu/configuration/configure_graphics.cpp
-
23src/yuzu/configuration/configure_graphics.h
-
38src/yuzu/configuration/configure_graphics.ui
-
5src/yuzu/configuration/configure_graphics_advanced.cpp
-
10src/yuzu/configuration/configure_graphics_advanced.ui
-
1src/yuzu/configuration/configure_input_player.cpp
-
55src/yuzu/qt_common.cpp
-
15src/yuzu/qt_common.h
-
2src/yuzu_cmd/config.cpp
-
10src/yuzu_cmd/default_ini.h
@ -0,0 +1,55 @@ |
|||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|||
|
|||
#include <QGuiApplication>
|
|||
#include <QStringLiteral>
|
|||
#include <QWindow>
|
|||
#include "common/logging/log.h"
|
|||
#include "core/frontend/emu_window.h"
|
|||
#include "yuzu/qt_common.h"
|
|||
|
|||
#ifdef __linux__
|
|||
#include <qpa/qplatformnativeinterface.h>
|
|||
#endif
|
|||
|
|||
namespace QtCommon { |
|||
Core::Frontend::WindowSystemType GetWindowSystemType() { |
|||
// Determine WSI type based on Qt platform.
|
|||
QString platform_name = QGuiApplication::platformName(); |
|||
if (platform_name == QStringLiteral("windows")) |
|||
return Core::Frontend::WindowSystemType::Windows; |
|||
else if (platform_name == QStringLiteral("xcb")) |
|||
return Core::Frontend::WindowSystemType::X11; |
|||
else if (platform_name == QStringLiteral("wayland")) |
|||
return Core::Frontend::WindowSystemType::Wayland; |
|||
else if (platform_name == QStringLiteral("wayland-egl")) |
|||
return Core::Frontend::WindowSystemType::Wayland; |
|||
else if (platform_name == QStringLiteral("cocoa")) |
|||
return Core::Frontend::WindowSystemType::Cocoa; |
|||
else if (platform_name == QStringLiteral("android")) |
|||
return Core::Frontend::WindowSystemType::Android; |
|||
|
|||
LOG_CRITICAL(Frontend, "Unknown Qt platform {}!", platform_name.toStdString()); |
|||
return Core::Frontend::WindowSystemType::Windows; |
|||
} // namespace Core::Frontend::WindowSystemType
|
|||
|
|||
Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window) { |
|||
Core::Frontend::EmuWindow::WindowSystemInfo wsi; |
|||
wsi.type = GetWindowSystemType(); |
|||
|
|||
// Our Win32 Qt external doesn't have the private API.
|
|||
#if defined(WIN32) || defined(__APPLE__)
|
|||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr; |
|||
#else
|
|||
QPlatformNativeInterface* pni = QGuiApplication::platformNativeInterface(); |
|||
wsi.display_connection = pni->nativeResourceForWindow("display", window); |
|||
if (wsi.type == Core::Frontend::WindowSystemType::Wayland) |
|||
wsi.render_surface = window ? pni->nativeResourceForWindow("surface", window) : nullptr; |
|||
else |
|||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr; |
|||
#endif
|
|||
wsi.render_surface_scale = window ? static_cast<float>(window->devicePixelRatio()) : 1.0f; |
|||
|
|||
return wsi; |
|||
} |
|||
} // namespace QtCommon
|
|||
@ -0,0 +1,15 @@ |
|||
// SPDX-FileCopyrightText: 2023 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#pragma once |
|||
|
|||
#include <QWindow> |
|||
#include "core/frontend/emu_window.h" |
|||
|
|||
namespace QtCommon { |
|||
|
|||
Core::Frontend::WindowSystemType GetWindowSystemType(); |
|||
|
|||
Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow* window); |
|||
|
|||
} // namespace QtCommon |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue