mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-12 10:37:02 +00:00
UI+build: Isolate wxWidgets code from non-GUI code (#1633)
This commit is contained in:
parent
5f3c2816ec
commit
67de63bed6
199 changed files with 2414 additions and 2091 deletions
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "config/ActiveSettings.h"
|
||||
#include "config/CemuConfig.h"
|
||||
#include "gui/guiWrapper.h"
|
||||
#include "WindowSystem.h"
|
||||
|
||||
#include "imgui/imgui_extension.h"
|
||||
#include "imgui/imgui_impl_vulkan.h"
|
||||
|
|
@ -27,11 +27,9 @@
|
|||
|
||||
#include "Cafe/HW/Latte/Core/LatteTiming.h" // vsync control
|
||||
|
||||
#include <cstdint>
|
||||
#include <glslang/Public/ShaderLang.h>
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/intl.h> // for localization
|
||||
|
||||
#ifndef VK_API_VERSION_MAJOR
|
||||
#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU)
|
||||
#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU)
|
||||
|
|
@ -113,11 +111,11 @@ std::vector<VulkanRenderer::DeviceInfo> VulkanRenderer::GetDevices()
|
|||
#if BOOST_OS_WINDOWS
|
||||
requiredExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#elif BOOST_OS_LINUX
|
||||
auto backend = gui_getWindowInfo().window_main.backend;
|
||||
if(backend == WindowHandleInfo::Backend::X11)
|
||||
auto backend = WindowSystem::GetWindowInfo().window_main.backend;
|
||||
if(backend == WindowSystem::WindowHandleInfo::Backend::X11)
|
||||
requiredExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
|
||||
#ifdef HAS_WAYLAND
|
||||
else if (backend == WindowHandleInfo::Backend::WAYLAND)
|
||||
else if (backend == WindowSystem::WindowHandleInfo::Backend::Wayland)
|
||||
requiredExtensions.emplace_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
#elif BOOST_OS_MACOS
|
||||
|
|
@ -156,7 +154,7 @@ std::vector<VulkanRenderer::DeviceInfo> VulkanRenderer::GetDevices()
|
|||
throw std::runtime_error("Failed to find a GPU with Vulkan support.");
|
||||
|
||||
// create tmp surface to create a logical device
|
||||
auto surface = CreateFramebufferSurface(instance, gui_getWindowInfo().window_main);
|
||||
auto surface = CreateFramebufferSurface(instance, WindowSystem::GetWindowInfo().window_main);
|
||||
std::vector<VkPhysicalDevice> devices(device_count);
|
||||
vkEnumeratePhysicalDevices(instance, &device_count, devices.data());
|
||||
for (const auto& device : devices)
|
||||
|
|
@ -309,7 +307,7 @@ void VulkanRenderer::GetDeviceFeatures()
|
|||
cemuLog_log(LogType::Force, "VK_EXT_pipeline_creation_cache_control not supported. Cannot use asynchronous shader and pipeline compilation");
|
||||
// if async shader compilation is enabled show warning message
|
||||
if (GetConfig().async_compile)
|
||||
LatteOverlay_pushNotification(_("Async shader compile is enabled but not supported by the graphics driver\nCemu will use synchronous compilation which can cause additional stutter").utf8_string(), 10000);
|
||||
LatteOverlay_pushNotification(_tr("Async shader compile is enabled but not supported by the graphics driver\nCemu will use synchronous compilation which can cause additional stutter"), 10000);
|
||||
}
|
||||
if (!m_featureControl.deviceExtensions.custom_border_color_without_format)
|
||||
{
|
||||
|
|
@ -402,7 +400,7 @@ VulkanRenderer::VulkanRenderer()
|
|||
throw std::runtime_error("Failed to find a GPU with Vulkan support.");
|
||||
|
||||
// create tmp surface to create a logical device
|
||||
auto surface = CreateFramebufferSurface(m_instance, gui_getWindowInfo().window_main);
|
||||
auto surface = CreateFramebufferSurface(m_instance, WindowSystem::GetWindowInfo().window_main);
|
||||
|
||||
auto& config = GetConfig();
|
||||
decltype(config.graphic_device_uuid) zero{};
|
||||
|
|
@ -810,8 +808,7 @@ bool VulkanRenderer::IsPadWindowActive()
|
|||
|
||||
void VulkanRenderer::HandleScreenshotRequest(LatteTextureView* texView, bool padView)
|
||||
{
|
||||
const bool hasScreenshotRequest = gui_hasScreenshotRequest();
|
||||
if (!hasScreenshotRequest && m_screenshot_state == ScreenshotState::None)
|
||||
if (!m_screenshot_requested && m_screenshot_state == ScreenshotState::None)
|
||||
return;
|
||||
|
||||
if (IsSwapchainInfoValid(false))
|
||||
|
|
@ -1311,11 +1308,11 @@ std::vector<const char*> VulkanRenderer::CheckInstanceExtensionSupport(FeatureCo
|
|||
#if BOOST_OS_WINDOWS
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
|
||||
#elif BOOST_OS_LINUX
|
||||
auto backend = gui_getWindowInfo().window_main.backend;
|
||||
if(backend == WindowHandleInfo::Backend::X11)
|
||||
auto backend = WindowSystem::GetWindowInfo().window_main.backend;
|
||||
if(backend == WindowSystem::WindowHandleInfo::Backend::X11)
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_XLIB_SURFACE_EXTENSION_NAME);
|
||||
#if HAS_WAYLAND
|
||||
else if (backend == WindowHandleInfo::Backend::WAYLAND)
|
||||
else if (backend == WindowSystem::WindowHandleInfo::Backend::Wayland)
|
||||
requiredInstanceExtensions.emplace_back(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME);
|
||||
#endif
|
||||
#elif BOOST_OS_MACOS
|
||||
|
|
@ -1457,20 +1454,21 @@ VkSurfaceKHR VulkanRenderer::CreateWaylandSurface(VkInstance instance, wl_displa
|
|||
#endif // HAS_WAYLAND
|
||||
#endif // BOOST_OS_LINUX
|
||||
|
||||
VkSurfaceKHR VulkanRenderer::CreateFramebufferSurface(VkInstance instance, struct WindowHandleInfo& windowInfo)
|
||||
VkSurfaceKHR VulkanRenderer::CreateFramebufferSurface(VkInstance instance, WindowSystem::WindowHandleInfo& windowInfo)
|
||||
{
|
||||
#if BOOST_OS_WINDOWS
|
||||
return CreateWinSurface(instance, windowInfo.hwnd);
|
||||
return CreateWinSurface(instance, static_cast<HWND>(windowInfo.surface));
|
||||
#elif BOOST_OS_LINUX
|
||||
if(windowInfo.backend == WindowHandleInfo::Backend::X11)
|
||||
return CreateXlibSurface(instance, windowInfo.xlib_display, windowInfo.xlib_window);
|
||||
|
||||
if(windowInfo.backend == WindowSystem::WindowHandleInfo::Backend::X11)
|
||||
return CreateXlibSurface(instance, static_cast<Display*>(windowInfo.display), reinterpret_cast<Window>(windowInfo.surface));
|
||||
#ifdef HAS_WAYLAND
|
||||
if(windowInfo.backend == WindowHandleInfo::Backend::WAYLAND)
|
||||
return CreateWaylandSurface(instance, windowInfo.display, windowInfo.surface);
|
||||
if(windowInfo.backend == WindowSystem::WindowHandleInfo::Backend::Wayland)
|
||||
return CreateWaylandSurface(instance, static_cast<wl_display*>(windowInfo.display), static_cast<wl_surface*>(windowInfo.surface));
|
||||
#endif
|
||||
return {};
|
||||
#elif BOOST_OS_MACOS
|
||||
return CreateCocoaSurface(instance, windowInfo.handle);
|
||||
return CreateCocoaSurface(instance, windowInfo.surface);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -2746,11 +2744,11 @@ void VulkanRenderer::RecreateSwapchain(bool mainWindow, bool skipCreate)
|
|||
if (mainWindow)
|
||||
{
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
gui_getWindowPhysSize(size.x, size.y);
|
||||
WindowSystem::GetWindowPhysSize(size.x, size.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_getPadWindowPhysSize(size.x, size.y);
|
||||
WindowSystem::GetPadWindowPhysSize(size.x, size.y);
|
||||
}
|
||||
|
||||
chainInfo.swapchainImageIndex = -1;
|
||||
|
|
@ -2780,9 +2778,9 @@ bool VulkanRenderer::UpdateSwapchainProperties(bool mainWindow)
|
|||
|
||||
int width, height;
|
||||
if (mainWindow)
|
||||
gui_getWindowPhysSize(width, height);
|
||||
WindowSystem::GetWindowPhysSize(width, height);
|
||||
else
|
||||
gui_getPadWindowPhysSize(width, height);
|
||||
WindowSystem::GetPadWindowPhysSize(width, height);
|
||||
auto extent = chainInfo.getExtent();
|
||||
if (width != extent.width || height != extent.height)
|
||||
stateChanged = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue