DadSchoorse / vkBasalt

a vulkan post processing layer for linux
zlib License
1.25k stars 52 forks source link

Support zink #168

Open ghost opened 3 years ago

ghost commented 3 years ago

Currently, no games with zink work with Vkbasalt. No errors are reported but Vkbasalt seems to be loaded, but no effects are ever displayed. Don't know if this is a Vkbasalt issue or a Mesa/Zink issue, or if both are working as intended and they just simply aren't compatible for other technical reasons.

ruany commented 2 years ago

I've managed to get Zink working with vkBasalt and MangoHud by setting specific environment variables.

It seems that Zink doesn't load any Vulkan layers by default. You need to manually add the layer names to VK_INSTANCE_LAYERS and set VK_LAYER_PATH to have any specific Vulkan layers loaded. For example:

VK_INSTANCE_LAYERS="VK_LAYER_VKBASALT_post_processing" VK_LAYER_PATH=/usr/share/vulkan/implicit_layer.d __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink glxgears

This can be used to load vkBasalt with any OpenGL game, as long as it works with Zink.

Calinou commented 2 years ago

This can be used to load vkBasalt with any OpenGL game, as long as it works with Zink.

I can confirm this works on native games (shortest command line that works is VK_INSTANCE_LAYERS="VK_LAYER_VKBASALT_post_processing" VK_LAYER_PATH=/usr/share/vulkan/implicit_layer.d MESA_LOADER_DRIVER_OVERRIDE=zink path/to/game.binary).

However, this doesn't work on OpenGL 1.x games using WINE for me (tested on Cube's Windows release, as the Linux binary suffered from compatibility rot).

ChristianSilvermoon commented 1 year ago

I figured I would share a thing based on the response of @Calinou

#!/bin/bash
# force-zink

export VK_LAYER_PATH=/usr/share/vulkan/implicit_layer.d 
export __GLX_VENDOR_LIBRARY_NAME=mesa
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink

[ "$ENABLE_VKBASALT" = "1" ] && VK_INSTANCE_LAYERS+=":VK_LAYER_VKBASALT_post_processing"
[ "$MANGOHUD" = "1" ] && VK_INSTANCE_LAYERS+=":VK_LAYER_MANGOHUD_overlay"

export VK_INSTANCE_LAYERS
exec "$@"

I keep this under ~/.local/bin/force-zink so I can just do MANGOHUD=1 ENABLE_VKBASALT=1 force-zink opengl-game-here