<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog on Erik “kusma” Faye-Lund</title>
    <link>https://kusma.xyz/blog/</link>
    <description>Recent content in Blog on Erik “kusma” Faye-Lund</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>kusmabite@gmail.com (Erik Faye-Lund)</managingEditor>
    <webMaster>kusmabite@gmail.com (Erik Faye-Lund)</webMaster>
    <lastBuildDate>Thu, 06 Jul 2023 21:15:00 +0200</lastBuildDate>
    <atom:link href="https://kusma.xyz/blog/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Zink brings conformant OpenGL on Imagination GPUs</title>
      <link>https://kusma.xyz/blog/2023/07/06/zink-brings-conformant-opengl-on-imagination-gpus/</link>
      <pubDate>Thu, 06 Jul 2023 21:15:00 +0200</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2023/07/06/zink-brings-conformant-opengl-on-imagination-gpus/</guid>
      <description>&lt;p&gt;Today, &lt;a href=&#34;https://www.imaginationtech.com/&#34;&gt;Imagination Technologies&lt;/a&gt; announced some very exciting news: they are now &lt;a href=&#34;https://blog.imaginationtech.com/imagination-gpus-now-support-opengl-4.6&#34;&gt;using Zink for full OpenGL 4.6 support&lt;/a&gt;! Collabora had the pleasure of working together with engineers from Imagination to make this a reality, and it&amp;rsquo;s very rewarding to now be able show the results to the world!&lt;/p&gt;
&lt;p&gt;More importantly, this is the first time we&amp;rsquo;ve seen a hardware vendor trust the OpenGL-on-Vulkan Mesa driver enough to
completely &lt;em&gt;side-step&lt;/em&gt; a native OpenGL driver and use it in a &lt;em&gt;shipping
product&lt;/em&gt;. It&amp;rsquo;s wonderful to see that Zink can realistically be used as a
work-horse, &lt;strong&gt;especially&lt;/strong&gt; in a high-performance graphics setting.&lt;/p&gt;
&lt;p&gt;Zink &lt;a href=&#34;https://www.collabora.com/news-and-blog/blog/2018/10/31/introducing-zink-opengl-implementation-vulkan/&#34;&gt;started out&lt;/a&gt; as a small R&amp;amp;D project at Collabora, but has since grown
to be a full-on community project. None of this would have been possible
without the awesome work done by &lt;a href=&#34;https://www.supergoodcode.com/&#34;&gt;Mike&lt;/a&gt; and the other Zink contributors!&lt;/p&gt;
&lt;h2 id=&#34;conformance&#34;&gt;Conformance
&lt;a class=&#34;header-link&#34; href=&#34;#conformance&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;One small detail from Imagination&amp;rsquo;s post that I think is important to
highlight is that the solution is &lt;a href=&#34;https://www.khronos.org/conformance/adopters/conformant-products/opengl#submission_332&#34;&gt;officially conformant&lt;/a&gt;. This is the first
product to be officially conformant using Zink, but it&amp;rsquo;s not going to be the
last! In fact, we only need one more conformant implementation before Zink
itself is conformant as a generic layered implementation, according to
the Khronos &lt;a href=&#34;https://www.khronos.org/files/conformance_procedures.pdf&#34;&gt;Conformant Product Criteria&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;an-open-source-graphics-future&#34;&gt;An Open Source graphics future
&lt;a class=&#34;header-link&#34; href=&#34;#an-open-source-graphics-future&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;In the not too distant future, we should be able to combine Zink with the
in-progress &lt;a href=&#34;https://developer.imaginationtech.com/open-source-gpu-driver/&#34;&gt;open source driver&lt;/a&gt; from Imagination, and that&amp;rsquo;s when things
will &lt;em&gt;really&lt;/em&gt; start to shine for the open source graphics stack on
Imagination hardware. So there&amp;rsquo;s plenty more to look forward to here!&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Zink: Summer 2021 Update</title>
      <link>https://kusma.xyz/blog/2021/06/14/zink-summer-2021-update/</link>
      <pubDate>Mon, 14 Jun 2021 20:00:00 +0100</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2021/06/14/zink-summer-2021-update/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s a lot that has happened in the world of Zink since my &lt;a href=&#34;https://kusma.xyz/blog/2019/10/24/zink-fall-update/&#34;&gt;last
update&lt;/a&gt;, so let&amp;rsquo;s see if I can bring you up to date on the most
important stuff.&lt;/p&gt;
&lt;h2 id=&#34;upstream-development&#34;&gt;Upstream development
&lt;a class=&#34;header-link&#34; href=&#34;#upstream-development&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Gosh, when I last blogged about Zink, it hadn&amp;rsquo;t even landed upstream
in Mesa yet! Well, by now it&amp;rsquo;s been upstream for quite a while, and most
development has moved there.&lt;/p&gt;
&lt;p&gt;At the time of writing, we have &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests?scope=all&amp;amp;utf8=%E2%9C%93&amp;amp;state=merged&amp;amp;label_name%5B%5D=zink&#34;&gt;merged 606 merge-requests&lt;/a&gt;
labeled &amp;ldquo;zink&amp;rdquo;. The current tip of mesa&amp;rsquo;s main branch is totaling 1717
commits touching the &lt;code&gt;src/gallium/drivers/zink/&lt;/code&gt; sub-folder, written by
42 different contributors. That&amp;rsquo;s pretty awesome in my eyes, Zink has
truly become a community project!&lt;/p&gt;
&lt;p&gt;Another noteworthy change is that &lt;a href=&#34;https://www.supergoodcode.com/&#34;&gt;Mike Blumenkrantz&lt;/a&gt; has come
aboard the project, and has churned out an incredible amount of
improvements to Zink! He got hired by &lt;a href=&#34;https://www.valvesoftware.com/en/about&#34;&gt;Valve&lt;/a&gt; to work on Zink (among
other things), and is now the most prolific contributor, with more than
twice the amount of commits than I have written.&lt;/p&gt;
&lt;p&gt;If you want a job in Open Source graphics, Zink has a proven
track-record as a job-creator! &amp;#x1f604;&lt;/p&gt;
&lt;p&gt;In addition to Mike, there&amp;rsquo;s some other awesome people who have been
helping out lately.&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2021/06/14/zink-summer-2021-update/images/hl2.png&#34; alt=&#34;Half-Life 2 running with Zink.&#34; title=&#34;Half-Life 2 running with Zink.&#34;&gt;
  &lt;figcaption&gt;Half-Life 2 running with Zink.&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&#34;opengl-46-support&#34;&gt;OpenGL 4.6 support
