[PATCH 00/10] winex11: Add Vulkan ICD.

Roderick Colenbrander thunderbird2k at gmail.com
Tue Oct 31 12:24:44 CDT 2017


Hi all,

This patch series starts the implementation of a Vulkan ICD
into winex11.drv (and later in other drivers).

For people not familiar with Vulkan, let provide a brief overview
on why we need an ICD and why it should be in the display drivers
themselves.

Application developers typically interface with Vulkan through the
Vulkan loader library (vulkan-1.dll on Windows). The loader is
open source (more on this later) and its upto the developer to
link it dynamically or statically (yuck). Some developers skip
the loader and directly load the ICD in the hope to get that
magical 0.1% fps boost.

The loader hides loading of the ICDs which are provided by the
hardware vendors. In addition the loader provides a layering
mechanism, which allows layer libraries to get inserted in
between loader and ICD. Some reference layers can help with
debugging, but e.g. Steam uses layers to inject overlays.

A Vulkan implementation in Wine must be in the form of an ICD
as demonstrated above. The implemention in Wine staging just
replaces the loader and would have the issues mentioned above.

Vulkan was retrofitted into existing operating systems, so
integration with Win32 is fairly minimal. For example there
is no path like with gdi32 by which Vulkan can reach the
graphics drivers, so Vulkan loads the display driver directly.
Registry settings and json files provide Vulkan this detail.

I decided to place the ICD directly in the display driver
as ultimately we need some tight coupling for window
rendering and also child window rendering (this is possible,
though I haven't seen applications use it).

The amount of code sharing between ICDs, I expect to be mostly in
generated code and maybe a few helper functions. For now
I think it is best to duplicate code and longer-term if
a little bit of sharing makes sense put this in a staticly
linked helper library. I want to avoid implementing our own
'winevulkan' glue ICD library in between loader and display
driver as I fear this will cause many issues, because the object
design didn't lend for this (assumes 1 ICD = 1 driver). Besides
some applications load the ICD directly.

This first wave of patches gets some initial ICD infrastructure
in place. Enough to create a minimal Vulkan Instance and get
some function loading going. It will take another 6-7 patches
or so before 'vulkaninfo' the Vulkan equivalent of glxinfo
will work to some degree.

For now the easiest way to load the ICD is to add a registry key:
[HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers\]
"C:\Windows\System32\winex11.json"=dword:00000000

winex11.json:
{
    "file_format_version": "1.0.0",
    "ICD": {
        "library_path": "c:\\windows\\system32\\winex11.drv",
        "api_version": "1.0.51"
    }
}

One other comment in regards to licensing. For now I'm generating
code from vk.xml version 1.0.51. This is NOT the latest version,
but is the last BSD licensed version. Newer versions are Apache
licensed and can't be used by us as we are a derived work and
would be Apache. I have reached out to Khronos a few weeks ago
and they want to fix this. They thought Apache made things easy,
but didn't think about generated code and the license implications.
They are actively working on a solution either dual licensing or
additing some kind of code generation exception. This is a slow
process as it involves 100+ companies, but the Neil Trevett of
Khronos wants to get this done.

Thanks,
Roderick

Roderick Colenbrander (10):
  vulkan: Add Wine vulkan header.
  winex11: Add stub Vulkan ICD
  winex11: Implement vk_icdNegotiateLoaderICDInterfaceVersion
  winex11: Add stubs for global Vulkan functions.
  winex11: Add initial vkEnumerateInstanceExtensionProperties
    implementation.
  winex11: Load vulkan library.
  winex11: add logging functions for vkCreateInstance
  winex11: Add initial vkCreateInstance implementation.
  winex11: Add stubs for core Vulkan instance functions.
  winex11: Implement vkDestroyInstance.

 configure.ac                      |    9 +
 dlls/winex11.drv/Makefile.in      |    2 +
 dlls/winex11.drv/vulkan.c         |  332 +++++
 dlls/winex11.drv/vulkan_private.h |   75 +
 dlls/winex11.drv/vulkan_thunks.c  |  110 ++
 dlls/winex11.drv/winex11.drv.spec |    4 +
 include/config.h.in               |    3 +
 include/wine/vulkan.h             | 2889 +++++++++++++++++++++++++++++++++++++
 8 files changed, 3424 insertions(+)
 create mode 100644 dlls/winex11.drv/vulkan.c
 create mode 100644 dlls/winex11.drv/vulkan_private.h
 create mode 100644 dlls/winex11.drv/vulkan_thunks.c
 create mode 100644 include/wine/vulkan.h

-- 
2.13.6




More information about the wine-patches mailing list