Introducing Zink: An OpenGL implementation on top of Vulkan

Erik Kusma Faye-Lund, a graphics programmer, introduced Zink on Wednesday. Zinc is an OpenGL implementation on top of Vulkan. It is a Mesa Gallium driver that supports OpenGL implementation in Mesa to provide hardware-accelerated OpenGL when only a Vulkan driver is available.

Currently, Zink is only available as a source code, distro-packages aren’t available yet. It has only been tested on Linux. To build Zink, one needs to have Git, Vulkan headers and libraries, Meson and Ninja. Also, one needs to build dependencies to compile Mesa.

Erik says, “And most importantly, we are not a conformant OpenGL implementation. I’m not saying we will never be, but as it currently stands, we do not do conformance testing, and as such we neither submit conformance results to Khronos.”

What Zink may include

1. Just one API

OpenGL is a big API and is well-established as a requirement for applications and desktop compositors. But since the release of Vulkan, there are two APIs for essentially the same hardware functionality but both are important. As the software-world is working hard to implement Vulkan support everywhere, this is leading to complexity. One would only require things like desktop compositors to support one API in the future. There might be a future where OpenGL’s role could purely be one of legacy application compatibility. Maybe Zink can help in making the future better!

2. Lessen the workload of GPU drivers

Everyone wants less amount of code to maintain for legacy hardware but the drivers to maintain are growing rapidly. Also, new drivers have been written for old hardware. If the hardware is capable of supporting Vulkan, it could be easier to only support Vulkan “natively”, and do OpenGL through Zink.

There aren’t infinite programmers that can maintain every GPU driver forever. But maybe with Zink, driver-support might get better and easier.

3. Zink comes with benefits

Since Zink is implemented as a Gallium driver in Mesa, there are some side-benefits that come “for free”. For instance, projects like Gallium Nine or Clover could, in theory, may work on top of the i965 Vulkan driver through Zink in the future. In the coming years, Zink might also act as a cooperation-layer between OpenGL and Vulkan code in the same application.

4. Zink could be used as a closed-source Vulkan driver

Zink might also run smoothly on top of a closed-source Vulkan driver and still get proper window system integration.

What does Zink require?

Currently, Zink requires a Vulkan 1.0 implementation and the following extensions:

VK_KHR_maintenance1: This extension is required for the viewport flipping.

VK_KHR_external_memory_fd : This extension is required for getting the rendered result on screen.

Additionally, Erick has also shared a list of features that Zink doesn’t support, which include:

Currently, glPointSize() is not supported. Though writing to gl_PointSize from the vertex shader does work.

The texture borders are currently black due to Vulkan’s lack of arbitrary border-color support.

Currently, no control-flow is supported in the shaders.

There is no GL_ALPHA_TEST and glShadeModel(GL_FLAT) support yet.

It would be interesting to see how Zink turns out when the features go live! Read more about this news on Kusma’s official website.