Add Zink Override (#8373)

* Add Zink Override

Add Zink Override

* Add Zink Override (#1)

Add Zink Override

* Fix escape literals

* Fix Escape Literals (#2)

* Add Zink Override

Add Zink Override

* Fix escape literals

* Add checks for wayland/render gpu and manual user overrides

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
klylabs 2025-02-25 13:39:53 +00:00 committed by GitHub
parent 906923cd24
commit fd8792f342
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,6 +43,30 @@ export LD_LIBRARY_PATH="\$DIR/bin:\$LD_LIBRARY_PATH"
# 1) OrcaSlicer will segfault on systems where locale info is not as expected (i.e. Holo-ISO arch-based distro)
export LC_ALL=C
if [ "\$XDG_SESSION_TYPE" = "wayland" ] && [ "\$ZINK_DISABLE_OVERRIDE" != "1" ]; then
if command -v glxinfo >/dev/null 2>&1; then
RENDERER=\$(glxinfo | grep "OpenGL renderer string:" | sed 's/.*: //')
if echo "\$RENDERER" | grep -qi "NVIDIA"; then
if [ "\$ZINK_FORCE_OVERRIDE" = "1" ]; then
APPLY_OVERRIDE=1
else
if command -v nvidia-smi >/dev/null 2>&1; then
DRIVER_VERSION=\$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n1)
DRIVER_MAJOR=\$(echo "\$DRIVER_VERSION" | cut -d. -f1)
[ "\$DRIVER_MAJOR" -gt 555 ] && APPLY_OVERRIDE=1
fi
fi
if [ "\$APPLY_OVERRIDE" = "1" ]; then
export __GLX_VENDOR_LIBRARY_NAME=mesa
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink
export WEBKIT_DISABLE_DMABUF_RENDERER=1
fi
fi
fi
fi
exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"
EOF