From: Roderick Colenbrander Subject: [PATCH 06/10] winex11: Add Vulkan stubs. Message-Id: <20180220062947.4192-7-thunderbird2k@gmail.com> Date: Mon, 19 Feb 2018 22:29:43 -0800 In-Reply-To: <20180220062947.4192-1-thunderbird2k@gmail.com> References: <20180220062947.4192-1-thunderbird2k@gmail.com> Signed-off-by: Roderick Colenbrander --- dlls/winevulkan/vulkan.c | 8 ++--- dlls/winex11.drv/Makefile.in | 3 +- dlls/winex11.drv/init.c | 17 ++++++++++- dlls/winex11.drv/vulkan.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 1 + 5 files changed, 93 insertions(+), 6 deletions(-) create mode 100644 dlls/winex11.drv/vulkan.c diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 4c25de30ee..2b1ddb793a 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -91,15 +91,15 @@ static BOOL wine_vk_init(HINSTANCE hinst) static VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { - FIXME("stub: %p %p %p\n", pCreateInfo, pAllocator, pInstance); - return VK_ERROR_INCOMPATIBLE_DRIVER; + TRACE("%p %p %p\n", pCreateInfo, pAllocator, pInstance); + return vk_funcs->p_vkCreateInstance(pCreateInfo, pAllocator, pInstance); } static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) { - FIXME("stub: %p %p %p\n", pLayerName, pPropertyCount, pProperties); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p %p %p\n", pLayerName, pPropertyCount, pProperties); + return vk_funcs->p_vkEnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties); } static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *pName) diff --git a/dlls/winex11.drv/Makefile.in b/dlls/winex11.drv/Makefile.in index 463eefdcfb..a542490f53 100644 --- a/dlls/winex11.drv/Makefile.in +++ b/dlls/winex11.drv/Makefile.in @@ -28,6 +28,7 @@ C_SRCS = \ xinerama.c \ xrandr.c \ xrender.c \ - xvidmode.c + xvidmode.c \ + vulkan.c RC_SRCS = version.rc diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 24ed656405..a9b186c067 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -345,6 +345,21 @@ static struct opengl_funcs * X11DRV_wine_get_wgl_driver( PHYSDEV dev, UINT versi return ret; } +/********************************************************************** + * X11DRV_wine_get_vulkan_driver + */ +static struct vulkan_funcs * X11DRV_wine_get_vulkan_driver( PHYSDEV dev, UINT version ) +{ + struct vulkan_funcs *ret; + + if (!(ret = get_vulkan_driver( version ))) + { + dev = GET_NEXT_PHYSDEV( dev, wine_get_vulkan_driver ); + ret = dev->funcs->wine_get_vulkan_driver( dev, version ); + } + return ret; +} + static const struct gdi_dc_funcs x11drv_funcs = { @@ -475,7 +490,7 @@ static const struct gdi_dc_funcs x11drv_funcs = X11DRV_UnrealizePalette, /* pUnrealizePalette */ NULL, /* pWidenPath */ X11DRV_wine_get_wgl_driver, /* wine_get_wgl_driver */ - NULL, /* wine_get_vulkan_driver */ + X11DRV_wine_get_vulkan_driver, /* wine_get_vulkan_driver */ GDI_PRIORITY_GRAPHICS_DRV /* priority */ }; diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c new file mode 100644 index 0000000000..b8d6657829 --- /dev/null +++ b/dlls/winex11.drv/vulkan.c @@ -0,0 +1,70 @@ +/* X11DRV Vulkan implementation + * + * Copyright 2017 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" +#include "wine/port.h" + +#include "wine/debug.h" +#include "wine/vulkan.h" +#include "wine/vulkan_driver.h" + +WINE_DEFAULT_DEBUG_CHANNEL(vulkan); + +static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, + VkInstance *pInstance) +{ + FIXME("stub: %p %p %p\n", pCreateInfo, pAllocator, pInstance); + return VK_ERROR_INCOMPATIBLE_DRIVER; +} + +static void X11DRV_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) +{ + FIXME("stub: %p %p\n", instance, pAllocator); +} + +static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, + VkExtensionProperties* pProperties) +{ + FIXME("stub: %s %p %p\n", debugstr_a(pLayerName), pPropertyCount, pProperties); + return VK_ERROR_OUT_OF_HOST_MEMORY; +} + +static void * X11DRV_vkGetInstanceProcAddr(VkInstance instance, const char *pName) +{ + FIXME("stub: %p, %s\n", instance, debugstr_a(pName)); + return NULL; +} + +static struct vulkan_funcs vulkan_funcs = { + X11DRV_vkCreateInstance, + X11DRV_vkDestroyInstance, + X11DRV_vkEnumerateInstanceExtensionProperties, + X11DRV_vkGetInstanceProcAddr +}; + +struct vulkan_funcs *get_vulkan_driver(UINT version) +{ + if (version != WINE_VULKAN_DRIVER_VERSION) + { + ERR("version mismatch, vulkan wants %u but driver has %u\n", version, WINE_VULKAN_DRIVER_VERSION); + return NULL; + } + + return &vulkan_funcs; +} diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 72036279c6..32757a9eca 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -223,6 +223,7 @@ extern BOOL shape_layered_windows DECLSPEC_HIDDEN; extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN; extern struct opengl_funcs *get_glx_driver(UINT) DECLSPEC_HIDDEN; +extern struct vulkan_funcs *get_vulkan_driver(UINT) DECLSPEC_HIDDEN; /* IME support */ extern void IME_SetOpenStatus(BOOL fOpen) DECLSPEC_HIDDEN; -- 2.14.3