&lt;a class=&#34;header-link&#34; href=&#34;#opengl-46-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Thanks to a lot of hard work by Mike assisted by &lt;a href=&#34;https://airlied.blogspot.com/&#34;&gt;Dave Airlie&lt;/a&gt;
and &lt;a href=&#34;https://ajaxnwnk.blogspot.com/&#34;&gt;Adam Jackson&lt;/a&gt;, both of &lt;a href=&#34;https://www.redhat.com/&#34;&gt;RedHat&lt;/a&gt;, Zink is now able to expose
the OpenGL 4.6 (Core Profile) feature set, given
&lt;a href=&#34;https://docs.mesa3d.org/drivers/zink.html#features&#34;&gt;enough Vulkan features&lt;/a&gt;! &amp;#x1f389;&lt;/p&gt;
&lt;p&gt;Please note that this doesn&amp;rsquo;t mean that Zink is yet a &lt;em&gt;conformant&lt;/em&gt;
implementation, there&amp;rsquo;s some details left to be ironed out before we can
claim that. In particular, we need to pass the conformance tests, and
submit a conformance report to Khronos. We&amp;rsquo;re not there yet.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m also happy to see that Zink is currently at the top of &lt;a href=&#34;https://mesamatrix.net/&#34;&gt;MesaMatrix&lt;/a&gt;
(together with LLVMpipe, i965 and RadeonSI), reporting a total of 160
OpenGL extensions at the time of writing!&lt;/p&gt;
&lt;p&gt;In theory, that means you can run any OpenGL application you can think of
on top of Zink. Mike is hard at work testing the entire Steam game
library, and things are working pretty well.&lt;/p&gt;
&lt;p&gt;Is this the end of the line for Zink? Are we done now? Not at all!
&amp;#x1f606;&lt;/p&gt;
&lt;h3 id=&#34;opengl-compabibility-profile&#34;&gt;OpenGL compabibility profile
&lt;a class=&#34;header-link&#34; href=&#34;#opengl-compabibility-profile&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;We&amp;rsquo;re still stuck at OpenGL 3.0 for compatibility contexts, mainly due to
lack of testing. There&amp;rsquo;s a lot of features that need to work together in
relatively complicated ways for this to work for us.&lt;/p&gt;
&lt;p&gt;Note that this only matters for applications that rely on legacy OpenGL
features. Modern OpenGL programs gets OpenGL 4.6 support, as mentioned
previously.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t &lt;em&gt;think&lt;/em&gt; this is going to be a big deal to enable, but I haven&amp;rsquo;t
spent time on it.&lt;/p&gt;
&lt;h2 id=&#34;opengl-es-31-support&#34;&gt;OpenGL ES 3.1 support
&lt;a class=&#34;header-link&#34; href=&#34;#opengl-es-31-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Similar to the OpenGL 4.6 support, we&amp;rsquo;re now able to expose the OpenGL ES
3.1 feature set. This is again thanks to a lot of hard work by Mike and
the gang.&lt;/p&gt;
&lt;p&gt;Why not OpenGL ES 3.2? This comes down to the
&lt;a href=&#34;https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_blend_equation_advanced.txt&#34;&gt;&lt;code&gt;GL_KHR_blend_equation_advanced&lt;/code&gt;&lt;/a&gt; feature. Mike
&lt;a href=&#34;https://www.supergoodcode.com/notES/&#34;&gt;blogged about the issue&lt;/a&gt; a while ago.&lt;/p&gt;
&lt;h2 id=&#34;lavapipe-and-continuous-integration&#34;&gt;Lavapipe and continuous integration
&lt;a class=&#34;header-link&#34; href=&#34;#lavapipe-and-continuous-integration&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;To prevent regressions, we&amp;rsquo;ve started testing Zink on the &lt;a href=&#34;https://docs.mesa3d.org/ci/index.html&#34;&gt;Mesa CI&lt;/a&gt;
system for every change. This is made possible thanks to Lavapipe, a Vulkan
software implementation in Mesa that reuse the rasterizer from LLVMpipe.&lt;/p&gt;
&lt;p&gt;This means we can run tests on virtual cloud machines without having to
depend on unreliable hardware. &amp;#x1f916;&lt;/p&gt;
&lt;p&gt;At the time of writing, we&amp;rsquo;re only exposing OpenGL 4.1 on top of Lavapipe,
due to some lacking features. But we have patches in the works to bring
this up to OpenGL 4.5, and OpenGL 4.6 probably won&amp;rsquo;t be far off when that
lands.&lt;/p&gt;
&lt;h2 id=&#34;windows-support&#34;&gt;Windows support
&lt;a class=&#34;header-link&#34; href=&#34;#windows-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Basic support for &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7432&#34;&gt;Zink on Microsoft Windows&lt;/a&gt; has landed.
This isn&amp;rsquo;t particularly useful at the moment, because we need better
window-system integration to get anywhere near reasonable performance.
But it&amp;rsquo;s there.&lt;/p&gt;
&lt;h2 id=&#34;macos-support&#34;&gt;macOS support
&lt;a class=&#34;header-link&#34; href=&#34;#macos-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Thanks to work by &lt;a href=&#34;https://twitter.com/aasimon3d&#34;&gt;Duncan Hopkins&lt;/a&gt; of &lt;a href=&#34;https://www.foundry.com/&#34;&gt;The Foundry&lt;/a&gt;, there&amp;rsquo;s also
some support for macOS. This uses &lt;a href=&#34;https://github.com/KhronosGroup/MoltenVK&#34;&gt;MoltenVK&lt;/a&gt; as the Vulkan implementation,
meaning that we also support the &lt;a href=&#34;https://www.khronos.org/blog/fighting-fragmentation-vulkan-portability-extension-released-implementations-shipping&#34;&gt;Vulkan Portability Extension&lt;/a&gt; to some
degree.&lt;/p&gt;
&lt;p&gt;This support isn&amp;rsquo;t quite as drop-in as on other platforms, because it&amp;rsquo;s
completely lacking window-system integration. But it seems to work for
the use-cases they have at The Foundry, so it&amp;rsquo;s worth mentioning as well.&lt;/p&gt;
&lt;h2 id=&#34;driver-support&#34;&gt;Driver support
&lt;a class=&#34;header-link&#34; href=&#34;#driver-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Beyond this, &lt;a href=&#34;https://www.igalia.com/&#34;&gt;Igalia&lt;/a&gt; has brought up &lt;a href=&#34;https://blogs.igalia.com/itoral/2020/11/05/v3dv-zink/&#34;&gt;Zink on the V3DV&lt;/a&gt; driver, and
I&amp;rsquo;ve heard some whispers that there&amp;rsquo;s some people running Zink on top of
&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/tree/main/src/freedreno/vulkan&#34;&gt;Turnip&lt;/a&gt;, an open-source Vulkan driver for recent Qualcomm Adreno GPUs.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve heard some people have some success getting things running on NVIDIA,
but there&amp;rsquo;s a few obvious problems in the way there due to the lack of
proper DRI support&amp;hellip; Which brings us to:&lt;/p&gt;
&lt;h2 id=&#34;window-system-integration&#34;&gt;Window System Integration
&lt;a class=&#34;header-link&#34; href=&#34;#window-system-integration&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Another awesome new development is that Adam is working on &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7661&#34;&gt;Penny&lt;/a&gt;. So,
what&amp;rsquo;s Penny?&lt;/p&gt;
&lt;p&gt;Penny is another way of bringing up Zink, on systems without DRI support.
It works as a dedicated GLX integration that uses the
&lt;a href=&#34;https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_swapchain.html&#34;&gt;&lt;code&gt;VK_KHR_swapchain&lt;/code&gt;&lt;/a&gt; extension to integrate properly with
the native Vulkan driver&amp;rsquo;s window-system integration instead of Mesa baking
its own.&lt;/p&gt;
&lt;p&gt;This solves a lot of small, nasty issues in the DRI code-path. I&amp;rsquo;ll say
the magic &amp;ldquo;implicit synchronization&amp;rdquo; word, and hope that scares away
anyone wondering what it&amp;rsquo;s about.&lt;/p&gt;
&lt;h2 id=&#34;performance&#34;&gt;Performance
&lt;a class=&#34;header-link&#34; href=&#34;#performance&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A lot more has happened on the performance front as well, again all thanks
to Mike. However, much of this is still out-of-tree, and waiting in Mike&amp;rsquo;s
&lt;a href=&#34;https://gitlab.freedesktop.org/zmike/mesa/-/tree/zink-wip&#34;&gt;zink-wip&lt;/a&gt; branch.&lt;/p&gt;
&lt;p&gt;So instead, I suggest you check out &lt;a href=&#34;https://www.supergoodcode.com/&#34;&gt;Mike&amp;rsquo;s blog&lt;/a&gt; for the latest
performance information (and much more up-to-date info on Zink). There&amp;rsquo;s
been a lot going on, and I&amp;rsquo;m sure there&amp;rsquo;s even more to come!&lt;/p&gt;
&lt;h2 id=&#34;closing-words&#34;&gt;Closing words
&lt;a class=&#34;header-link&#34; href=&#34;#closing-words&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I think this should cover the most interesting bits of development.&lt;/p&gt;
&lt;p&gt;On a personal note, I recently became a dad for the first time, and as a
result I&amp;rsquo;ll be away for a while on paternity leave, starting early this
fall. Luckily, Zink is in good hands with Mike and the rest of the
upstream community taking care of things.&lt;/p&gt;
&lt;p&gt;I would like to again plug &lt;a href=&#34;https://www.supergoodcode.com/&#34;&gt;Mike&amp;rsquo;s blog&lt;/a&gt; as a great source of
Zink-related news, if you&amp;rsquo;re not already following it. He posts a lot
more frequent than I do, and he&amp;rsquo;s also an epic meme master, so it&amp;rsquo;s all
great fun!&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>OpenGL on DirectX: Conformance &amp; upstreaming of the D3D12 driver</title>
      <link>https://kusma.xyz/blog/2021/03/10/d3d12-upstreaming/</link>
      <pubDate>Wed, 10 Mar 2021 20:30:28 +0100</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2021/03/10/d3d12-upstreaming/</guid>
      <description>&lt;p&gt;Over the last year and then so, we at Collabora have been working with
Microsoft on their &lt;a href=&#34;https://devblogs.microsoft.com/directx/in-the-works-opencl-and-opengl-mapping-layers-to-directx&#34;&gt;D3D12 mapping layer&lt;/a&gt;, which I announced in my
&lt;a href=&#34;https://kusma.xyz/blog/2020/03/24/d3d12-mesa-driver/&#34;&gt;previous blog post&lt;/a&gt;. In July, Louis-Francis Ratté-Boulianne &lt;a href=&#34;https://www.collabora.com/news-and-blog/blog/2020/07/09/deep-dive-into-opengl-over-directx-layering/&#34;&gt;wrote an
update&lt;/a&gt; on the status on the Collabora blog, but a lot has
happened since then, so it&amp;rsquo;s time for another update.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s two major things that has happened since then; we have passed the
OpenGL 3.3 conformance tests, and we have upstreamed the code in &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa 3D&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;photoshop-support&#34;&gt;Photoshop support
&lt;a class=&#34;header-link&#34; href=&#34;#photoshop-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;It might not be a big surprise, but one of the motivation for this work was
to be able to run applications like Photoshop on Windows devices without full
OpenGL support.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m happy to report that Microsoft has released their &lt;a href=&#34;https://devblogs.microsoft.com/directx/announcing-the-opencl-and-opengl-compatibility-pack-for-windows-10-on-arm/&#34;&gt;compatibility pack&lt;/a&gt;
that uses our work to provide OpenGL (and OpenCL) support, &lt;a href=&#34;https://feedback.photoshop.com/conversations/photoshop-beta/photoshop-beta-for-windows-arm-is-here/5fb3584b38150f55db64b1e4&#34;&gt;Photoshop can now
run on Windows on ARM CPUs&lt;/a&gt;! This is pretty exciting to see
high-profile applications like that benefit from our work!&lt;/p&gt;
&lt;h2 id=&#34;opengl-33-conformance-test-suite&#34;&gt;OpenGL 3.3 Conformance Test Suite
&lt;a class=&#34;header-link&#34; href=&#34;#opengl-33-conformance-test-suite&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;First of all, I would like to point out that having passed the OpenGL
&lt;abbr title=&#34;Conformance Test Suite&#34;&gt;CTS&lt;/abbr&gt;
 isn&amp;rsquo;t necessarily the same as
