nowrep / obs-vkcapture

OBS Linux Vulkan/OpenGL game capture
GNU General Public License v2.0
508 stars 25 forks source link

Mangohud and SDL games #122

Closed joan31 closed 1 year ago

joan31 commented 1 year ago

Hi,

OBS-VKCAPTURE works fine, but Mangohud does not appear...

For example I try this with CS GO :

obs-gamecapture VK_ADD_LAYER_PATH=/usr/share/vulkan/implicit_layer.d VK_LOADER_LAYERS_ENABLE=VK_LAYER_OBS_vkcapture_64,VK_LAYER_MANGOHUD_overlay mangohud %command% -vulkan

The gamecapture work, but without mangohud in obs...

I try with an Opengl and SDL games like the old counter strike 1.6

obs-gamecapture mangohud %command%

The game appear on OBS but mango hud not.

However, with Apex Legend, all work like a charm :)

joan31 commented 1 year ago

I've modified the "obs-gamecapture" script (really I created the same name of this script but on my .local/bin/) to this :

#!/bin/sh
# VK layers (MangoHUD workaround) for VK_Capture OBS function 

if [ "$#" -eq 0 ]; then
    programname=`basename "$0"`
    echo "ERROR: No program supplied"
    echo
    echo "Usage: $programname <program>"
    exit 1
fi

exec env LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}/usr/\$LIB" \
    LD_PRELOAD="${LD_PRELOAD}${LD_PRELOAD:+:}libobs_glcapture.so" \
    OBS_VKCAPTURE=1 \
    VK_ADD_LAYER_PATH="/usr/share/vulkan/implicit_layer.d" \
    VK_LOADER_LAYERS_ENABLE="VK_LAYER_OBS_vkcapture_*" \
    "$@"

As you can see, I added this two environment variable :

VK_ADD_LAYER_PATH="/usr/share/vulkan/implicit_layer.d"
VK_LOADER_LAYERS_ENABLE="VK_LAYER_OBS_vkcapture_*"

So I use it on steam option launcher :

obs-gamecapture mangohud SDL_VIDEODRIVER=x11 %command% -vulkan

(SDL_VIDEODRIVER=x11 it is because I'm on wayland but CSGO need to bee launch on xwayland).

So this solution work for all games using vulkan (CS GO too). I can see in the obs the game and mangohud.

But, for opengl games, the problem is still here. Game is captured, steam overlay too, but not mangohud.

nowrep commented 1 year ago

As you can see in #14 it depends on the order of loaded layers (eg. vkcapture needs to be loaded last to be able to capture what the layers "before" it rendered).