How do I force a program to use Zink?

Hi! How do I practically use Zink? I’ve read all kinds of stuff alluding to what Zink does and how cool it is and stuff, but nowhere is there a practical example of initializing a program with it as the OpenGL backend in use.

From research, I’ve seen some environment variables that I thought might force zink usage and give me information about whether it’s in use, so I’ve tried prepending this to an OpenGL program command line:

ZINK_DEBUG="nir,spirv,tgsi,validation" MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink 

I tried with this at first:

ZINK_DEBUG="nir,spirv,tgsi,validation" MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink glxgears -info

I got no zink debug information that I was expecting, or any other indication that zink was in use, so I tried running RetroArch like this:

ZINK_DEBUG="nir,spirv,tgsi,validation" MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink retroarch -v 2>&1

I made sure to set the driver to “gl” in RetroArch, then I tried restarting it with the same command line and setting it to “glcore”, and restarting it again. While RA loaded with all of those attempts just fine, none of those attempts showed any zink-related output in my terminal, so I still have no idea if zink was in use.

So, how do I even check if it’s in use, let alone make it be used? It’s so confusing, especially when there’s a post on Reddit from a year ago with someone claiming to have run Minecraft with zink: https://www.reddit.com/r/linux_gaming/comments/hkq51m/minecraft_running_with_zink/ . They don’t explain how they did it, and nowhere else seems to make it obvious to me.

If anyone has some insight about this, please let me know. I’m still getting familiar with this stuff.

By the way, my rationale for trying zink is that some native Linux games I’ve played that use the OpenGL backend have exhibited extreme Z-fighting while using DXVK when running the Windows version of the same games have not. If zink fixes this with my driver, I’d like to use it instead of raw OpenGL.

Just
MESA_LOADER_DRIVER_OVERRIDE=zink program

Should be enough

So with retroarch should be

MESA_LOADER_DRIVER_OVERRIDE=zink retroarch

If that’s it, then it doesn’t seem to be working. I tried this here on my machine, which is the same thing Michael Larabel of Phoronix showed on his blog post here: Zink Benchmarks - Mesa OpenGL Running Over Vulkan - Phoronix

[alex@alex-pc ~]$ MESA_LOADER_DRIVER_OVERRIDE=zink glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.63.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 470.63.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 470.63.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
[alex@alex-pc ~]$

I see no mention of zink at all. If it should be because of Nvidia, I can see that zink got Nvidia support back in February in Mike Blumenkrantz’ blog, here: Mo Cards Mo Problems – Mike Blumenkrantz – Super. Good. Code.

As a result, I think it should be working with these commands, but I don’t see it working at all.

For some reason its not working for me on nvidia neither,but it works for my intel,maybe for nvidia indeed need a little more than just MESA_LOADER_DRIVER_OVERRIDE=zink

MESA_LOADER_DRIVER_OVERRIDE=zink prime-run  glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 470.63.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 470.63.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 470.63.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
MESA_LOADER_DRIVER_OVERRIDE=zink glxinfo | grep OpenGL
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

OpenGL vendor string: Collabora Ltd
OpenGL renderer string: zink (Intel(R) HD Graphics 630 (KBL GT2))
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.1.6
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 21.1.6
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.1.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:

1 Like

Thanks for testing this on your machine. This gives me some sanity that it’s not just my configuration that’s busted.

I’ve asked Mike Blumenkrantz directly in this comment on the relevant blog post about getting zink to work with Nvidia: Mo Cards Mo Problems – Mike Blumenkrantz – Super. Good. Code.

I’ll wait to see what Mike says, if anything.

Mike Blumenkrantz replied to me with the correct command line! These environment variables work:

__GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink

So, this is working here, with my Nvidia GTX 1080 Ti!

[alex@alex-pc ~]$ __GLX_VENDOR_LIBRARY_NAME=mesa MESA_LOADER_DRIVER_OVERRIDE=zink GALLIUM_DRIVER=zink glxinfo | grep OpenGL
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/alex/.config/MangoHud/glxinfo.conf [ not found ]
skipping config: /home/alex/.config/MangoHud/MangoHud.conf [ not found ]
OpenGL vendor string: Collabora Ltd
OpenGL renderer string: zink (NVIDIA GeForce GTX 1080 Ti)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 21.2.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 21.2.1
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.2.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
[alex@alex-pc ~]$
1 Like