From 2ca39ea1db7dae33985868c9615f21be60a399f3 Mon Sep 17 00:00:00 2001
From: Htylol <55416159+Htylol@users.noreply.github.com>
Date: Sun, 4 Feb 2024 02:37:35 +0500
Subject: [PATCH] fix zink on x11 session mesa 23.3

---
 data_from_portwine/scripts/runlib | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/data_from_portwine/scripts/runlib b/data_from_portwine/scripts/runlib
index 81761690..1a3cd888 100755
--- a/data_from_portwine/scripts/runlib
+++ b/data_from_portwine/scripts/runlib
@@ -462,12 +462,22 @@ start_portwine () {
         export WINE_D3D_CONFIG='renderer=gl'
     elif [[ "${PW_VULKAN_USE}" == "5" ]] ; then
         print_info "Use OpenGL Zink"
+        if [[ "${XDG_SESSION_TYPE}" == "wayland" ]] || [[ "${PW_USE_GAMESCOPE}" == 1 ]] ; then
         export GL_YIELD="NOTHING"
         export mesa_glthread=true
         export WINE_D3D_CONFIG='renderer=gl'
         export  __GLX_VENDOR_LIBRARY_NAME=mesa
         export MESA_LOADER_DRIVER_OVERRIDE=zink
         export GALLIUM_DRIVER=zink
+        else
+        export GL_YIELD="NOTHING"
+        export mesa_glthread=true
+        export WINE_D3D_CONFIG='renderer=gl'
+        export  __GLX_VENDOR_LIBRARY_NAME=mesa
+        export MESA_LOADER_DRIVER_OVERRIDE=zink
+        export GALLIUM_DRIVER=zink
+        export LIBGL_KOPPER_DRI2=1
+        fi
     elif [[ "${PW_VULKAN_USE}" == "3" ]] ; then
         print_info "Use GALLIUM-NINE (Native DX9 on MESA drivers)"
         export PW_GALLIUM_NINE_VER="0.8"