Skip to content

Commit

Permalink
Revert "wip"
Browse files Browse the repository at this point in the history
This reverts commit e753812.
  • Loading branch information
Rosalie241 committed May 27, 2024
1 parent 9d3e066 commit 9d468f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 26 deletions.
21 changes: 1 addition & 20 deletions Source/RMG/UserInterface/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand All @@ -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
{
Expand Down
10 changes: 5 additions & 5 deletions Source/RMG/VidExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/RMG/VidExt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
#include <Thread/EmulationThread.hpp>

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

0 comments on commit 9d468f8

Please sign in to comment.