Page 1 of 1

[Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Fri, 5. Jul 19, 22:19
by shmerl
Version: X4: Foundations (GOG) 2.50 Hotfix 1.
GPU: Sapphire Pulse Vega 56.

I tried to benchmark the game using Mesa's Vulkan overlay. However the overlay didn't show up. After some investigation, it turned out, that the game (X4 binary) does something weird to VK_LAYER_PATH environment variable, namely overrides it with "vulkan/linux" value, which makes Vulkan loader fail to load explicit layers, including the Mesa HUD I was trying to use.

See: https://bugs.freedesktop.org/show_bug.cgi?id=111054

Can you please fix it? The game shouldn't be overriding VK_LAYER_PATH like that.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH

Posted: Sat, 6. Jul 19, 19:12
by edmondo
That's quite strange, but I've got it to run with some workarounds.

I've created an implicit layer definition in ~/.local/share/vulkan/implicit_layer.d like this:

Code: Select all

{
        "file_format_version" : "1.0.0",
        "layer" : {
                "name": "VK_LAYER_MESA_overlay_64",
                "type": "GLOBAL",
                "library_path": "/usr/lib64/libVkLayer_MESA_overlay.so",
                "api_version": "1.1.73",
                "implementation_version": "1",
                "description": "MESA Overlay Layer",
                "disable_environment": { "DISABLE_VK_LAYER_MESA_overlay": "1" },
                "enable_environment": { "ENABLE_VK_LAYER_MESA_overlay": "1" }
        }
}
And added following env variables to the launcher:

Code: Select all

VK_INSTANCE_LAYERS=VK_LAYER_MESA_overlay_64
ENABLE_VK_LAYER_MESA_overlay=1 

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH

Posted: Sun, 7. Jul 19, 05:04
by shmerl
Yeah, I expect implicit layers to work. It's explicit ones that are messed up, due to the game messing up VK_LAYER_PATH variable.

A simpler way to work around it, is to create "vulkan/linux" subdirectories under the same location where your X4 binary is, and symlink your VkLayer_MESA_overlay.json there. That will use the hardcoded path in the game, and the HUD will come up.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH

Posted: Mon, 8. Jul 19, 12:00
by timon37
Hi, it was needed for our testing.
I committed a fix, though I can't promise it'll be released with the next minor patch.
It might have to wait for a major release.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Mon, 8. Jul 19, 21:41
by edmondo
Thanks :)

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH

Posted: Tue, 9. Jul 19, 02:05
by shmerl
timon37 wrote:
Mon, 8. Jul 19, 12:00
Hi, it was needed for our testing.
I committed a fix, though I can't promise it'll be released with the next minor patch.
It might have to wait for a major release.
Great, thanks! By the way, for testing you can always override the location of the layers using the above mentioned environment variable explicitly when running the binary, so there is no need to hardcode it :)

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH

Posted: Tue, 24. Dec 19, 07:33
by shmerl
timon37 wrote:
Mon, 8. Jul 19, 12:00
Hi, it was needed for our testing.
I committed a fix, though I can't promise it'll be released with the next minor patch.
It might have to wait for a major release.
Just tested it with latest GOG release (2.60 hotfix 2). This issue is still there. Did you mean some major version like 3.x?

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Wed, 25. Dec 19, 06:05
by Imperial Good
I suggest checking if the issue still exists with the current beta (3.00). If it does then maybe it has been overlooked somehow.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Wed, 25. Dec 19, 08:13
by shmerl
Imperial Good wrote:
Wed, 25. Dec 19, 06:05
I suggest checking if the issue still exists with the current beta (3.00). If it does then maybe it has been overlooked somehow.
I don't have access to 3.0 unfortunately since GOG doesn't provide beta versions (and I have the GOG version). But I'll give it another test once 3.0 hits GOG.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Wed, 25. Dec 19, 08:15
by Imperial Good
shmerl wrote:
Wed, 25. Dec 19, 08:13
I don't have access to 3.0 unfortunately since GOG doesn't provide beta versions (and I have the GOG version). But I'll give it another test once 3.0 hits GOG.
Strange, according to the beta instructions GOG should offer the same betas as Steam.
viewtopic.php?f=192&t=405397

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Thu, 26. Dec 19, 03:52
by shmerl
Imperial Good wrote:
Wed, 25. Dec 19, 08:15
Strange, according to the beta instructions GOG should offer the same betas as Steam.
viewtopic.php?f=192&t=405397
Interesting, but I don't use Galaxy - it's not wired with Linux releases on GOG backend anyway - it only works with Windows ones. Do you know how to get beta Linux versions on GOG? I'd be really interested. The download through their site doesn't show anything beta related. I'll also ping GOG about it.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Thu, 26. Dec 19, 05:18
by Imperial Good
shmerl wrote:
Thu, 26. Dec 19, 03:52
Interesting, but I don't use Galaxy - it's not wired with Linux releases on GOG backend anyway - it only works with Windows ones. Do you know how to get beta Linux versions on GOG? I'd be really interested. The download through their site doesn't show anything beta related. I'll also ping GOG about it.
If the service is not available on Linux that I guess there is no Linux beta sadly.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Thu, 26. Dec 19, 12:46
by Alan Phipps
CBJ explained it here.

Re: [Linux/bug] Vulkan layers don't work with X4 due to game overriding VK_LAYER_PATH - Fix in a future build.

Posted: Thu, 26. Dec 19, 14:08
by Rastuasi
Linux Beta is not available on GoG.