mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-14 06:27:07 +02:00
[opengl] remove GLAD symbols from builds w/o OpenGL (#3922)
removes unused symbols from non-OpenGL builds, notably mac I REMEMBER MAKING THIS PR A WHILE AGO but I have no record of it here, so hell lets redo it Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3922 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
8f4e8c6d6a
commit
ca1fcaca3b
6 changed files with 56 additions and 24 deletions
|
|
@ -323,7 +323,10 @@ if (ENABLE_OPENGL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(video_core PUBLIC common core)
|
target_link_libraries(video_core PUBLIC common core)
|
||||||
target_link_libraries(video_core PUBLIC glad shader_recompiler stb bc_decoder gpu_logging)
|
target_link_libraries(video_core PUBLIC shader_recompiler stb bc_decoder gpu_logging)
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_link_libraries(video_core PUBLIC glad)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (YUZU_USE_EXTERNAL_FFMPEG)
|
if (YUZU_USE_EXTERNAL_FFMPEG)
|
||||||
add_dependencies(video_core ffmpeg-build)
|
add_dependencies(video_core ffmpeg-build)
|
||||||
|
|
|
||||||
|
|
@ -411,8 +411,11 @@ endif()
|
||||||
|
|
||||||
target_link_libraries(yuzu PRIVATE nlohmann_json::nlohmann_json)
|
target_link_libraries(yuzu PRIVATE nlohmann_json::nlohmann_json)
|
||||||
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core qt_common)
|
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core qt_common)
|
||||||
target_link_libraries(yuzu PRIVATE Boost::headers glad Qt6::Widgets Qt6::Charts Qt6::Concurrent)
|
target_link_libraries(yuzu PRIVATE Boost::headers Qt6::Widgets Qt6::Charts Qt6::Concurrent)
|
||||||
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_link_libraries(yuzu PRIVATE glad)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_link_libraries(yuzu PRIVATE Qt6::DBus)
|
target_link_libraries(yuzu PRIVATE Qt6::DBus)
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
#include <QtCore/qglobal.h>
|
||||||
#include "common/settings_enums.h"
|
#include "common/settings_enums.h"
|
||||||
|
|
@ -1039,11 +1042,12 @@ void GRenderWindow::InitializeNull() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GRenderWindow::LoadOpenGL() {
|
bool GRenderWindow::LoadOpenGL() {
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
auto context = CreateSharedContext();
|
auto context = CreateSharedContext();
|
||||||
auto scope = context->Acquire();
|
auto scope = context->Acquire();
|
||||||
if (!gladLoadGL()) {
|
if (!gladLoadGL()) {
|
||||||
QMessageBox::warning(
|
QtCommon::Frontend::Warning(
|
||||||
this, tr("Error while initializing OpenGL!"),
|
tr("Error while initializing OpenGL!"),
|
||||||
tr("Your GPU may not support OpenGL, or you do not have the latest graphics driver."));
|
tr("Your GPU may not support OpenGL, or you do not have the latest graphics driver."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -1052,15 +1056,16 @@ bool GRenderWindow::LoadOpenGL() {
|
||||||
const QString renderer =
|
const QString renderer =
|
||||||
QString::fromUtf8(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
|
QString::fromUtf8(reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
|
||||||
if (!GLAD_GL_VERSION_4_6) {
|
if (!GLAD_GL_VERSION_4_6) {
|
||||||
QMessageBox::warning(this, tr("Error while initializing OpenGL 4.6!"),
|
QtCommon::Frontend::Warning(
|
||||||
|
tr("Error while initializing OpenGL 4.6!"),
|
||||||
tr("Your GPU may not support OpenGL 4.6, or you do not have the "
|
tr("Your GPU may not support OpenGL 4.6, or you do not have the "
|
||||||
"latest graphics driver.<br><br>GL Renderer:<br>%1")
|
"latest graphics driver.<br><br>GL Renderer:<br>%1")
|
||||||
.arg(renderer));
|
.arg(renderer));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (QStringList missing_ext = GetUnsupportedGLExtensions(); !missing_ext.empty()) {
|
if (QStringList missing_ext = GetUnsupportedGLExtensions(); !missing_ext.empty()) {
|
||||||
QMessageBox::warning(
|
QtCommon::Frontend::Warning(
|
||||||
this, tr("Error while initializing OpenGL!"),
|
tr("Error while initializing OpenGL!"),
|
||||||
tr("Your GPU may not support one or more required OpenGL extensions. Please ensure you "
|
tr("Your GPU may not support one or more required OpenGL extensions. Please ensure you "
|
||||||
"have the latest graphics driver.<br><br>GL Renderer:<br>%1<br><br>Unsupported "
|
"have the latest graphics driver.<br><br>GL Renderer:<br>%1<br><br>Unsupported "
|
||||||
"extensions:<br>%2")
|
"extensions:<br>%2")
|
||||||
|
|
@ -1069,10 +1074,17 @@ bool GRenderWindow::LoadOpenGL() {
|
||||||
// Non fatal
|
// Non fatal
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
QtCommon::Frontend::Warning(
|
||||||
|
tr("Error while initializing OpenGL!"),
|
||||||
|
tr("This build doesn't have OpenGL support."));
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GRenderWindow::GetUnsupportedGLExtensions() const {
|
QStringList GRenderWindow::GetUnsupportedGLExtensions() const {
|
||||||
QStringList missing_ext;
|
QStringList missing_ext{};
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
// Extensions required to support some texture formats.
|
// Extensions required to support some texture formats.
|
||||||
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
||||||
missing_ext.append(QStringLiteral("EXT_texture_compression_s3tc"));
|
missing_ext.append(QStringLiteral("EXT_texture_compression_s3tc"));
|
||||||
|
|
@ -1082,6 +1094,7 @@ QStringList GRenderWindow::GetUnsupportedGLExtensions() const {
|
||||||
LOG_ERROR(Frontend, "GPU does not support all required extensions");
|
LOG_ERROR(Frontend, "GPU does not support all required extensions");
|
||||||
for (const QString& ext : missing_ext)
|
for (const QString& ext : missing_ext)
|
||||||
LOG_ERROR(Frontend, "Unsupported GL extension: {}", ext.toStdString());
|
LOG_ERROR(Frontend, "Unsupported GL extension: {}", ext.toStdString());
|
||||||
|
#endif
|
||||||
return missing_ext;
|
return missing_ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,18 @@ function(create_resource file output filename)
|
||||||
file(WRITE "${PROJECT_BINARY_DIR}/dist/${output}" "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned ${filename}_size = sizeof(${filename});\n")
|
file(WRITE "${PROJECT_BINARY_DIR}/dist/${output}" "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned ${filename}_size = sizeof(${filename});\n")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
list(APPEND OPENGL_SOURCES
|
||||||
|
emu_window/emu_window_sdl2_gl.cpp
|
||||||
|
emu_window/emu_window_sdl2_gl.h
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
set(OPENGL_SOURCES "")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(yuzu-cmd
|
add_executable(yuzu-cmd
|
||||||
emu_window/emu_window_sdl2.cpp
|
emu_window/emu_window_sdl2.cpp
|
||||||
emu_window/emu_window_sdl2.h
|
emu_window/emu_window_sdl2.h
|
||||||
emu_window/emu_window_sdl2_gl.cpp
|
|
||||||
emu_window/emu_window_sdl2_gl.h
|
|
||||||
emu_window/emu_window_sdl2_null.cpp
|
emu_window/emu_window_sdl2_null.cpp
|
||||||
emu_window/emu_window_sdl2_null.h
|
emu_window/emu_window_sdl2_null.h
|
||||||
emu_window/emu_window_sdl2_vk.cpp
|
emu_window/emu_window_sdl2_vk.cpp
|
||||||
|
|
@ -28,10 +35,13 @@ add_executable(yuzu-cmd
|
||||||
sdl_config.h
|
sdl_config.h
|
||||||
yuzu.cpp
|
yuzu.cpp
|
||||||
yuzu.rc
|
yuzu.rc
|
||||||
|
${OPENGL_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(yuzu-cmd PRIVATE common core input_common frontend_common video_core)
|
target_link_libraries(yuzu-cmd PRIVATE common core input_common frontend_common video_core)
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
target_link_libraries(yuzu-cmd PRIVATE glad)
|
target_link_libraries(yuzu-cmd PRIVATE glad)
|
||||||
|
endif()
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(yuzu-cmd PRIVATE getopt)
|
target_link_libraries(yuzu-cmd PRIVATE getopt)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -59,20 +59,16 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() {
|
bool EmuWindow_SDL2_GL::SupportsRequiredGLExtensions() {
|
||||||
std::vector<std::string_view> unsupported_ext;
|
std::vector<std::string_view> unsupported_ext{};
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
// Extensions required to support some texture formats.
|
// Extensions required to support some texture formats.
|
||||||
if (!GLAD_GL_EXT_texture_compression_s3tc) {
|
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
||||||
unsupported_ext.push_back("EXT_texture_compression_s3tc");
|
unsupported_ext.push_back("EXT_texture_compression_s3tc");
|
||||||
}
|
if (!GLAD_GL_ARB_texture_compression_rgtc)
|
||||||
if (!GLAD_GL_ARB_texture_compression_rgtc) {
|
|
||||||
unsupported_ext.push_back("ARB_texture_compression_rgtc");
|
unsupported_ext.push_back("ARB_texture_compression_rgtc");
|
||||||
}
|
for (const auto& extension : unsupported_ext)
|
||||||
|
|
||||||
for (const auto& extension : unsupported_ext) {
|
|
||||||
LOG_CRITICAL(Frontend, "Unsupported GL extension: {}", extension);
|
LOG_CRITICAL(Frontend, "Unsupported GL extension: {}", extension);
|
||||||
}
|
#endif
|
||||||
|
|
||||||
return unsupported_ext.empty();
|
return unsupported_ext.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,9 @@
|
||||||
#include "sdl_config.h"
|
#include "sdl_config.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "yuzu_cmd/emu_window/emu_window_sdl2.h"
|
#include "yuzu_cmd/emu_window/emu_window_sdl2.h"
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
#include "yuzu_cmd/emu_window/emu_window_sdl2_gl.h"
|
#include "yuzu_cmd/emu_window/emu_window_sdl2_gl.h"
|
||||||
|
#endif
|
||||||
#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
|
#include "yuzu_cmd/emu_window/emu_window_sdl2_null.h"
|
||||||
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
|
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
|
||||||
|
|
||||||
|
|
@ -349,17 +351,22 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::unique_ptr<EmuWindow_SDL2> emu_window;
|
std::unique_ptr<EmuWindow_SDL2> emu_window;
|
||||||
switch (Settings::values.renderer_backend.GetValue()) {
|
switch (Settings::values.renderer_backend.GetValue()) {
|
||||||
|
#ifdef HAS_OPENGL
|
||||||
case Settings::RendererBackend::OpenGL_GLSL:
|
case Settings::RendererBackend::OpenGL_GLSL:
|
||||||
case Settings::RendererBackend::OpenGL_GLASM:
|
case Settings::RendererBackend::OpenGL_GLASM:
|
||||||
case Settings::RendererBackend::OpenGL_SPIRV:
|
case Settings::RendererBackend::OpenGL_SPIRV:
|
||||||
emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, system, fullscreen);
|
emu_window = std::make_unique<EmuWindow_SDL2_GL>(&input_subsystem, system, fullscreen);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case Settings::RendererBackend::Vulkan:
|
case Settings::RendererBackend::Vulkan:
|
||||||
emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, system, fullscreen);
|
emu_window = std::make_unique<EmuWindow_SDL2_VK>(&input_subsystem, system, fullscreen);
|
||||||
break;
|
break;
|
||||||
case Settings::RendererBackend::Null:
|
case Settings::RendererBackend::Null:
|
||||||
emu_window = std::make_unique<EmuWindow_SDL2_Null>(&input_subsystem, system, fullscreen);
|
emu_window = std::make_unique<EmuWindow_SDL2_Null>(&input_subsystem, system, fullscreen);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
LOG_CRITICAL(Frontend, "Invalid renderer backend");
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue