diff --git a/Source/RMG/UserInterface/MainWindow.cpp b/Source/RMG/UserInterface/MainWindow.cpp index 8f6a9f3ba..6f9106fcf 100644 --- a/Source/RMG/UserInterface/MainWindow.cpp +++ b/Source/RMG/UserInterface/MainWindow.cpp @@ -81,7 +81,7 @@ bool MainWindow::Init(QApplication* app, bool showUI, bool launchROM) this->initializeEmulationThread(); this->connectEmulationThreadSignals(); - if (!SetupVidExt(this->emulationThread, this, this->ui_Widget_OpenGL, &this->ui_Widget_Vulkan)) + if (!SetupVidExt(this->emulationThread, this, this->ui_Widget_OpenGL, this->ui_Widget_Vulkan)) { this->showErrorMessage("SetupVidExt() Failed", QString::fromStdString(CoreGetError())); return false; @@ -439,17 +439,11 @@ void MainWindow::updateUI(bool inEmulation, bool isPaused) if (this->ui_VidExtRenderMode == VidExtRenderMode::OpenGL) { - this->ui_Widget_OpenGL = new Widget::OGLWidget(this); - this->ui_Widgets->addWidget(this->ui_Widget_OpenGL->GetWidget()); - this->ui_StatusBar_RenderModeLabel->setText("OpenGL"); this->ui_Widgets->setCurrentWidget(this->ui_Widget_OpenGL->GetWidget()); } else { - this->ui_Widget_Vulkan = new Widget::VKWidget(this); - this->ui_Widgets->addWidget(this->ui_Widget_Vulkan->GetWidget()); - this->ui_StatusBar_RenderModeLabel->setText("Vulkan"); this->ui_Widgets->setCurrentWidget(this->ui_Widget_Vulkan->GetWidget()); } @@ -458,23 +452,10 @@ void MainWindow::updateUI(bool inEmulation, bool isPaused) } else if (!this->ui_NoSwitchToRomBrowser) { - if (this->ui_VidExtRenderMode == VidExtRenderMode::OpenGL) - { - this->ui_Widgets->removeWidget(this->ui_Widget_OpenGL->GetWidget()); - this->ui_Widget_OpenGL->destroy(); - } - else - { - this->ui_Widgets->removeWidget(this->ui_Widget_Vulkan->GetWidget()); - this->ui_Widget_Vulkan->destroy(); - } - this->setWindowTitle(this->ui_WindowTitle); this->ui_Widgets->setCurrentWidget(this->ui_Widget_RomBrowser); this->ui_StatusBar_RenderModeLabel->clear(); this->loadGeometry(); - - } else { diff --git a/Source/RMG/VidExt.cpp b/Source/RMG/VidExt.cpp index caffbe016..fd5affa8f 100644 --- a/Source/RMG/VidExt.cpp +++ b/Source/RMG/VidExt.cpp @@ -26,7 +26,7 @@ static Thread::EmulationThread* l_EmuThread = nullptr; static UserInterface::MainWindow* l_MainWindow = nullptr; static UserInterface::Widget::OGLWidget* l_OGLWidget = nullptr; -static UserInterface::Widget::VKWidget** l_VulkanWidget = nullptr; +static UserInterface::Widget::VKWidget* l_VulkanWidget = nullptr; static QThread* l_RenderThread = nullptr; static bool l_OpenGLInitialized = false; static bool l_OsdInitialized = false; @@ -103,7 +103,7 @@ static m64p_error VidExt_Quit(void) { // remove vulkan instance from widget // and destroy the instance - (*l_VulkanWidget)->setVulkanInstance(nullptr); + l_VulkanWidget->setVulkanInstance(nullptr); if (l_VulkanInstance.isValid()) { l_VulkanInstance.destroy(); @@ -405,11 +405,11 @@ EXPORT m64p_error CALL VidExt_VK_GetSurface(void** Surface, void* Instance) { return M64ERR_SYSTEM_FAIL; } - (*l_VulkanWidget)->setVulkanInstance(&l_VulkanInstance); + l_VulkanWidget->setVulkanInstance(&l_VulkanInstance); } // attempt to retrieve vulkan surface for window - VkSurfaceKHR vulkanSurface = QVulkanInstance::surfaceForWindow((*l_VulkanWidget)); + VkSurfaceKHR vulkanSurface = QVulkanInstance::surfaceForWindow(l_VulkanWidget); if (vulkanSurface == VK_NULL_HANDLE) { return M64ERR_SYSTEM_FAIL; @@ -445,7 +445,7 @@ EXPORT m64p_error CALL VidExt_VK_GetInstanceExtensions(const char** Extensions[] // bool SetupVidExt(Thread::EmulationThread* emuThread, UserInterface::MainWindow* mainWindow, - UserInterface::Widget::OGLWidget* oglWidget, UserInterface::Widget::VKWidget** vulkanWidget) + UserInterface::Widget::OGLWidget* oglWidget, UserInterface::Widget::VKWidget* vulkanWidget) { l_EmuThread = emuThread; l_MainWindow = mainWindow; diff --git a/Source/RMG/VidExt.hpp b/Source/RMG/VidExt.hpp index fd3a35a62..9ad22393c 100644 --- a/Source/RMG/VidExt.hpp +++ b/Source/RMG/VidExt.hpp @@ -16,6 +16,6 @@ #include bool SetupVidExt(Thread::EmulationThread* emuThread, UserInterface::MainWindow* mainWindow, - UserInterface::Widget::OGLWidget* oglWidget, UserInterface::Widget::VKWidget** vulkanWidget); + UserInterface::Widget::OGLWidget* oglWidget, UserInterface::Widget::VKWidget* vulkanWidget); #endif // RMG_VIDEXT_HPP \ No newline at end of file