fix: allow disabling gl and vulkan features with an envvar and disable it by default on appimage/portable

the previous approach didn't work with runtime symbol lookup errors

Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com>
This commit is contained in:
DioEgizio 2026-03-20 15:31:34 +01:00
parent 348907f7d1
commit e524fa5b6b
4 changed files with 19 additions and 0 deletions

View file

@ -90,6 +90,8 @@ runs:
# FIXME(@getchoo): gamemode doesn't seem to be very portable with DBus. Find a way to make it work! # FIXME(@getchoo): gamemode doesn't seem to be very portable with DBus. Find a way to make it work!
find "$INSTALL_APPIMAGE_DIR" -name '*gamemode*' -exec rm {} + find "$INSTALL_APPIMAGE_DIR" -name '*gamemode*' -exec rm {} +
#disable OpenGL and Vulkan launcher features until https://github.com/VHSgunzo/sharun/issues/35
echo "LAUNCHER_DISABLE_GLVULKAN=1" > "$INSTALL_APPIMAGE_DIR"/.env
#makes the launcher use portals for file picking #makes the launcher use portals for file picking
echo "QT_QPA_PLATFORMTHEME=xdgdesktopportal" > "$INSTALL_APPIMAGE_DIR"/.env echo "QT_QPA_PLATFORMTHEME=xdgdesktopportal" > "$INSTALL_APPIMAGE_DIR"/.env
ln -s org.prismlauncher.PrismLauncher.metainfo.xml "$INSTALL_APPIMAGE_DIR"/share/metainfo/org.prismlauncher.PrismLauncher.appdata.xml ln -s org.prismlauncher.PrismLauncher.metainfo.xml "$INSTALL_APPIMAGE_DIR"/share/metainfo/org.prismlauncher.PrismLauncher.appdata.xml

View file

@ -21,6 +21,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QOffscreenSurface> #include <QOffscreenSurface>
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QProcessEnvironment>
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
#include <QVulkanInstance> #include <QVulkanInstance>
@ -30,6 +31,9 @@
namespace { namespace {
bool vulkanInfo(QStringList& out) bool vulkanInfo(QStringList& out)
{ {
if (!QProcessEnvironment::systemEnvironment().value(QStringLiteral("LAUNCHER_DISABLE_GLVULKAN")).isEmpty()) {
return false;
}
#ifndef Q_OS_MACOS #ifndef Q_OS_MACOS
QVulkanInstance inst; QVulkanInstance inst;
if (!inst.create()) { if (!inst.create()) {
@ -53,6 +57,9 @@ bool vulkanInfo(QStringList& out)
bool openGlInfo(QStringList& out) bool openGlInfo(QStringList& out)
{ {
if (!QProcessEnvironment::systemEnvironment().value(QStringLiteral("LAUNCHER_DISABLE_GLVULKAN")).isEmpty()) {
return false;
}
QOpenGLContext ctx; QOpenGLContext ctx;
if (!ctx.create()) { if (!ctx.create()) {
qWarning() << "OpenGL context creation failed"; qWarning() << "OpenGL context creation failed";

View file

@ -21,6 +21,11 @@ echo "Launcher Dir: ${LAUNCHER_DIR}"
# Makes the launcher use portals for file picking # Makes the launcher use portals for file picking
export QT_QPA_PLATFORMTHEME=xdgdesktopportal export QT_QPA_PLATFORMTHEME=xdgdesktopportal
# disable OpenGL and Vulkan launcher features on sharun until https://github.com/VHSgunzo/sharun/issues/35
if [[ -f "${LAUNCHER_DIR}/sharun" ]]; then
export LAUNCHER_DISABLE_GLVULKAN=1
fi
# Just to be sure... # Just to be sure...
chmod +x "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}" chmod +x "${LAUNCHER_DIR}/bin/${LAUNCHER_NAME}"

View file

@ -20,6 +20,7 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QOpenGLBuffer> #include <QOpenGLBuffer>
#include <QProcessEnvironment>
#include <QVector2D> #include <QVector2D>
#include <QVector3D> #include <QVector3D>
#include <QtMath> #include <QtMath>
@ -330,6 +331,10 @@ void SkinOpenGLWindow::setElytraVisible(bool visible)
bool SkinOpenGLWindow::hasOpenGL() bool SkinOpenGLWindow::hasOpenGL()
{ {
if (!QProcessEnvironment::systemEnvironment().value(QStringLiteral("LAUNCHER_DISABLE_GLVULKAN")).isEmpty()) {
return false;
}
QOpenGLContext ctx; QOpenGLContext ctx;
return ctx.create(); return ctx.create();
} }