Compare commits

...

16 Commits

Author SHA1 Message Date
Gess1t
76ee0ee852
Merge 58b456b9b7 into 7c1d2a64f4 2024-11-11 21:51:25 +01:00
Nadia Holmquist Pedersen
7c1d2a64f4 Set WIN32_LEAN_AND_MEAN, gets rid of the winsock2 warnings and probably
Some checks failed
macOS / ${{ matrix.arch }} (arm64) (push) Has been cancelled
macOS / ${{ matrix.arch }} (x86_64) (push) Has been cancelled
Ubuntu / x86_64 (push) Has been cancelled
Ubuntu / aarch64 (push) Has been cancelled
Windows / build (push) Has been cancelled
macOS / Universal binary (push) Has been cancelled
speeds up compilation a tiny bit

oh and NOMINMAX too for good measure while we're at it
2024-11-11 14:18:05 +01:00
Nadia Holmquist Pedersen
b2f6fab6f4 cmake: use interface include directories properly
and fix an indent I guess
2024-11-11 12:06:12 +01:00
Gess1t
58b456b9b7 Move getsupportedRenderers function to SupportedRenderers class 2024-11-01 03:10:54 +01:00
Gess1t
4b234bd161 Check length on glVersionStr 2024-10-30 23:18:30 +01:00
Gess1t
4677d9f7ea Change casing to comply with review 2024-10-30 23:18:14 +01:00
Gess1t
d34aed7ccd Uncheck OpenGL display when requirements aren't met
Also disable the vsync interval label to match other part of the UX
2024-10-28 19:23:43 +01:00
Gess1t
4f6679b821 Use cached variables instead of re-fetching from settings 2024-10-28 19:05:15 +01:00
Gess1t
f0986fd32d Remove redundant check when base requirements aren't met 2024-10-28 18:58:42 +01:00
Gess1t
7fa6f73b0c Set settings in cfg for use in setVsyncControlEnable 2024-10-28 05:08:44 +01:00
Gess1t
04357bddc8 Add missing fallback to software renderer for the Compute shader renderer 2024-10-28 05:07:45 +01:00
Gess1t
94a2bce37c Cache supported renderers 2024-10-28 05:03:57 +01:00
Gess1t
61afc57ff2 use setVsyncControlEnable instead for toggling vsync settings 2024-10-28 04:35:28 +01:00
Gess1t
7b516d6396 Add some comments in VideoSettingsDialog 2024-10-28 03:19:44 +01:00
Gess1t
bdcb7f6d26 Fix Vsync never being editable (from master) 2024-10-28 03:02:24 +01:00
Gess1t
54902989a1 Check if required renderer is available before disabling options 2024-10-28 03:01:43 +01:00
8 changed files with 165 additions and 11 deletions

View File

@ -127,6 +127,8 @@ if (ENABLE_JIT)
endif()
endif()
target_include_directories(core INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version")
option(MELONDS_EMBED_BUILD_INFO "Embed detailed build info into the binary" OFF)
set(MELONDS_GIT_BRANCH "$ENV{MELONDS_GIT_BRANCH}" CACHE STRING "The Git branch used for this build")
@ -178,13 +180,14 @@ endif()
if (WIN32)
target_link_libraries(core PRIVATE ole32 comctl32 wsock32 ws2_32)
target_compile_definitions(core PUBLIC WIN32_LEAN_AND_MEAN NOMINMAX)
elseif(NOT APPLE AND NOT HAIKU)
check_library_exists(rt shm_open "" NEED_LIBRT)
if (NEED_LIBRT)
target_link_libraries(core PRIVATE rt)
endif()
elseif(HAIKU)
target_link_libraries(core PRIVATE network)
target_link_libraries(core PRIVATE network)
endif()
if (ENABLE_JIT_PROFILING)

View File

@ -31,6 +31,7 @@ set(SOURCES_QT_SDL
ROMInfoDialog.cpp
RAMInfoDialog.cpp
TitleManagerDialog.cpp
SupportedRenderers.cpp
OSD_shaders.h
font.h
Platform.cpp
@ -91,8 +92,7 @@ add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
add_executable(melonDS ${SOURCES_QT_SDL})
add_subdirectory("../../net"
"${CMAKE_BINARY_DIR}/net"
)
${CMAKE_BINARY_DIR}/net)
target_link_libraries(melonDS PRIVATE net-utils)
@ -171,10 +171,10 @@ if (BUILD_STATIC)
endif()
endif()
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..")
target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../../net")
target_include_directories(melonDS PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/..")
if (USE_QT6)
target_include_directories(melonDS PUBLIC ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
else()

View File

@ -0,0 +1,63 @@
#include "types.h"
#include "Platform.h"
#include "Config.h"
#include "GPU.h"
#include "main.h"
#include "SupportedRenderers.h"
SupportedRenderers* SupportedRenderers::instance = nullptr;
SupportedRenderers::SupportedRenderers(QWidget* parent)
{
if (SupportedRenderers::instance == nullptr)
instance = this;
software = true;
// OpenGL
setSupportedOpenGLRenderers(parent);
// Future renderers
}
SupportedRenderers::~SupportedRenderers() {}
void SupportedRenderers::setSupportedOpenGLRenderers(QWidget* parent)
{
ScreenPanelGL *glPanel = new ScreenPanelGL(parent);
std::optional<WindowInfo> windowInfo = glPanel->getWindowInfo();
if (windowInfo.has_value())
{
std::array<GL::Context::Version, 2> versionsToTry = {
GL::Context::Version{GL::Context::Profile::Core, 4, 3},
GL::Context::Version{GL::Context::Profile::Core, 3, 2}
};
std::unique_ptr<GL::Context> glContext = GL::Context::Create(*windowInfo, versionsToTry);
if (glContext)
{
const char* glVersionStr = reinterpret_cast<const char*>(glGetString(GL_VERSION));
if (glVersionStr && strlen(glVersionStr) >= 3)
{
int gl_version = 0;
// A proper version string or object isn't provided, so we have to parse it ourselves
if (isdigit(glVersionStr[0]) && isdigit(glVersionStr[2]))
gl_version = (glVersionStr[0] - '0') * 100 +
(glVersionStr[2] - '0') * 10;
// OpenGL 4.3 is required for Compute Shaders while 3.2 is the base requirement
if (gl_version >= 430)
computeGl = true;
if (gl_version >= 320)
baseGl = true;
}
}
}
delete glPanel;
}

View File

@ -0,0 +1,52 @@
/*
Copyright 2016-2024 melonDS team
This file is part of melonDS.
melonDS is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
melonDS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with melonDS. If not, see http://www.gnu.org/licenses/.
*/
#ifndef SUPPORTEDRENDERERS_H
#define SUPPORTEDRENDERERS_H
using namespace melonDS;
#include "glad/glad.h"
#include <QApplication>
#include "EmuInstance.h"
class SupportedRenderers
{
public:
explicit SupportedRenderers(QWidget* parent);
~SupportedRenderers();
static SupportedRenderers* instance;
// Software
bool software;
// OpenGL
bool baseGl;
bool computeGl;
// Future renderers
private:
void setSupportedOpenGLRenderers(QWidget* parent);
};
#endif // SUPPORTEDRENDERERS_H

View File

@ -24,6 +24,7 @@
#include "Config.h"
#include "GPU.h"
#include "main.h"
#include "SupportedRenderers.h"
#include "VideoSettingsDialog.h"
#include "ui_VideoSettingsDialog.h"
@ -39,11 +40,39 @@ VideoSettingsDialog* VideoSettingsDialog::currentDlg = nullptr;
void VideoSettingsDialog::setEnabled()
{
bool baseGl = SupportedRenderers::instance->baseGl;
bool computeGl = SupportedRenderers::instance->computeGl;
auto& cfg = emuInstance->getGlobalConfig();
int renderer = cfg.GetInt("3D.Renderer");
int oglDisplay = cfg.GetBool("Screen.UseGL");
if (!computeGl)
{
ui->rb3DCompute->setEnabled(false);
if (renderer == renderer3D_OpenGLCompute) // fallback to software renderer
{
ui->rb3DSoftware->setChecked(true);
renderer = renderer3D_Software;
}
}
if (!baseGl) // fallback to software renderer
{
renderer = renderer3D_Software;
oglDisplay = false;
ui->rb3DOpenGL->setEnabled(false);
ui->cbGLDisplay->setChecked(false);
ui->rb3DSoftware->setChecked(true);
}
cfg.SetInt("3D.Renderer", renderer);
cfg.SetBool("Screen.UseGL", oglDisplay);
bool softwareRenderer = renderer == renderer3D_Software;
ui->cbGLDisplay->setEnabled(softwareRenderer);
ui->cbGLDisplay->setEnabled(softwareRenderer && baseGl);
setVsyncControlEnable(oglDisplay || !softwareRenderer);
ui->cbSoftwareThreaded->setEnabled(softwareRenderer);
ui->cbxGLResolution->setEnabled(!softwareRenderer);
ui->cbBetterPolygons->setEnabled(renderer == renderer3D_OpenGL);
@ -146,6 +175,7 @@ void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
void VideoSettingsDialog::setVsyncControlEnable(bool hasOGL)
{
ui->label_2->setEnabled(hasOGL);
ui->cbVSync->setEnabled(hasOGL);
ui->sbVSyncInterval->setEnabled(hasOGL);
}

View File

@ -74,6 +74,7 @@ private slots:
private:
void setVsyncControlEnable(bool hasOGL);
void setEnabled();
int getsupportedRenderers();
Ui::VideoSettingsDialog* ui;
EmuInstance* emuInstance;

View File

@ -83,6 +83,7 @@
#include "CameraManager.h"
#include "Window.h"
#include "AboutDialog.h"
#include "SupportedRenderers.h"
using namespace melonDS;
@ -694,6 +695,10 @@ MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
// if the window was closed in fullscreen do not restore this
setWindowState(windowState() & ~Qt::WindowFullScreen);
}
if (id == 0 && SupportedRenderers::instance == nullptr)
SupportedRenderers* renderers = new SupportedRenderers(this);
show();
panel = nullptr;

View File

@ -11,9 +11,9 @@ add_library(net-utils STATIC
MPInterface.cpp
)
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories(net-utils PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
target_include_directories(net-utils PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/..")
option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF)
if (USE_SYSTEM_LIBSLIRP)