mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2025-07-03 02:40:47 -07:00
cmake: Always enable Vulkan
Removes the unnecesary burden of maintaining separate #ifdef paths and allows us sharing generic Vulkan code across APIs.
This commit is contained in:
@ -219,7 +219,8 @@ target_link_libraries(yuzu PRIVATE common core input_common video_core)
|
||||
target_link_libraries(yuzu PRIVATE Boost::boost glad Qt5::Widgets)
|
||||
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
if (ENABLE_VULKAN AND NOT WIN32)
|
||||
target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
|
||||
if (NOT WIN32)
|
||||
target_include_directories(yuzu PRIVATE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
@ -280,8 +281,3 @@ endif()
|
||||
if (NOT APPLE)
|
||||
target_compile_definitions(yuzu PRIVATE HAS_OPENGL)
|
||||
endif()
|
||||
|
||||
if (ENABLE_VULKAN)
|
||||
target_include_directories(yuzu PRIVATE ../../externals/Vulkan-Headers/include)
|
||||
target_compile_definitions(yuzu PRIVATE HAS_VULKAN)
|
||||
endif()
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <QOpenGLContext>
|
||||
#endif
|
||||
|
||||
#if !defined(WIN32) && HAS_VULKAN
|
||||
#if !defined(WIN32)
|
||||
#include <qpa/qplatformnativeinterface.h>
|
||||
#endif
|
||||
|
||||
@ -241,14 +241,12 @@ private:
|
||||
std::unique_ptr<Core::Frontend::GraphicsContext> context;
|
||||
};
|
||||
|
||||
#ifdef HAS_VULKAN
|
||||
class VulkanRenderWidget : public RenderWidget {
|
||||
public:
|
||||
explicit VulkanRenderWidget(GRenderWindow* parent) : RenderWidget(parent) {
|
||||
windowHandle()->setSurfaceType(QWindow::VulkanSurface);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
static Core::Frontend::WindowSystemType GetWindowSystemType() {
|
||||
// Determine WSI type based on Qt platform.
|
||||
@ -268,7 +266,6 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow*
|
||||
Core::Frontend::EmuWindow::WindowSystemInfo wsi;
|
||||
wsi.type = GetWindowSystemType();
|
||||
|
||||
#ifdef HAS_VULKAN
|
||||
// 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;
|
||||
@ -281,7 +278,6 @@ static Core::Frontend::EmuWindow::WindowSystemInfo GetWindowSystemInfo(QWindow*
|
||||
wsi.render_surface = window ? reinterpret_cast<void*>(window->winId()) : nullptr;
|
||||
#endif
|
||||
wsi.render_surface_scale = window ? static_cast<float>(window->devicePixelRatio()) : 1.0f;
|
||||
#endif
|
||||
|
||||
return wsi;
|
||||
}
|
||||
@ -598,18 +594,12 @@ bool GRenderWindow::InitializeOpenGL() {
|
||||
}
|
||||
|
||||
bool GRenderWindow::InitializeVulkan() {
|
||||
#ifdef HAS_VULKAN
|
||||
auto child = new VulkanRenderWidget(this);
|
||||
child_widget = child;
|
||||
child_widget->windowHandle()->create();
|
||||
main_context = std::make_unique<DummyContext>();
|
||||
|
||||
return true;
|
||||
#else
|
||||
QMessageBox::critical(this, tr("Vulkan not available!"),
|
||||
tr("yuzu has not been compiled with Vulkan support."));
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GRenderWindow::LoadOpenGL() {
|
||||
|
@ -4,22 +4,17 @@
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QComboBox>
|
||||
#ifdef HAS_VULKAN
|
||||
#include <QVulkanInstance>
|
||||
#endif
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
#include "core/settings.h"
|
||||
#include "ui_configure_graphics.h"
|
||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||
#include "yuzu/configuration/configuration_shared.h"
|
||||
#include "yuzu/configuration/configure_graphics.h"
|
||||
|
||||
#ifdef HAS_VULKAN
|
||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||
#endif
|
||||
|
||||
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
||||
vulkan_device = Settings::values.vulkan_device.GetValue();
|
||||
@ -218,12 +213,10 @@ void ConfigureGraphics::UpdateDeviceComboBox() {
|
||||
}
|
||||
|
||||
void ConfigureGraphics::RetrieveVulkanDevices() {
|
||||
#ifdef HAS_VULKAN
|
||||
vulkan_devices.clear();
|
||||
for (auto& name : Vulkan::RendererVulkan::EnumerateDevices()) {
|
||||
for (const auto& name : Vulkan::RendererVulkan::EnumerateDevices()) {
|
||||
vulkan_devices.push_back(QString::fromStdString(name));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const {
|
||||
|
@ -622,11 +622,6 @@ void GMainWindow::InitializeWidgets() {
|
||||
});
|
||||
renderer_status_button->toggle();
|
||||
|
||||
#ifndef HAS_VULKAN
|
||||
renderer_status_button->setChecked(false);
|
||||
renderer_status_button->setCheckable(false);
|
||||
renderer_status_button->setDisabled(true);
|
||||
#else
|
||||
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
|
||||
Settings::RendererBackend::Vulkan);
|
||||
connect(renderer_status_button, &QPushButton::clicked, [this] {
|
||||
@ -641,7 +636,6 @@ void GMainWindow::InitializeWidgets() {
|
||||
|
||||
Settings::Apply(Core::System::GetInstance());
|
||||
});
|
||||
#endif // HAS_VULKAN
|
||||
statusBar()->insertPermanentWidget(0, renderer_status_button);
|
||||
|
||||
statusBar()->setVisible(true);
|
||||
@ -1254,9 +1248,7 @@ void GMainWindow::ShutdownGame() {
|
||||
emu_frametime_label->setVisible(false);
|
||||
async_status_button->setEnabled(true);
|
||||
multicore_status_button->setEnabled(true);
|
||||
#ifdef HAS_VULKAN
|
||||
renderer_status_button->setEnabled(true);
|
||||
#endif
|
||||
|
||||
emulation_running = false;
|
||||
|
||||
@ -2545,10 +2537,8 @@ void GMainWindow::UpdateStatusButtons() {
|
||||
Settings::values.use_asynchronous_gpu_emulation.GetValue() ||
|
||||
Settings::values.use_multi_core.GetValue());
|
||||
async_status_button->setChecked(Settings::values.use_asynchronous_gpu_emulation.GetValue());
|
||||
#ifdef HAS_VULKAN
|
||||
renderer_status_button->setChecked(Settings::values.renderer_backend.GetValue() ==
|
||||
Settings::RendererBackend::Vulkan);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GMainWindow::UpdateUISettings() {
|
||||
|
Reference in New Issue
Block a user