being formally conformant. There&amp;rsquo;s some details about how to formally
becoming conformant on layered implementations that are complicated, and I&amp;rsquo;ll
leave the question about formal conformance up to Microsoft and Khronos.&lt;/p&gt;
&lt;p&gt;Instead, I want to talk a bit about &lt;em&gt;passing the OpenGL CTS&lt;/em&gt;.&lt;/p&gt;
&lt;h3 id=&#34;challenges-for-layered-implementations&#34;&gt;Challenges for layered implementations
&lt;a class=&#34;header-link&#34; href=&#34;#challenges-for-layered-implementations&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;A problem we face with layered implementations is that we are subject to a
few more sources of issues, some of which are entirely out of our control.
A normal OpenGL, non-layered, implementation have two primary sources of
issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The OpenGL driver&lt;/li&gt;
&lt;li&gt;The hardware&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Issues with the OpenGL driver itself that leads to tests failing is always
required to be fixed before results are submitted. Issues with the hardware
&lt;em&gt;generally&lt;/em&gt; requires software workarounds, but this is not always feasible,
so Khronos have a system where a vendor can file a &lt;a href=&#34;https://github.com/KhronosGroup/VK-GL-CTS/tree/master/external/openglcts#waivers&#34;&gt;waiver&lt;/a&gt; for a hardware
issue, and if approved they can mark test-failures as waived, and the
appropriate failures will be ignored.&lt;/p&gt;
&lt;p&gt;So far so good.&lt;/p&gt;
&lt;p&gt;But for our layered implementations, our world looks a bit different. We
don&amp;rsquo;t really see the hardware, but instead we see D3D12 and the D3D12
driver. This means our sources of issues are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The OpenGL driver&lt;/li&gt;
&lt;li&gt;The D3D12 run-time&lt;/li&gt;
&lt;li&gt;The D3D12 vendor-driver&lt;/li&gt;
&lt;li&gt;The hardware&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For the OpenGL driver, the story is the same as for a non-layered
implementation, but from there on things start changing.&lt;/p&gt;
&lt;p&gt;Problems in the D3D12 run-time must also be fixed before submitting results.
We work together with Microsoft to get these issues fixed as appropriate.
Such fixes can take a while to trickle all the way into a Windows build and
to end-users, but they will eventually show up.&lt;/p&gt;
&lt;p&gt;But for the D3D12 vendor-driver and below, things gets complicated. First of
all, it&amp;rsquo;s not always possible for us to tell vendor-driver issues and
hardware issues apart. And worse, as these are developed by third party
companies, we have little insight there. We can&amp;rsquo;t affect their priorities,
so it&amp;rsquo;s hard to know when or even if an issue gets resolved.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also not really a good idea to work around such issues, because if they
turn out to be fixable software problems, we don&amp;rsquo;t know when they will be
fixed, so we can&amp;rsquo;t really tell when to disable the work-around. We also don&amp;rsquo;t
know exactly what combination of hardware and software these issues apply to.&lt;/p&gt;
&lt;p&gt;But there&amp;rsquo;s one case where we have full insight, and that&amp;rsquo;s when the D3D12
vendor-driver is &lt;a href=&#34;https://docs.microsoft.com/en-us/windows/win32/direct3darticles/directx-warp&#34;&gt;WARP&lt;/a&gt;, a high-performance software rasterizer. Because that
component is developed by Microsoft, and we have channels to report issues
and even make sure they get resolved!&lt;/p&gt;
&lt;h3 id=&#34;bugs-bugs-bugs&#34;&gt;Bugs, bugs, bugs
&lt;a class=&#34;header-link&#34; href=&#34;#bugs-bugs-bugs&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;When developing something new, there&amp;rsquo;s always going to be bugs. But usually
also when using something existing in a new way. We encountered a lot of bugs
on our way, and here&amp;rsquo;s a quick overview over some of them. This is in no way
exhaustive, and most of our own bugs are not that interesting. So this is
mostly about problems unique to layered implementations.&lt;/p&gt;
&lt;h4 id=&#34;64-bit-shifts&#34;&gt;64-bit shifts
&lt;a class=&#34;header-link&#34; href=&#34;#64-bit-shifts&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;It turned out early on that the DXIL validator in D3D12 had a requirement
when parsing the LLVM bitcode that required that the amounts were always
32-bit values. While this seems fine by itself, LLVM itself requires that
all operands to binops have the same bit-size. This obviously meant that
only 32-bit shifts could pass the validator.&lt;/p&gt;
&lt;p&gt;Microsoft quickly removed this requirement once we figured out what was
going on.&lt;/p&gt;
&lt;h4 id=&#34;aligned-block-compressed-textures&#34;&gt;Aligned block-compressed textures
&lt;a class=&#34;header-link&#34; href=&#34;#aligned-block-compressed-textures&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h4&gt;
&lt;p&gt;In D3D12, one requirement for block-compressed textures is that the
base-level is aligned to ther block-size. This requirement does not apply
to mip-levels, and OpenGL has no such requirement. This isn&amp;rsquo;t technically
speaking a bug, but a documented limitation in DirectX.&lt;/p&gt;
&lt;p&gt;It turns out that this limitation was an artificial historical left-over,
and after a bunch of testing (and fixing of WARP), we got this limitation
lifted. Great :)&lt;/p&gt;
&lt;h3 id=&#34;d3d12-vendor-driver-bugs&#34;&gt;D3D12 vendor-driver bugs
&lt;a class=&#34;header-link&#34; href=&#34;#d3d12-vendor-driver-bugs&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Something that has been much more frustrating is bugs in the
vendor-drivers. The problem here is that even though we have channels to
file bugs, we don&amp;rsquo;t have any influence or even insight into their
prioritization and release schedule.&lt;/p&gt;
&lt;p&gt;I think it suffice to say that there&amp;rsquo;s been several reported bugs to all
vendors we&amp;rsquo;ve actively been running the OpenGL CTS on top of. We believe
fixes are underway for at least some of this, but we can&amp;rsquo;t make any promises
here.&lt;/p&gt;
&lt;h3 id=&#34;current-status&#34;&gt;Current status
&lt;a class=&#34;header-link&#34; href=&#34;#current-status&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Right now, the only configurations we&amp;rsquo;re cleanly passing the OpenGL 3.3
CTS on are WARP (which &lt;a href=&#34;https://www.khronos.org/conformance/adopters/conformant-products/opengl#submission_279&#34;&gt;became conformant on November 24th, 2020&lt;/a&gt;),
and NVIDIA (which &lt;a href=&#34;https://www.khronos.org/conformance/adopters/conformant-products/opengl#submission_288&#34;&gt;became conformant on February 26th, 2021&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Having these multiple independent implementations of DirectX drivers passing
in conjunction with the Mesa/D3D12 layer shows that we are able to implement
GLon12 in a vendor-neutral way, which allowed us to bring the layer to
conformance. Many thanks to Khronos for their assistance through this process.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ve also submitted results on top of an Intel GPU, but that submission
has been halted due to failures, and will as far as I know be updated as
soon as Intel publish updated drivers.&lt;/p&gt;
&lt;p&gt;The conformance tests have been run against our &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/-/commits/msclc-d3d12&#34;&gt;downstream fork&lt;/a&gt;, which is
no longer actively maintained, because:&lt;/p&gt;
&lt;h2 id=&#34;upstreaming&#34;&gt;Upstreaming
&lt;a class=&#34;header-link&#34; href=&#34;#upstreaming&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The D3D12 driver was upstreamed in Mesa in &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7477&#34;&gt;Merge-Request 7477&lt;/a&gt;, and the
OpenCL compiler followed in &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565&#34;&gt;Merge-Request 7565&lt;/a&gt;. There&amp;rsquo;s been &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests?scope=all&amp;amp;state=all&amp;amp;label_name%5B%5D=d3d12&#34;&gt;a lot more
merge-requests&lt;/a&gt; since then, and even more is expected
in the future.&lt;/p&gt;
&lt;p&gt;The process of upstreaming the driver into Mesa3D went relatively smoothly,
but there were quite a lot of regressions that happened quickly after we
upstreamed the code, so to avoid this from becoming a big problem we&amp;rsquo;ve
added the D3D12 driver to Mesa&amp;rsquo;s set of GitLab CI tests. We now build and
test the D3D12 driver on top of WARP on CI, as well as running some basic
sanity-tests for the OpenCL compiler.&lt;/p&gt;
&lt;p&gt;All in all, this seems to work very well right now, and we&amp;rsquo;re looking
forward to the future. Next step, &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7937&#34;&gt;WSL support&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m no longer working full-time on this project, instead I&amp;rsquo;m trying to
take some of the lessons learned and apply them to &lt;a href=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/&#34;&gt;Zink&lt;/a&gt;. I&amp;rsquo;m sure there&amp;rsquo;s
even more room for code-reuse than what we currently have, but it will
probably take some time to figure out.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Introducing OpenCL™ and OpenGL® on DirectX</title>
      <link>https://kusma.xyz/blog/2020/03/24/d3d12-mesa-driver/</link>
      <pubDate>Tue, 24 Mar 2020 13:46:55 +0100</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2020/03/24/d3d12-mesa-driver/</guid>
      <description>&lt;p&gt;For the last few months, we have been working on two exciting new projects at
Collabora, and it&amp;rsquo;s finally time to share some information about them with the
world:&lt;/p&gt;
&lt;p&gt;We are partnering with &lt;a href=&#34;https://devblogs.microsoft.com/directx/in-the-works-opencl-and-opengl-mapping-layers-to-directx&#34;&gt;Microsoft DirectX engineers&lt;/a&gt; to build &lt;a href=&#34;https://www.khronos.org/opencl/&#34;&gt;OpenCL&lt;/a&gt; and &lt;a href=&#34;https://www.opengl.org/&#34;&gt;OpenGL&lt;/a&gt;
mapping layers, in order to bring OpenCL 1.2 and OpenGL 3.3 support to all Windows
and DirectX 12 enabled devices out there!&lt;/p&gt;
&lt;p&gt;This work builds on a lot of previous work. First and foremost, we are
building this by using &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa 3D&lt;/a&gt;, with the Gallium interface as the base
for the OpenGL layer, and NIR as the base for the OpenCL compiler. We are also
using &lt;a href=&#34;http://llvm.org/&#34;&gt;LLVM&lt;/a&gt; and the &lt;a href=&#34;https://github.com/KhronosGroup/SPIRV-LLVM-Translator&#34;&gt;SPIRV-LLVM-Translator&lt;/a&gt; from Khronos as the compiler
front-end.&lt;/p&gt;
&lt;p&gt;In addition, we are taking advantage of Microsoft&amp;rsquo;s experience in creating
their &lt;a href=&#34;https://devblogs.microsoft.com/directx/d3d12-translation-layer-and-d3d11on12-are-now-open-source/&#34;&gt;D3D12 Translation Layer&lt;/a&gt;, as well as our own experience from
developing &lt;a href=&#34;https://www.collabora.com/news-and-blog/blog/2018/10/31/introducing-zink-opengl-implementation-vulkan/&#34;&gt;Zink&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;what-is-mesa-3d&#34;&gt;What is Mesa 3D?
&lt;a class=&#34;header-link&#34; href=&#34;#what-is-mesa-3d&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Mesa 3D is an open source implementation of several graphics technologies,
including OpenCL and OpenGL. The OpenGL implementation in Mesa is robust
and is used as the base for several industry-strength OpenGL drivers from
multiple GPU vendors.&lt;/p&gt;
&lt;p&gt;Among other things, Mesa consists of several API implementations (called
state-trackers) as well as the Gallium low-level driver interface. The
Gallium interface hides a lot of the legacy OpenGL details and translates
OpenGL calls into something that looks more like modern GPU primitives.&lt;/p&gt;
&lt;h2 id=&#34;why-translate-apis&#34;&gt;Why translate APIs?
&lt;a class=&#34;header-link&#34; href=&#34;#why-translate-apis&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Not all Windows-powered devices have consistent support for hardware-accelerated
OpenCL and OpenGL. So in order to improve application compatibility, we are building
a generic solution to the problem. This means that a GPU vendor only has to
implement a D3D12 driver for their hardware in order to support all three
APIs.&lt;/p&gt;
&lt;p&gt;This mapping layer is also expected to serve as a starting point in porting
older OpenCL and OpenGL applications over to D3D12.&lt;/p&gt;
&lt;p&gt;In addition, we believe this is good for the wider open source community. A
lot of the problems we are solving here are shared with other drivers and
translation layers, and we hope that the code will be useful beyond the
use cases listed above.&lt;/p&gt;
&lt;h2 id=&#34;implementation&#34;&gt;Implementation
&lt;a class=&#34;header-link&#34; href=&#34;#implementation&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The work is largely split into three parts: an OpenCL compiler, an OpenCL
runtime, and a Gallium driver that builds and executes command-buffers on
the GPU using the D3D12 API.&lt;/p&gt;
&lt;p&gt;In addition, there is a shared NIR-to-DXIL shader compiler that both
components use. For those not familiar with NIR, it is Mesa&amp;rsquo;s
internal representation for GPU shaders. Similarly, DXIL is Microsoft&amp;rsquo;s
internal representation, which D3D12 drivers will consume and translate
into hardware-specific shaders.&lt;/p&gt;
&lt;h3 id=&#34;opencl-compiler&#34;&gt;OpenCL compiler
&lt;a class=&#34;header-link&#34; href=&#34;#opencl-compiler&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The OpenCL compiler uses LLVM and the SPIRV-LLVM-Translator to generate
&lt;a href=&#34;https://www.khronos.org/spir/&#34;&gt;SPIR-V&lt;/a&gt; representations of OpenCL kernels. These, in turn, are passed to
Mesa&amp;rsquo;s SPIR-V to NIR translator, where some optimizations and semantical
translations are done. Then the NIR representation is finally passed to
NIR-to-DXIL, which produces a DXIL compute shader and the needed metadata so
it can be executed on the GPU by the runtime using D3D12.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a diagram of the complete process, including NIR-to-DXIL, which
will be described below:&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2020/03/24/d3d12-mesa-driver/images/opencl-compiler-overview.svg&#34; alt=&#34;OpenCL Compiler Overview&#34; title=&#34;OpenCL Compiler Overview&#34;&gt;
  &lt;figcaption&gt;OpenCL Compiler Overview&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h3 id=&#34;opencl-runtime&#34;&gt;OpenCL runtime
&lt;a class=&#34;header-link&#34; href=&#34;#opencl-runtime&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;While Mesa provides an OpenCL implementation called Clover, we are not
using it for this project. Instead, we have a new OpenCL runtime that does
a more direct translation to the DirectX 12 API.&lt;/p&gt;
&lt;h3 id=&#34;nir-to-dxil&#34;&gt;NIR-to-DXIL
&lt;a class=&#34;header-link&#34; href=&#34;#nir-to-dxil&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;DXIL is essentially LLVM 3.7 bitcode with some extra metadata and
validation. This was a technical choice that made sense for Microsoft
because all the major driver vendors already used LLVM in their compiler
toolchain. Using an older version of the LLVM bitcode format gives good
compatibility with drivers because the LLVM bitcode format is backwards
compatible.&lt;/p&gt;
&lt;p&gt;Because we depend on a much more recent version of LLVM for the compiler
front-end, we sadly cannot easily use the &lt;a href=&#34;https://github.com/microsoft/DirectXShaderCompiler&#34;&gt;DirectX Shader Compiler&lt;/a&gt; as a
compiler back-end. The DirectX Shader Compiler is effectively a fork of
LLVM 3.7, and we are currently using LLVM 10.0 for the compiler front-end.
Using DirectX Shader Compiler as that would require us to link two different
versions of LLVM into the same binary, which would have led to problems.&lt;/p&gt;
&lt;p&gt;We also cannot easily use LLVM itself to generate the bitcode. While the
LLVM bitcode format is backwards compatible, LLVM itself is not &lt;em&gt;forward
compatible&lt;/em&gt;. This means that newer versions of LLVM cannot produce a bitcode
format that is understood by older versions. This makes sense from LLVM&amp;rsquo;s
point of view because it was never meant as a general interchange format.&lt;/p&gt;
&lt;p&gt;So instead, we have decided to implement our own DXIL emitter. This is
quite a bit harder than it looks because LLVM bitcode goes to great lengths
to try to make the format as dense as possible. For instance, LLVM does not
store its bitcode as a sequence of bytes and words, but rather as variable-width
bitfields in a long sequence of bits.&lt;/p&gt;
&lt;p&gt;There are a lot of tricky details to get right, but in the end we have a
compiler that works.&lt;/p&gt;
&lt;h3 id=&#34;d3d12-gallium-driver&#34;&gt;D3D12 Gallium driver
&lt;a class=&#34;header-link&#34; href=&#34;#d3d12-gallium-driver&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The D3D12 Gallium driver is the last piece of the puzzle. Essentially,
it takes OpenGL commands and, with the help of the NIR to DXIL translator,
turns them into D3D12 command-buffers, which it executes on the GPU using
the D3D12 driver.&lt;/p&gt;
&lt;p&gt;There are a lot of interesting details that makes this tricky as well, but
I will save those details for later.&lt;/p&gt;
&lt;p&gt;But to not leave you empty-handed, here&amp;rsquo;s a screenshot of the Windows
version of the famous glxgears, &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/demos/-/blob/master/src/wgl/wglgears.c&#34;&gt;wglgears&lt;/a&gt;:&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2020/03/24/d3d12-mesa-driver/images/wglgears.png&#34; alt=&#34;wglgears on DirectX12&#34; title=&#34;wglgears on DirectX12&#34;&gt;
  &lt;figcaption&gt;wglgears on DirectX12&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&#34;source-code&#34;&gt;Source code
&lt;a class=&#34;header-link&#34; href=&#34;#source-code&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;In the short term, the source code can be &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/-/tree/msclc-d3d12&#34;&gt;found here&lt;/a&gt;. We
intend on upstreaming this work into the &lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/&#34;&gt;main Mesa repository&lt;/a&gt; shortly, so
it is not a permanent home.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps
&lt;a class=&#34;header-link&#34; href=&#34;#next-steps&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;This is just the announcement, and a whole lot of work is left to be done. We
have something that works in some cases right now, but we are just starting to
scratch the surface.&lt;/p&gt;
&lt;p&gt;First of all, we need to get up to the feature-level that we target. Our
goals at the moment is to pass conformance tests for OpenCL 1.2 and OpenGL
3.3. We have a long way to go, but with some hard work and sweat, I am sure
we will get there.&lt;/p&gt;
&lt;p&gt;Secondly, we need to work on application compatibility. For now we will be
focusing on productivity applications.&lt;/p&gt;
&lt;p&gt;We also want to upstream this in Mesa. This way we can keep up with fixes
and new features in Mesa, and other drivers can benefit from what we are
doing as well.&lt;/p&gt;
&lt;h2 id=&#34;acknowledgments&#34;&gt;Acknowledgments
&lt;a class=&#34;header-link&#34; href=&#34;#acknowledgments&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;It is also important to point out that I am not the only one working on
this. Our team consists of five additional Collabora engineers (Boris Brezillon,
Daniel Stone, Elie Tournier, Gert Wollny, Louis-Francis Ratté-Boulianne)
and two Microsoft DirectX engineers (Bill Kristiansen, Jesse Natalie).&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Zink: Fall Update</title>
      <link>https://kusma.xyz/blog/2019/10/24/zink-fall-update/</link>
      <pubDate>Thu, 24 Oct 2019 15:22:00 +0100</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2019/10/24/zink-fall-update/</guid>
      <description>&lt;p&gt;I recently went to &lt;a href=&#34;https://xdc2019.x.org/&#34;&gt;XDC 2019&lt;/a&gt;, where I gave &lt;a href=&#34;https://xdc2019.x.org/event/5/contributions/329/&#34;&gt;yet another talk&lt;/a&gt;
about Zink. I kinda forgot to write a blog-post about it, so here&amp;rsquo;s me trying
to make up for it&amp;hellip; or something like that. I&amp;rsquo;ll also go into some more
recent developments as well.&lt;/p&gt;
&lt;p&gt;My presentation was somewhat similar to the &lt;a href=&#34;https://kusma.xyz/blog/2019/07/25/summer-and-siggraph/&#34;&gt;talk I did&lt;/a&gt; at
&lt;a href=&#34;https://s2019.siggraph.org/&#34;&gt;SIGGRAPH&lt;/a&gt; this year, but with a bit more emphasis on the technical
aspect, as the XDC audience is more familiar with &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa&lt;/a&gt; internals.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re interested, you can find the slides for the talk &lt;a href=&#34;https://xdc2019.x.org/event/5/contributions/329/attachments/433/687/XDC2019-Zink-slide-deck.pdf&#34;&gt;here&lt;/a&gt;.
The talk goes through the motivation and basic approach. I don&amp;rsquo;t think I need
to go through this again, as I&amp;rsquo;ve &lt;a href=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/#why-implement-opengl-on-top-of-vulkan&#34;&gt;already covered that&lt;/a&gt; before.&lt;/p&gt;
&lt;p&gt;As for the status, Zink currently supports OpenGL 2.1 and OpenGL ES 2.0. And
there&amp;rsquo;s no immediate plans on working on OpenGL 3.0 and OpenGL ES 3.0 until
Zink is upstream.&lt;/p&gt;
&lt;p&gt;Which gets us to the more interesting bit; that I started working on
upstreaming Zink. So let&amp;rsquo;s talk about that for a bit.&lt;/p&gt;
&lt;h2 id=&#34;upstreaming-zink&#34;&gt;Upstreaming Zink
&lt;a class=&#34;header-link&#34; href=&#34;#upstreaming-zink&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So, my current goal is to get Zink upstream in &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa&lt;/a&gt;. The plan outline
in my XDC talk is slightly outdated by now, so here I&amp;rsquo;ll instead say what&amp;rsquo;s
actually happened so far, and what I hope will follow.&lt;/p&gt;
&lt;p&gt;Before I could add the driver itself, I decided to send all changes outside of
the driver as a set of merge-requests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2188&#34;&gt;glBitmap R8 textures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2189&#34;&gt;loader/dri3: do not blit outside old/new buffers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2190&#34;&gt;gallium/u_blitter: set a more sane viewport-state&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2195&#34;&gt;nir: initialize uses_discard to false&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2213&#34;&gt;lowering passes from Zink&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The last one is probably the most interesting one, as it moves a lot of
fixed-function operations into the state-tracker, so individual drivers won&amp;rsquo;t
have to deal with them. Unless they choose to, of course.&lt;/p&gt;
&lt;p&gt;But all of these has already been merged, and there&amp;rsquo;s just one final
merge-request left:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2363&#34;&gt;Introduce Zink: OpenGL on Vulkan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This merge-request adds the driver in its current state. It consists of 163
commits at the time of writing, so it&amp;rsquo;s not a thing of beauty. But new drivers
usually aren&amp;rsquo;t, so I&amp;rsquo;m not too worried.&lt;/p&gt;
&lt;p&gt;When this is merged, Zink will finally be a &amp;ldquo;normal&amp;rdquo; part of Mesa&amp;hellip; Well,
sort of anyway. I don&amp;rsquo;t think we&amp;rsquo;ll enable Zink to be built by default for a
while. But that&amp;rsquo;ll just be a matter of adding &lt;code&gt;zink&lt;/code&gt; to the
&lt;code&gt;-Dgallium-drivers&lt;/code&gt; meson-option.&lt;/p&gt;
&lt;h3 id=&#34;testing-on-ci&#34;&gt;Testing on CI
&lt;a class=&#34;header-link&#34; href=&#34;#testing-on-ci&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The current branch only adds building of Zink to the CI. There&amp;rsquo;s no testing
being done yet. The reasons for this is two-fold:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;We need to get a running environment on CI. Rather of bringing up some
hardware-enabled test-runner, I intend to try to set up
&lt;a href=&#34;https://swiftshader.googlesource.com/SwiftShader&#34;&gt;SwiftShader&lt;/a&gt; as a software rasterizer instead, as that
supports Vulkan 1.1 these days.&lt;/li&gt;
&lt;li&gt;We need some tests to run. Zink currently only supports OpenGL 2.1, and
sadly &lt;a href=&#34;https://github.com/KhronosGroup/VK-GL-CTS&#34;&gt;the conformance test suite&lt;/a&gt; doesn&amp;rsquo;t have &lt;em&gt;any&lt;/em&gt; tests for OpenGL
versions older than 3.0. &lt;a href=&#34;https://piglit.freedesktop.org/&#34;&gt;Piglit&lt;/a&gt; has some, but a full piglit-run
takes significantly more time, which makes it tricky for CI. So right now,
it seems the OpenGL ES 2.0 conformance tests are our best bet. We&amp;rsquo;ll of
course add more test-suites as we add more features.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;So, there&amp;rsquo;s some work to be done here, but it seems like we should be able to
get something working without &lt;em&gt;too much&lt;/em&gt; hassle.&lt;/p&gt;
&lt;h2 id=&#34;next-steps&#34;&gt;Next steps
&lt;a class=&#34;header-link&#34; href=&#34;#next-steps&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;After Zink is upstream, it will be maintained similarly to other Mesa drivers.
Practically speaking, this means that patches are sent to the upstream repo
rather than my fork. It shouldn&amp;rsquo;t make a huge difference for most users.&lt;/p&gt;
&lt;p&gt;The good thing is that if I go away on vacation, or are for some other reason
unavailable, other people can still merge patches, so we&amp;rsquo;d slightly reduce the
&lt;em&gt;technical&lt;/em&gt; bus-factor.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not stopping developing Zink at all, but I have other things going on in
my life that means I might be busy with other things at times. As is the case
for everyone! &amp;#x1f609;&lt;/p&gt;
&lt;p&gt;In fact, I&amp;rsquo;m very excited to start working on OpenGL 3.x and 4.x level
features; we still have a few patches for some 3.x features in some older
branches.&lt;/p&gt;
&lt;p&gt;The future is bright! &amp;#x2600;&amp;#xfe0f;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Zink: Summer Update and SIGGRAPH 2019</title>
      <link>https://kusma.xyz/blog/2019/07/25/summer-and-siggraph/</link>
      <pubDate>Thu, 25 Jul 2019 21:38:36 +0200</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2019/07/25/summer-and-siggraph/</guid>
      <description>&lt;p&gt;Here&amp;rsquo;s an overview of the recent changes in Zink since &lt;a href=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/&#34;&gt;the previous post&lt;/a&gt;,
as well as an exciting announcement!&lt;/p&gt;
&lt;h2 id=&#34;whats-new-in-the-world-of-zink&#34;&gt;What&amp;rsquo;s new in the world of Zink?
&lt;a class=&#34;header-link&#34; href=&#34;#whats-new-in-the-world-of-zink&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;OK, so I haven&amp;rsquo;t been as good at making frequent updates on as I was
hoping, but let&amp;rsquo;s try to make up for it:&lt;/p&gt;
&lt;p&gt;Since last time, there&amp;rsquo;s quite a lot of things that has been resolved:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We now do proper control-flow. This means things like if-statements,
for-loops etc. There might be some control-flow primitives missing
still, but that&amp;rsquo;s because I haven&amp;rsquo;t encountered any use yet.&lt;/li&gt;
&lt;li&gt;Alpha testing has been implemented.&lt;/li&gt;
&lt;li&gt;Client-defined clip-planes has been implemented.&lt;/li&gt;
&lt;li&gt;Support for &lt;code&gt;gl_FrontFacing&lt;/code&gt; has been implemented.&lt;/li&gt;
&lt;li&gt;Lowering of &lt;code&gt;glPointSize()&lt;/code&gt; to &lt;code&gt;gl_PointSize&lt;/code&gt; has been implemented.
This means you can use &lt;code&gt;glPointSize()&lt;/code&gt; to specify sizes instead of
having to write the &lt;code&gt;gl_PointSize&lt;/code&gt;-output from the vertex shader.&lt;/li&gt;
&lt;li&gt;Support for &lt;code&gt;gl_FragDepth&lt;/code&gt; has been implemented.&lt;/li&gt;
&lt;li&gt;Two-sided lighting has been implemented.&lt;/li&gt;
&lt;li&gt;Shadow-samplers has been implemented.&lt;/li&gt;
&lt;li&gt;Support for 8-bit primitive indices has been implemented.&lt;/li&gt;
&lt;li&gt;Occlusion queries has been implemented correctly across command
buffers. This includes the ability to pause / restore queries.&lt;/li&gt;
&lt;li&gt;The compiler has been ported to C.&lt;/li&gt;
&lt;li&gt;The compiler no longer lowers IO, but instead process derefs
directly.&lt;/li&gt;
&lt;li&gt;The compiler now handles booleans properly. It&amp;rsquo;s no longer lowering
them to floats.&lt;/li&gt;
&lt;li&gt;David Airlie has contributed lowering of &lt;code&gt;glShadeModel(GL_FLAT)&lt;/code&gt; to
&lt;code&gt;flat&lt;/code&gt; &lt;a href=&#34;https://www.khronos.org/opengl/wiki/Type_Qualifier_(GLSL)#Interpolation_qualifiers&#34;&gt;interpolation qualifiers&lt;/a&gt;. This still doesn&amp;rsquo;t give us the
right result, because Vulkan &lt;a href=&#34;https://vulkan.lunarg.com/doc/view/1.0.26.0/linux/vkspec.chunked/ch23s01.html&#34;&gt;only supports the first vertex&lt;/a&gt; as
the provoking vertex, and OpenGL &lt;a href=&#34;https://www.khronos.org/registry/OpenGL/specs/gl/glspec45.core.pdf#section.13.4&#34;&gt;defaults to the last one&lt;/a&gt;. To
resolve this in a reasonable way, we need to inject a geometry shader
that reorders the vertices, but this hasn&amp;rsquo;t been implemented yet. You
can read more about this in &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/issues/15&#34;&gt;this ticket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&amp;hellip; and a boat-load of smaller fixes. There&amp;rsquo;s just too many to
mention, really.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition to this, there&amp;rsquo;s been a pretty significant rewrite, changing
the overall design of Zink. The reason for this, was that I made some
early design-mistakes, and after having piled a bit too many features on
top of this, I decided that it would be better to get the fundamentals
right first.&lt;/p&gt;
&lt;p&gt;Sadly, not all features have been brought forward since the rewrite, so
we&amp;rsquo;re currently back to OpenGL 2.1 support. Fixing this is on my list of
things I want to do, but I suspect that cleaning things up and upstreaming
will take presedence over OpenGL 3.0 support.&lt;/p&gt;
&lt;p&gt;And just to give you something neat to look at, here&amp;rsquo;s &lt;a href=&#34;https://www.blender.org/&#34;&gt;Blender&lt;/a&gt; running
using Zink:&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2019/07/25/summer-and-siggraph/images/blender.png&#34; alt=&#34;Blender on Zink&#34; title=&#34;Blender on Zink&#34;&gt;
  &lt;figcaption&gt;Blender on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&#34;khronos-vulkan-bof-at-siggraph-2019&#34;&gt;Khronos Vulkan BoF at SIGGRAPH 2019
&lt;a class=&#34;header-link&#34; href=&#34;#khronos-vulkan-bof-at-siggraph-2019&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://www.khronos.org/&#34;&gt;Khronos&lt;/a&gt; has been nice enough to give me a slot in their Vulkan Sessions
at the &lt;a href=&#34;https://www.khronos.org/events/2019-siggraph&#34;&gt;Khronos BoFs&lt;/a&gt; during &lt;a href=&#34;https://s2019.siggraph.org/&#34;&gt;SIGGRAPH 2019&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt;The talk will be a slightly less tech-heavy introduction to Zink, what it
does and what the future holds. It will focus more on the motivation and
use cases than the underlying technical difficulties compared to my previous
talks.&lt;/p&gt;
&lt;p&gt;So, if you&amp;rsquo;re in the area please drop by! A conference pass is not required
to attend the BoF, as it&amp;rsquo;s not part of the official SIGGRAPH program.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Introducing Zink: OpenGL on Vulkan</title>
      <link>https://kusma.xyz/blog/2018/10/31/introducing-zink/</link>
      <pubDate>Wed, 31 Oct 2018 17:52:21 +0100</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2018/10/31/introducing-zink/</guid>
      <description>&lt;p&gt;For the last month or so, I&amp;rsquo;ve been playing with &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/tree/zink&#34;&gt;a new project&lt;/a&gt;
during my work at &lt;a href=&#34;https://www.collabora.com/&#34;&gt;Collabora&lt;/a&gt;, and as I&amp;rsquo;ve
&lt;a href=&#34;https://www.youtube.com/watch?v=ukrB-Lbl_Jg&#34;&gt;already briefly talked about&lt;/a&gt; at
&lt;a href=&#34;https://xdc2018.x.org/&#34;&gt;XDC 2018&lt;/a&gt;, it&amp;rsquo;s about time to talk about it to a
wider audience.&lt;/p&gt;
&lt;h2 id=&#34;what-is-zink&#34;&gt;What is Zink?
&lt;a class=&#34;header-link&#34; href=&#34;#what-is-zink&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Zink is an &lt;a href=&#34;https://www.opengl.org/&#34;&gt;OpenGL&lt;/a&gt; implementation on top of
&lt;a href=&#34;https://www.khronos.org/vulkan/&#34;&gt;Vulkan&lt;/a&gt;. Or to be a bit more specific, Zink
is a &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa&lt;/a&gt; Gallium driver that leverage the existing
OpenGL implementation in Mesa to provide hardware accelerated OpenGL when only
a Vulkan driver is available.&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/gears.png&#34; alt=&#34;glxgears on Zink&#34; title=&#34;glxgears on Zink&#34;&gt;
  &lt;figcaption&gt;glxgears on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;Here&amp;rsquo;s an overview of how this fits into the Mesa architecture, for those unfamiliar with it:&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/diagram.svg&#34; alt=&#34;Architectural overview&#34; title=&#34;Architectural overview&#34;&gt;
  &lt;figcaption&gt;Architectural overview&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&#34;why-implement-opengl-on-top-of-vulkan&#34;&gt;Why implement OpenGL on top of Vulkan?
&lt;a class=&#34;header-link&#34; href=&#34;#why-implement-opengl-on-top-of-vulkan&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;There&amp;rsquo;s several motivation behind this project, but let&amp;rsquo;s list a few:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Simplify the graphics stack&lt;/li&gt;
&lt;li&gt;Lessen the work-load for future GPU drivers&lt;/li&gt;
&lt;li&gt;Enable more integration&lt;/li&gt;
&lt;li&gt;Support application porting to Vulkan&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I&amp;rsquo;ll go through each of these points in more detail below.&lt;/p&gt;
&lt;p&gt;But there&amp;rsquo;s another, less concrete reason; &lt;strong&gt;someone&lt;/strong&gt; had to do this. I was
waiting for someone else to do it before me, but nobody seemed to actually go
ahead. At least as long as you don&amp;rsquo;t count solutions who only implement some
variation of OpenGL ES (which in my opinion doesn&amp;rsquo;t solve the problem; we need
&lt;strong&gt;full&lt;/strong&gt; OpenGL for this to be &lt;em&gt;really&lt;/em&gt; valuable).&lt;/p&gt;
&lt;h3 id=&#34;1-simplifying-the-graphics-stack&#34;&gt;1. Simplifying the graphics stack
&lt;a class=&#34;header-link&#34; href=&#34;#1-simplifying-the-graphics-stack&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;One problem is that OpenGL is a &lt;strong&gt;big&lt;/strong&gt; API with a &lt;strong&gt;lot&lt;/strong&gt; of legacy stuff
that has accumulated since its initial release in 1992. OpenGL is
well-established as a requirement for applications and desktop compositors.&lt;/p&gt;
&lt;p&gt;But since the very successful release of Vulkan, we now have two main-stream
APIs for essentially the same hardware functionality.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not looking like neither OpenGL nor Vulkan is going away, and the
software-world is now hard at work implementing Vulkan support everywhere,
which is &lt;strong&gt;great&lt;/strong&gt;. But &lt;em&gt;this leads to complexity&lt;/em&gt;. So my hope is that we can
simplify things here, by only require things like desktop compositors to
support &lt;em&gt;one&lt;/em&gt; API down the road. We&amp;rsquo;re not there yet, though; not all hardware
has a Vulkan-driver, and some older hardware can&amp;rsquo;t even support it. But at
some point in the not too far future, we&amp;rsquo;ll probably get there.&lt;/p&gt;
&lt;p&gt;This means there might be a future where OpenGL&amp;rsquo;s role &lt;em&gt;could&lt;/em&gt; purely be one
of legacy application compatibility. Perhaps Zink can help making that future
a bit closer?&lt;/p&gt;
&lt;h3 id=&#34;2-lessen-the-work-load-for-future-gpu-drivers&#34;&gt;2. Lessen the work-load for future GPU drivers
&lt;a class=&#34;header-link&#34; href=&#34;#2-lessen-the-work-load-for-future-gpu-drivers&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The amount of drivers to maintain is only growing, and we want the amount of
code to maintain for legacy hardware to be as little as possible. And since
Vulkan is a requirement already, maybe we can get &lt;em&gt;good enough&lt;/em&gt; performance
through emulation?&lt;/p&gt;
&lt;p&gt;Besides, in the Open Source world, there&amp;rsquo;s even new drivers being written for
old hardware, and if the hardware is capable of supporting Vulkan, it &lt;em&gt;could&lt;/em&gt;
make sense to only support Vulkan &amp;ldquo;natively&amp;rdquo;, and do OpenGL through Zink.&lt;/p&gt;
&lt;p&gt;It all comes down to the economics here. There aren&amp;rsquo;t infinite programmers
out there that can maintain every GPU driver forever. But if we can make it
easier and cheaper, maybe we can get better driver-support in the long run?&lt;/p&gt;
&lt;h3 id=&#34;3-enable-more-integration&#34;&gt;3. Enable more integration
&lt;a class=&#34;header-link&#34; href=&#34;#3-enable-more-integration&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Because Zink is implemented as a Gallium driver in Mesa, there&amp;rsquo;s some
interesting side-benefits that comes &amp;ldquo;for free&amp;rdquo;. For instance, projects like
Gallium Nine or Clover could &lt;em&gt;in theory&lt;/em&gt; work on top of the i965 Vulkan driver
through Zink. Please note that this hasn&amp;rsquo;t really been tested, though.&lt;/p&gt;
&lt;p&gt;It should also be possible to run Zink on top of a closed-source Vulkan driver,
and still get proper window system integration. Not that I promote the idea of
using a closed-source Vulkan driver.&lt;/p&gt;
&lt;h3 id=&#34;4-support-application-porting-to-vulkan&#34;&gt;4. Support application porting to Vulkan
&lt;a class=&#34;header-link&#34; href=&#34;#4-support-application-porting-to-vulkan&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;This might sound a bit strange, but it might be possible to extend Zink in
ways where it can act as a cooperation-layer between OpenGL and Vulkan code in
the same application.&lt;/p&gt;
&lt;p&gt;The thing is, big CAD applications etc won&amp;rsquo;t realistically rewrite all of
their rendering-code to Vulkan in a wave of a hand. So if they can for instance
prototype some Vulkan-code inside an OpenGL application, it might be easier to
figure out if Vulkan is worth it or not for them.&lt;/p&gt;
&lt;h2 id=&#34;what-does-zink-require&#34;&gt;What does Zink require?
&lt;a class=&#34;header-link&#34; href=&#34;#what-does-zink-require&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Zink currently requires a Vulkan 1.0 implementation, with the following
extensions (there&amp;rsquo;s a few more, due to extensions requiring other extensions,
but I&amp;rsquo;ve decided to omit those for simplicity):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VK_KHR_maintenance1&lt;/code&gt;: This is required for the viewport flipping. It&amp;rsquo;s also
possible to do without this extension, and we have some experimental
patches for that. I would certainly love to require as few extensions as
possible.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VK_KHR_external_memory_fd&lt;/code&gt;: This is required as a way of getting the
rendered result on screen. This isn&amp;rsquo;t &lt;em&gt;technically&lt;/em&gt; a hard requirement, as
we also have a copy-based approach, but that&amp;rsquo;s almost unusably slow. And
I&amp;rsquo;m not sure if we&amp;rsquo;ll bother keeping it around.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Zink has to my knowledge &lt;em&gt;only&lt;/em&gt; been tested on Linux. I don&amp;rsquo;t think there&amp;rsquo;s
any major reasons why it wouldn&amp;rsquo;t run on any other operating system supporting
Vulkan, apart from the fact that some window-system integration code might
have to be written.&lt;/p&gt;
&lt;h2 id=&#34;what-does-zink-support&#34;&gt;What does Zink support?
&lt;a class=&#34;header-link&#34; href=&#34;#what-does-zink-support&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Right now, it&amp;rsquo;s not super-impressive: we implement &lt;strong&gt;OpenGL 2.1&lt;/strong&gt;, and &lt;strong&gt;OpenGL
ES 1.1 and 2.0&lt;/strong&gt; plus some extensions. Please note that the list of extensions
might depend on the Vulkan implementation backing this, as we forward
capabilities from that.&lt;/p&gt;
&lt;p&gt;The list of extensions is too long to include here in a sane way, but &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/snippets/518/raw&#34;&gt;here&amp;rsquo;s
a link&lt;/a&gt; to the
output of glxinfo as of today on top of i965.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s some screenshots of applications and games we&amp;rsquo;ve tested that renders
more or less correctly:&lt;/p&gt;
&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/openarena.png&#34; alt=&#34;OpenArena on Zink&#34; title=&#34;OpenArena on Zink&#34;&gt;
  &lt;figcaption&gt;OpenArena on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/weston.png&#34; alt=&#34;Weston on Zink&#34; title=&#34;Weston on Zink&#34;&gt;
  &lt;figcaption&gt;Weston on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/quake3.png&#34; alt=&#34;Quake 3 on Zink&#34; title=&#34;Quake 3 on Zink&#34;&gt;
  &lt;figcaption&gt;Quake 3 on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;figure&gt;
  &lt;img src=&#34;https://kusma.xyz/blog/2018/10/31/introducing-zink/images/etr.png&#34; alt=&#34;Extreme Tux Racer on Zink&#34; title=&#34;Extreme Tux Racer on Zink&#34;&gt;
  &lt;figcaption&gt;Extreme Tux Racer on Zink&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&#34;what-doesnt-work&#34;&gt;What doesn&amp;rsquo;t work?
&lt;a class=&#34;header-link&#34; href=&#34;#what-doesnt-work&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Yeah, so when I say OpenGL 2.1, I&amp;rsquo;m ignoring some features that we simply do
not support yet:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;glPointSize()&lt;/code&gt; is currently not supported. Writing to &lt;code&gt;gl_PointSize&lt;/code&gt; from
the vertex shader &lt;em&gt;does&lt;/em&gt; work. We need to write some code to plumb this
through the vertex shader to make it work.&lt;/li&gt;
&lt;li&gt;Texture borders are currently always black. This will also need some
emulation code, due to Vulkan&amp;rsquo;s lack of arbitrary border-color support.
Since a lot of hardware actually support this, perhaps we can introduce some
extension to add it back to the API?&lt;/li&gt;
&lt;li&gt;No control-flow is supported in the shaders at the moment. This is just
because of lacking implementation for those opcodes. It&amp;rsquo;s coming.&lt;/li&gt;
&lt;li&gt;No &lt;code&gt;GL_ALPHA_TEST&lt;/code&gt; support yet. There&amp;rsquo;s some support code in NIR for this,
we just need to start using it. This will depend on control-flow, though.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;glShadeModel(GL_FLAT)&lt;/code&gt; isn&amp;rsquo;t supported yet. This isn&amp;rsquo;t particularly hard or
anything, but we currently emit the SPIR-V before knowing the drawing-state.
We should probably change this. Another alternative is to patch in a
flat-decoration on the fly.&lt;/li&gt;
&lt;li&gt;Different settings for &lt;code&gt;glPolygonMode(GL_FRONT, ...)&lt;/code&gt; and
&lt;code&gt;glPolygonMode(GL_BACK, ...)&lt;/code&gt;. This one is &lt;em&gt;tricky&lt;/em&gt; to do correct, at least
if we want to support newer shader-stages like geometry and tessellation at
the same time. It&amp;rsquo;s also &lt;em&gt;hard&lt;/em&gt; to do performant, even without these
shader-stages, as we need to draw these primitives in the same order as they
were specified but with different primitive types. Luckily, Vulkan can do
pretty fast geometry submission, so there might be some hope for some
compromise-solution, at least. It might also be possible to combine
stream-out and a geometry-shader or something here if we really end up
caring about this use-case.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And most importantly, we are &lt;em&gt;not&lt;/em&gt; a conformant OpenGL implementation. I&amp;rsquo;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.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also worth noting that at this point, we tend to care more about
applications than theoretical use-cases and synthetic tests. That of course
doesn&amp;rsquo;t mean we do not care about correctness at all, it just means that we
have plenty of work ahead of us, and the work that gets us most real-world
benefit tends to take precedence. If you think otherwise, please send some
patches! &amp;#x1f609;&lt;/p&gt;
&lt;h2 id=&#34;whats-the-performance-hit-compared-to-a-native-opengl-driver&#34;&gt;What&amp;rsquo;s the performance-hit compared to a &amp;ldquo;native&amp;rdquo; OpenGL driver?
&lt;a class=&#34;header-link&#34; href=&#34;#whats-the-performance-hit-compared-to-a-native-opengl-driver&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;One thing should be very clear; a &amp;ldquo;native&amp;rdquo; OpenGL driver will always have a
better performance-potential, simply because anything clever we do, they can
do as well. So I don&amp;rsquo;t expect to beat any serious OpenGL drivers on
performance any time soon.&lt;/p&gt;
&lt;p&gt;But the performance loss is already kinda less than I feared, especially since
we haven&amp;rsquo;t done anything particularly fancy with performance yet.&lt;/p&gt;
&lt;p&gt;I don&amp;rsquo;t yet have any systematic benchmark-numbers, and we currently have some
kinda stupid bottlenecks that should be very possible to solve. So I&amp;rsquo;m
reluctant to spend much time on benchmarking until those are fixed. Let&amp;rsquo;s just
say that I can play Quake 3 at tolerable frame rates right now ;)&lt;/p&gt;
&lt;p&gt;But OK, I will say this: I currently get around 475 FPS on glxgears on top of
Zink on my system. The i965 driver gives me around 1750 FPS. &lt;em&gt;Don&amp;rsquo;t read too
much into those results, though&lt;/em&gt;; glxgears isn&amp;rsquo;t a good benchmark. But for
that particular workload, we&amp;rsquo;re about a quarter of the performance. As I said,
I don&amp;rsquo;t think glxgears is a very good benchmark, but it&amp;rsquo;s the only thing
&lt;em&gt;somewhat&lt;/em&gt; reproducible that I&amp;rsquo;ve run so far, so it&amp;rsquo;s the only numbers I have.
I&amp;rsquo;ll certainly be doing some proper benchmarking in the future.&lt;/p&gt;
&lt;p&gt;In the end, I suspect that the pipeline-caching is going to be the big hot-spot.
There&amp;rsquo;s a lot of state to hash, and finally compare once a hit has been found.
We have some decent ideas on how to speed it up, but there&amp;rsquo;s probably going
to be some point where we simply can&amp;rsquo;t get it any better.&lt;/p&gt;
&lt;p&gt;But even then, perhaps we could introduce some OpenGL extension that allows an
application to &amp;ldquo;freeze&amp;rdquo; the render-state into some objects, similar to &lt;a href=&#34;https://www.khronos.org/opengl/wiki/Vertex_Specification#Vertex_Array_Object&#34;&gt;Vertex
Array Objects&lt;/a&gt;,
and that way completely bypass this problem for applications willing to do a
bit of support-code? The future will tell&amp;hellip;&lt;/p&gt;
&lt;p&gt;All in all, I&amp;rsquo;m not too worried about this yet. We&amp;rsquo;re still early in the
project, and I don&amp;rsquo;t see any major, impenetrable walls.&lt;/p&gt;
&lt;h2 id=&#34;how-to-use-zink&#34;&gt;How to use Zink
&lt;a class=&#34;header-link&#34; href=&#34;#how-to-use-zink&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Zink is only available as source code at the moment. No distro-packages exits
yet.&lt;/p&gt;
&lt;h3 id=&#34;requirements&#34;&gt;Requirements
&lt;a class=&#34;header-link&#34; href=&#34;#requirements&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;In order to build Zink, you need the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;Build dependencies to compile Mesa&lt;/li&gt;
&lt;li&gt;Vulkan headers and libraries&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://mesonbuild.com/&#34;&gt;Meson&lt;/a&gt; and &lt;a href=&#34;https://ninja-build.org/&#34;&gt;Ninja&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;building&#34;&gt;Building
&lt;a class=&#34;header-link&#34; href=&#34;#building&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The code currently lives in &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa/tree/zink&#34;&gt;the zink-branch&lt;/a&gt;
in my &lt;a href=&#34;https://gitlab.freedesktop.org/kusma/mesa&#34;&gt;Mesa fork&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The first thing you have to do, is to clone the repository and build the
&lt;code&gt;zink&lt;/code&gt;-branch. Even though Mesa has an autotools build-system, Zink only
supports the Meson build-system. Remember to enable the &lt;code&gt;zink&lt;/code&gt; gallium-driver
(&lt;code&gt;-Dgallium-drivers=zink&lt;/code&gt;) when configuring the build.&lt;/p&gt;
&lt;p&gt;Install the driver somewhere appropriate, and use the &lt;code&gt;$MESA_LOADER_DRIVER_OVERRIDE&lt;/code&gt;
environment variable to force the &lt;code&gt;zink&lt;/code&gt;-driver. From here you should be able
to run many OpenGL applications using Zink.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a rough recipe:&lt;/p&gt;

&lt;pre style=&#34;border-radius: 3px; background-color: #111; color: #999; padding: 0.25rem; overflow-x: auto;&#34;&gt;
$ &lt;span style=&#34;color: #fff;&#34;&gt;git clone https://gitlab.freedesktop.org/kusma/mesa.git mesa-zink&lt;/span&gt;
Cloning into &#39;mesa-zink&#39;...
&lt;span style=&#34;color: #555;&#34;&gt;...&lt;/span&gt;
Checking out files: 100% (5982/5982), done.
$ &lt;span style=&#34;color: #fff;&#34;&gt;cd mesa-zink&lt;/span&gt;
$ &lt;span style=&#34;color: #fff;&#34;&gt;git checkout zink&lt;/span&gt;
Branch &#39;zink&#39; set up to track remote branch &#39;zink&#39; from &#39;origin&#39;.
Switched to a new branch &#39;zink&#39;
$ &lt;span style=&#34;color: #fff;&#34;&gt;meson --prefix=/tmp/zink -Dgallium-drivers=zink build-zink&lt;/span&gt;
The Meson build system
&lt;span style=&#34;color: #555;&#34;&gt;...&lt;/span&gt;
Found ninja-X.Y.Z at /usr/bin/ninja
$ &lt;span style=&#34;color: #fff;&#34;&gt;ninja -C build-zink install&lt;/span&gt;
ninja: Entering directory &amp;#x60;build-zink&#39;
&lt;span style=&#34;color: #555;&#34;&gt;...&lt;/span&gt;
installing /home/kusma/temp/mesa-zink/build-zink/src/gallium/targets/dri/libgallium_dri.so to /tmp/zink/lib64/dri/zink_dri.so
$ &lt;span style=&#34;color: #fff;&#34;&gt;LIBGL_DRIVERS_PATH=/tmp/zink/lib64/dri/ MESA_LOADER_DRIVER_OVERRIDE=zink glxgears -info&lt;/span&gt;
GL_RENDERER   = zink (Intel(R) UHD Graphics 620 (Kabylake GT2))
GL_VERSION    = 2.1 Mesa 18.3.0-devel (git-395b12c2d7)
GL_VENDOR     = Collabora Ltd
GL_EXTENSIONS = GL_ARB_multisample GL_EXT_abgr &lt;span style=&#34;color: #555;&#34;&gt;...&lt;/span&gt;
&lt;/pre&gt;


&lt;h3 id=&#34;submitting-patches&#34;&gt;Submitting patches
&lt;a class=&#34;header-link&#34; href=&#34;#submitting-patches&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;Currently, the development happens on &lt;code&gt;#dri-devel&lt;/code&gt; on &lt;a href=&#34;https://freenode.net/&#34;&gt;Freenode&lt;/a&gt;.
Ping me (my handle is &lt;code&gt;kusma&lt;/code&gt;) with a link your branch, and I&amp;rsquo;ll take a look.&lt;/p&gt;
&lt;h2 id=&#34;where-do-we-go-from-here&#34;&gt;Where do we go from here?
&lt;a class=&#34;header-link&#34; href=&#34;#where-do-we-go-from-here&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Well, I think &amp;ldquo;forwards&amp;rdquo; is the only way to move &amp;#x1f609;. I&amp;rsquo;m currently working
1-2 days per week on this at Collabora, so things will keep moving forward on
my end. In addition, Dave Airlie seems to have a high momentum at the moment
also. He has a work-in-progress branch that hints at GL 3.3 being around the
corner!&lt;/p&gt;
&lt;p&gt;I also don&amp;rsquo;t think there&amp;rsquo;s any fundamental reason why we shouldn&amp;rsquo;t be able to
get to full OpenGL 4.6 eventually.&lt;/p&gt;
&lt;p&gt;Besides the features, I also want to try to get this upstream in Mesa in some
not-too-distant future. I think we&amp;rsquo;re already beyond the point where Zink is
useful.&lt;/p&gt;
&lt;p&gt;I also would like to point out that &lt;a href=&#34;https://airlied.blogspot.com/&#34;&gt;David Airlie&lt;/a&gt;
of &lt;a href=&#34;https://www.redhat.com/&#34;&gt;RedHat&lt;/a&gt; has contributed a &lt;em&gt;lot&lt;/em&gt; of great patches,
greatly advancing Zink from what it was before his help! At this point, he has
implemented at least as many features as I have. So this is very much his
accomplishment as well.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Working at Collabora</title>
      <link>https://kusma.xyz/blog/2018/07/31/working-at-collabora/</link>
      <pubDate>Tue, 31 Jul 2018 12:01:00 +0200</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2018/07/31/working-at-collabora/</guid>
      <description>&lt;p&gt;In the &lt;a href=&#34;https://kusma.xyz/blog/2018/05/14/fuse-open/&#34;&gt;Fuse Open&lt;/a&gt; post,
I mentioned that I would no longer be working at Fuse. I didn&amp;rsquo;t mention what I
was going to do next, and now that it&amp;rsquo;s been a while I guess it&amp;rsquo;s time to let
the cat out of the bag: I&amp;rsquo;ve started working at
&lt;a href=&#34;https://www.collabora.com/&#34;&gt;Collabora&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been working here for 1.5 months now, and I&amp;rsquo;m really enjoying it so far!
I get to work on things I really enjoy, and I get a lot of freedom!
&amp;#x1f604; &amp;#x1f389;&lt;/p&gt;
&lt;h2 id=&#34;what-is-collabora&#34;&gt;What is Collabora
&lt;a class=&#34;header-link&#34; href=&#34;#what-is-collabora&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Collabora is an Open Source consultancy, specializing in a few industries. Most
of what Collabora does is centered around things like Linux, automotive,
embedded systems, and multimedia. You can read more about Collabora
&lt;a href=&#34;https://www.collabora.com/about-us/who-we-are/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The word &amp;ldquo;consultant&amp;rdquo; brings out quite a lot of stereotypes in my mind.
Luckily, we&amp;rsquo;re not that kind of consultants. I haven&amp;rsquo;t worn a tie a single
day at work yet!&lt;/p&gt;
&lt;p&gt;When I got approached by Collabora, I was immediately attracted by the
prospect of working more or less exclusively on Open Source Software.
Collabora has &amp;ldquo;Open First&amp;rdquo; as their motto, and this fits my ideology very
well! And trust me, Collabora really means it! &amp;#x1f600;&lt;/p&gt;
&lt;h2 id=&#34;what-will-i-be-doing&#34;&gt;What will I be doing?
&lt;a class=&#34;header-link&#34; href=&#34;#what-will-i-be-doing&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m hired as a Principal Engineer on the Graphics team. This obviously means
I&amp;rsquo;ll be working on graphics technology.&lt;/p&gt;
&lt;p&gt;So far, I&amp;rsquo;ve been working a bit on some R&amp;amp;D tasks about Vulkan, but mostly on
&lt;a href=&#34;https://virgil3d.github.io/&#34;&gt;Virgil 3D (&amp;ldquo;VirGL&amp;rdquo;)&lt;/a&gt;. If you don&amp;rsquo;t know what
VirGL is, the very short explanation is that it&amp;rsquo;s GPU virtualization for
virtual machines. I&amp;rsquo;ve been working on adding/fixing support for OpenGL 4.3 as
well as OpenGL ES 3.1. The work isn&amp;rsquo;t complete but it&amp;rsquo;s getting close, and
patches are being upstreamed as I write this.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m also working on &lt;a href=&#34;https://www.mesa3d.org/&#34;&gt;Mesa&lt;/a&gt;. Currently mostly through
Virgil, probably through other projects in the future as well. Apart from
that, things depend heavily on customer needs.&lt;/p&gt;
&lt;h2 id=&#34;working-remotely&#34;&gt;Working Remotely
&lt;a class=&#34;header-link&#34; href=&#34;#working-remotely&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;A big change from my previous jobs, is that I now work from home Instead of a
shared office with my coworkers. This is because Collabora doesn&amp;rsquo;t have an
Oslo office, as it&amp;rsquo;s largely a distributed team.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been doing this for around 1.5 months already, and it works a lot better
than I feared. In fact, this was one of my biggest worries with taking this
job, but so far it hasn&amp;rsquo;t been a problem at all! &amp;#x1f389;&lt;/p&gt;
&lt;p&gt;But who knows, maybe all work and no play will make Jack a dull boy in the end?
&amp;#x1f52a;&lt;/p&gt;
&lt;p&gt;Jokes aside, if this turns out to be a problem in the long term, I&amp;rsquo;ll look
into getting a desk at some co-working space. There&amp;rsquo;s tons of them nearby.&lt;/p&gt;
&lt;h2 id=&#34;working-as-a-contractor&#34;&gt;Working as a Contractor
&lt;a class=&#34;header-link&#34; href=&#34;#working-as-a-contractor&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Another effect of Collabora not having an Oslo office means that I have to
formally work as a contractor. This is mostly a formality (Collabora seems to
treat people the same regardless if they are normal employees or contractors),
but there&amp;rsquo;s quite a lot of legal challenges on my end due to this.&lt;/p&gt;
&lt;p&gt;I would definitely have preferred normal employment, but I guess I don&amp;rsquo;t get
to choose all the details ;)&lt;/p&gt;
&lt;h2 id=&#34;closing&#34;&gt;Closing
&lt;a class=&#34;header-link&#34; href=&#34;#closing&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;So, this is what I&amp;rsquo;m doing now. I&amp;rsquo;m happy with my choice and I have a lot of
really great colleagues! I also get to work with a huge community, and as
part of that I&amp;rsquo;ll be going to more conferences going forward (next up:
&lt;a href=&#34;https://xdc2018.x.org/&#34;&gt;XDC&lt;/a&gt;)!&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Fuse Open</title>
      <link>https://kusma.xyz/blog/2018/05/14/fuse-open/</link>
      <pubDate>Mon, 14 May 2018 22:52:00 +0200</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2018/05/14/fuse-open/</guid>
      <description>&lt;p&gt;OK, so &lt;a href=&#34;https://blog.fusetools.com/announcing-fuse-open-free-ea289bbf32d0&#34;&gt;the announcement&lt;/a&gt;
that I hinted at in &lt;a href=&#34;https://kusma.xyz/blog/2018/05/13/hello/&#34;&gt;my previous post&lt;/a&gt;
is now public, so I can finally talk about this.&lt;/p&gt;
&lt;h2 id=&#34;what&#34;&gt;What
&lt;a class=&#34;header-link&#34; href=&#34;#what&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;I&amp;rsquo;m very happy to tell you that &lt;a href=&#34;https://fuse-open.github.io&#34;&gt;Fuse&lt;/a&gt; is now
fully open source software!&lt;/em&gt; &amp;#x1f389;&lt;/p&gt;
&lt;p&gt;For those who don&amp;rsquo;t know what I&amp;rsquo;m talking about: Fuse is a mobile app
development environment, developed by Fusetools. You can read more about it
&lt;a href=&#34;https://fuse-open.github.io/features/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This work represents more than 3.5 years of my life (and of course lots of
other people, but you know, this is &lt;em&gt;my&lt;/em&gt; blog &amp;#x1f60f;), and I&amp;rsquo;ve been pushing
hard inside the company my whole time there to open source it. We already
open sourced &lt;a href=&#34;https://github.com/fuse-open/fuselibs&#34;&gt;fuselibs&lt;/a&gt; about a year
ago, and as far as I&amp;rsquo;m concerned, that was a success.&lt;/p&gt;
&lt;p&gt;Now, there&amp;rsquo;s some sad news that comes with this as well. Fusetools will no
longer be working on Fuse. That&amp;rsquo;s now up to the community. The company is
switching focus to an &lt;a href=&#34;https://www.fusetools.com/apps&#34;&gt;app-as-a-service&lt;/a&gt;
business model.&lt;/p&gt;
&lt;p&gt;This also marks the end of my time at Fuse. I&amp;rsquo;ll wrap up my end of Fuse 1.9
and then take a few weeks of vacation, before I start my next job. What I&amp;rsquo;ll
be doing next is very exciting, but deserve its own post.&lt;/p&gt;
&lt;h2 id=&#34;why&#34;&gt;Why
&lt;a class=&#34;header-link&#34; href=&#34;#why&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;There&amp;rsquo;s many reasons why we ended up where we are now. I&amp;rsquo;ll try to explain
what I believe are the major reasons below.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Please note that the opinions stated here are my personal ones, and not
those of my employer. I&amp;rsquo;m writing this article to shed some light on what
I believe is the reasons we&amp;rsquo;ve come to where we are, not to blame anyone,
but to try to learn from our mistakes.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;First and foremost, we failed to build a viable business on selling
development tools. Developing a full platform, comprising of compilers,
standard libraries, editor-plugins, debugging tools, IDEs etc is a big
undertaking, and cost a lot of money, while the market is full of free
tools that does a pretty decent job. To convince someone to pay for something
they can get for free somewhere else, you need to be a &lt;em&gt;lot&lt;/em&gt; better.&lt;/p&gt;
&lt;p&gt;Secondly, we&amp;rsquo;ve been taking a lot of time-consuming detours. We&amp;rsquo;ve started
projects that, in my opinion, should never have been started. We should have
kept our main focus enabling our users to do more, not to do more for them.&lt;/p&gt;
&lt;p&gt;Third, I sadly think we failed to be &lt;em&gt;as good as we needed to&lt;/em&gt;. This one is a
bit touchy, but I&amp;rsquo;ll try to explain. I&amp;rsquo;m not saying I think we did bad work,
far from it. But to make up for the first point, we would have needed to be
vastly better than the competition. But due to the second point, the
competition largely caught up to us.&lt;/p&gt;
&lt;h2 id=&#34;what-could-we-have-done-differently&#34;&gt;What could we have done differently?
&lt;a class=&#34;header-link&#34; href=&#34;#what-could-we-have-done-differently&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;I think the problem we set out to solve was a hard one, so the short answer
is &amp;ldquo;beats me&amp;rdquo;&amp;hellip; &amp;#x1f615;&lt;/p&gt;
&lt;p&gt;However, I believe that our chances would at least have been &lt;em&gt;better&lt;/em&gt; if we
open sourced the platform &lt;em&gt;from the beginning&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;The reason is that &lt;em&gt;we might not have had to&lt;/em&gt; build the platform all by
ourselves. If we would for instance made our package-manager usable for
shipping 3rd-party packages, we could have leveraged the community more at
more of the high-level work. Our company could have focused on functionality
that enabled the community. Instead we ended up doing a lot of very
high-level work that didn&amp;rsquo;t end up benefiting a lot of users.&lt;/p&gt;
&lt;p&gt;I also believe that if we made the Uno compiler a stand-alone C# to C++
transpiler, and did all the graphics functionality and app-bootstrapping
as library functionality instead of compiler-internals, the compiler might
have been useful for other C#-oriented projects, and we could have aligned
closer with the C# community than we ended up. Instead, we treated Uno as
an internal tool that app-developers weren&amp;rsquo;t really supposed to care about.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m far from sure that those changes together would have been enough,
though. This was a hard problem to solve, and that was exactly why I was
interested in this gig to begin with.&lt;/p&gt;
&lt;h2 id=&#34;the-future&#34;&gt;The future
&lt;a class=&#34;header-link&#34; href=&#34;#the-future&#34;&gt;&lt;i class=&#34;fa fa-link&#34; aria-hidden=&#34;true&#34;&gt;&lt;/i&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Well, I hope that the future of Fuse is bright, but different than before.
Thanks to Fusetools releasing all of the code, I do believe that the project
will live on, with a better future that isn&amp;rsquo;t meddled with short-term wins
that hurt in the long run.&lt;/p&gt;
&lt;p&gt;I plan on continuing at least some of my work on Uno / Fuselibs, and I&amp;rsquo;m not
the only one. In addition, there&amp;rsquo;s also still some commercial interest for
Fuse, just not from Fusetools. Anything in this area is still not announced,
but expect to hear more.&lt;/p&gt;
&lt;p&gt;I still believe the technology is good, and hopefully now that it&amp;rsquo;s finally
all out there for anyone to play with, we can get some great work done! Fuse
has a unique tech-stack, with a declarative UI engine that is built around
preview / live-refresh, and a comprehensive toolkit. The turn-around time for
experimenting is still miles beyond the competition. &amp;#x2728;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Hello World!</title>
      <link>https://kusma.xyz/blog/2018/05/13/hello/</link>
      <pubDate>Sun, 13 May 2018 11:36:58 +0200</pubDate>
      <author>kusmabite@gmail.com (Erik Faye-Lund)</author>
      <guid>https://kusma.xyz/blog/2018/05/13/hello/</guid>
      <description>&lt;p&gt;Welcome to my new blog, where I&amp;rsquo;ll be writing about my open source development.&lt;/p&gt;
&lt;p&gt;This is just a short announcement post, to introduce this blog.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t already know who I am, I am Erik &amp;ldquo;kusma&amp;rdquo; Faye-Lund, a Norwegian
graphics programmer.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m currently working on the following projects, which I expect to be posting
about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/fusetools/fuselibs-public&#34;&gt;Fuselibs&lt;/a&gt;: This is the core
UI engine in &lt;a href=&#34;https://www.fusetools.com&#34;&gt;Fuse&lt;/a&gt;, where I currently work.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://rocket.github.io&#34;&gt;Rocket&lt;/a&gt;: This is a tool for tweaking
synchronization of audio and visuals in demoscene productions.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grate-driver&#34;&gt;Grate&lt;/a&gt;: This is a reverse-engineered GPU
driver for the GeForce ULP in the NVIDIA Tegra 2/3/4 SoCs (code-name:
AR20 / Aurora).&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.mesa3d.org&#34;&gt;Mesa 3D&lt;/a&gt;: This is what Grate is being built on top,
and the goal of Grate is ultimately to upstream a driver into Mesa.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In addition to this, there&amp;rsquo;s some cool new announcements coming up very soon!
So stay tuned!&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
