Commit f0f232eb authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

vulkan-1: Add initial implementation.

parent dea29841
......@@ -1549,6 +1549,7 @@ enable_vdmdbg
enable_version
enable_virtdisk
enable_vssapi
enable_vulkan_1
enable_wbemdisp
enable_wbemprox
enable_wdscore
......@@ -19068,6 +19069,7 @@ wine_fn_config_makefile dlls/vnbt.vxd enable_win16
wine_fn_config_makefile dlls/vnetbios.vxd enable_win16
wine_fn_config_makefile dlls/vssapi enable_vssapi
wine_fn_config_makefile dlls/vtdapi.vxd enable_win16
wine_fn_config_makefile dlls/vulkan-1 enable_vulkan_1
wine_fn_config_makefile dlls/vwin32.vxd enable_win16
wine_fn_config_makefile dlls/w32skrnl enable_win16
wine_fn_config_makefile dlls/w32sys.dll16 enable_win16
......
......@@ -3692,6 +3692,7 @@ WINE_CONFIG_MAKEFILE(dlls/vnbt.vxd,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/vnetbios.vxd,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/vssapi)
WINE_CONFIG_MAKEFILE(dlls/vtdapi.vxd,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/vulkan-1)
WINE_CONFIG_MAKEFILE(dlls/vwin32.vxd,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/w32skrnl,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/w32sys.dll16,enable_win16)
......
MODULE = vulkan-1.dll
IMPORTS = winevulkan
C_SRCS = \
vulkan.c
RC_SRCS = version.rc
/*
* Copyright 2018 Roderick Colenbrander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h" /* Needed to get PACKAGE_VERSION */
#define WINE_FILEDESCRIPTION_STR "Wine Vulkan Loader"
#define WINE_FILENAME_STR "vulkan-1.dll"
#define WINE_FILEVERSION_STR PACKAGE_VERSION
#define WINE_PRODUCTVERSION_STR PACKAGE_VERSION
#define WINE_PRODUCTNAME_STR "Wine Vulkan"
#include "wine/wine_common_ver.rc"
/* Wine Vulkan loader implementation
*
* Copyright 2018 Roderick Colenbrander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
#include "wine/vulkan.h"
WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
VkResult WINAPI vkEnumerateInstanceExtensionProperties(const char *layer_name,
uint32_t *count, VkExtensionProperties *properties)
{
FIXME("stub: %p %p %p\n", layer_name, count, properties);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
VkResult WINAPI vkEnumerateInstanceLayerProperties(uint32_t *count,
VkLayerProperties *properties)
{
TRACE("%p, %p\n", count, properties);
/* We don't support any layers. */
*count = 0;
return VK_SUCCESS;
}
PFN_vkVoidFunction WINAPI vkGetInstanceProcAddr(VkInstance instance, const char *name)
{
FIXME("stub: %p %s\n", instance, debugstr_a(name));
return NULL;
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{
TRACE("(%p, %u, %p)\n", hinst, reason, reserved);
switch (reason)
{
case DLL_WINE_PREATTACH:
/* Prefer native as it provides more functionality. */
return FALSE;
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinst);
return TRUE;
}
return TRUE;
}
......@@ -65,6 +65,7 @@ LOGGER.addHandler(logging.StreamHandler())
# Filenames to create.
WINE_VULKAN_H = "../../include/wine/vulkan.h"
WINE_VULKAN_DRIVER_H = "../../include/wine/vulkan_driver.h"
WINE_VULKAN_LOADER_SPEC = "../vulkan-1/vulkan-1.spec"
WINE_VULKAN_SPEC = "winevulkan.spec"
WINE_VULKAN_THUNKS_C = "vulkan_thunks.c"
WINE_VULKAN_THUNKS_H = "vulkan_thunks.h"
......@@ -570,18 +571,26 @@ class VkFunction(object):
return body
def spec(self, prefix=None):
def spec(self, prefix=None, symbol=None):
""" Generate spec file entry for this function.
Args
prefix (str, optional): prefix to prepend to entry point name.
symbol (str, optional): allows to override function name implementing entry point.
"""
spec = ""
params = " ".join([p.spec() for p in self.params])
if prefix is not None:
return "@ stdcall {0}{1}({2})\n".format(prefix, self.name, params)
spec += "@ stdcall {0}{1}({2})".format(prefix, self.name, params)
else:
return "@ stdcall {0}({1})\n".format(self.name, params)
spec += "@ stdcall {0}({1})".format(self.name, params)
if symbol is not None:
spec += " " + symbol
spec += "\n"
return spec
def stub(self, call_conv=None, prefix=None):
stub = self.prototype(call_conv=call_conv, prefix=prefix)
......@@ -2136,6 +2145,26 @@ class VkGenerator(object):
else:
f.write("@ stub {0}\n".format(func.name))
def generate_vulkan_loader_spec(self, f):
f.write("# Automatically generated from Vulkan vk.xml; DO NOT EDIT!\n\n")
# Export symbols for all Vulkan Core functions.
for func in self.registry.funcs.values():
if not func.is_core_func():
continue
# We support all Core functions except for VK_KHR_display* APIs.
# Create stubs for unsupported Core functions.
if func.is_required():
# Global functions need a custom implementation, except for
# vkCreateInstance, which we can just forward.
if func.is_global_func() and func.name != "vkCreateInstance":
f.write(func.spec())
else:
f.write(func.spec(symbol="winevulkan.wine_" + func.name))
else:
f.write("@ stub {0}\n".format(func.name))
class VkRegistry(object):
def __init__(self, reg_filename):
......@@ -2521,5 +2550,8 @@ def main():
with open(WINE_VULKAN_SPEC, "w") as f:
generator.generate_vulkan_spec(f)
with open(WINE_VULKAN_LOADER_SPEC, "w") as f:
generator.generate_vulkan_loader_spec(f)
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment