sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.04k stars 70 forks source link

Zink and Prime-Run Compatibility #1040

Closed Rabcor closed 4 months ago

Rabcor commented 4 months ago

To ensure compatibility between prime-run and zink, the zink variables must be loaded after the prime-run ones (this is because both of them set __GLX_VENDOR_LIBRARY_NAME and for Zink to activate this must be set to mesa.

Currently it seems the prime-run variables are loaded after the zink ones thus leading to no zink if prime-run is also enabled.

To illustrate:

zinkrun prime-run mangohud glxgears 24-02-44-

prime-run zinkrun mangohud glxgears 24-02-45-

sonic2kk commented 4 months ago

Nice catch, thanks!

The issue and solution you described makes sense after looking at the code too, I didn't realise how __GLX_VENDOR_LIBRARY_NAME was being set at first.

The solution should be as straightforward as moving the check for Zink to be after Primerun (as you described) in the following place (looks like GitHub doesn't embed linked code snippets for files with many lines): https://github.com/sonic2kk/steamtinkerlaunch/blob/b106b3304dd3c4fd6ad8d4364cb79003f2ca5cc3/steamtinkerlaunch#L12422-L12426

I would normally open this up to ask if you would like to make a PR for this, since you took the time to understand and cleanly report the problem, but I actually want to do a slight refactor here to break some of the code into separate "checker" functions, so I'll take a look at fixing this. Otherwise I would've given an opportunity to contribute the fix and get all the credit, but you'll just have to settle for most of it I think ;-)

I'll push a branch and open a PR. I'll let you know when it's ready for testing and you can check if the problem is fixed on your end with the branch. I think we tested some branches before but let me know if you need any help checking out the branch.

sonic2kk commented 4 months ago

A branch that implements the fix as described is available at primerun-zink-change.

The associated PR is up at #1041.

If/when you are able to confirm this fixes the issue, I'll bump the version and merge the PR :-)

Rabcor commented 4 months ago

Launched with tinkerlaunch with prime-run and zink: image

It works.

sonic2kk commented 4 months ago

Awesome! I'll merge when I'm on my PC. Thank you!

sonic2kk commented 4 months ago

Fixed with #1041. Thanks again!!