[PATCH 2/4] vulkan-1: Add initial implementation.

Roderick Colenbrander thunderbird2k at gmail.com
Wed Mar 28 02:20:50 CDT 2018


Signed-off-by: Roderick Colenbrander <thunderbird2k at gmail.com>
---
 configure.ac                |   1 +
 dlls/vulkan-1/Makefile.in   |   7 ++
 dlls/vulkan-1/version.rc    |  27 ++++++++
 dlls/vulkan-1/vulkan-1.spec | 159 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/vulkan-1/vulkan.c      |  68 +++++++++++++++++++
 dlls/winevulkan/make_vulkan |  38 ++++++++++-
 6 files changed, 297 insertions(+), 3 deletions(-)
 create mode 100644 dlls/vulkan-1/Makefile.in
 create mode 100644 dlls/vulkan-1/version.rc
 create mode 100644 dlls/vulkan-1/vulkan-1.spec
 create mode 100644 dlls/vulkan-1/vulkan.c

diff --git a/configure.ac b/configure.ac
index 6a30601ca0..60c410c1f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/dlls/vulkan-1/Makefile.in b/dlls/vulkan-1/Makefile.in
new file mode 100644
index 0000000000..4bb8cec412
--- /dev/null
+++ b/dlls/vulkan-1/Makefile.in
@@ -0,0 +1,7 @@
+MODULE    = vulkan-1.dll
+IMPORTS   = winevulkan
+
+C_SRCS = \
+	vulkan.c
+
+RC_SRCS = version.rc
diff --git a/dlls/vulkan-1/version.rc b/dlls/vulkan-1/version.rc
new file mode 100644
index 0000000000..ec75462ddf
--- /dev/null
+++ b/dlls/vulkan-1/version.rc
@@ -0,0 +1,27 @@
+/*
+ * 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"
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
new file mode 100644
index 0000000000..49af817d57
--- /dev/null
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -0,0 +1,159 @@
+# Automatically generated from Vulkan vk.xml; DO NOT EDIT!
+
+@ stdcall vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr) winevulkan.wine_vkAcquireNextImageKHR
+@ stdcall vkAllocateCommandBuffers(ptr ptr ptr) winevulkan.wine_vkAllocateCommandBuffers
+@ stdcall vkAllocateDescriptorSets(ptr ptr ptr) winevulkan.wine_vkAllocateDescriptorSets
+@ stdcall vkAllocateMemory(ptr ptr ptr ptr) winevulkan.wine_vkAllocateMemory
+@ stdcall vkBeginCommandBuffer(ptr ptr) winevulkan.wine_vkBeginCommandBuffer
+@ stdcall vkBindBufferMemory(ptr int64 int64 int64) winevulkan.wine_vkBindBufferMemory
+@ stdcall vkBindImageMemory(ptr int64 int64 int64) winevulkan.wine_vkBindImageMemory
+@ stdcall vkCmdBeginQuery(ptr int64 long long) winevulkan.wine_vkCmdBeginQuery
+@ stdcall vkCmdBeginRenderPass(ptr ptr long) winevulkan.wine_vkCmdBeginRenderPass
+@ stdcall vkCmdBindDescriptorSets(ptr long int64 long long ptr long ptr) winevulkan.wine_vkCmdBindDescriptorSets
+@ stdcall vkCmdBindIndexBuffer(ptr int64 int64 long) winevulkan.wine_vkCmdBindIndexBuffer
+@ stdcall vkCmdBindPipeline(ptr long int64) winevulkan.wine_vkCmdBindPipeline
+@ stdcall vkCmdBindVertexBuffers(ptr long long ptr ptr) winevulkan.wine_vkCmdBindVertexBuffers
+@ stdcall vkCmdBlitImage(ptr int64 long int64 long long ptr long) winevulkan.wine_vkCmdBlitImage
+@ stdcall vkCmdClearAttachments(ptr long ptr long ptr) winevulkan.wine_vkCmdClearAttachments
+@ stdcall vkCmdClearColorImage(ptr int64 long ptr long ptr) winevulkan.wine_vkCmdClearColorImage
+@ stdcall vkCmdClearDepthStencilImage(ptr int64 long ptr long ptr) winevulkan.wine_vkCmdClearDepthStencilImage
+@ stdcall vkCmdCopyBuffer(ptr int64 int64 long ptr) winevulkan.wine_vkCmdCopyBuffer
+@ stdcall vkCmdCopyBufferToImage(ptr int64 int64 long long ptr) winevulkan.wine_vkCmdCopyBufferToImage
+@ stdcall vkCmdCopyImage(ptr int64 long int64 long long ptr) winevulkan.wine_vkCmdCopyImage
+@ stdcall vkCmdCopyImageToBuffer(ptr int64 long int64 long ptr) winevulkan.wine_vkCmdCopyImageToBuffer
+@ stdcall vkCmdCopyQueryPoolResults(ptr int64 long long int64 int64 int64 long) winevulkan.wine_vkCmdCopyQueryPoolResults
+@ stdcall vkCmdDispatch(ptr long long long) winevulkan.wine_vkCmdDispatch
+@ stdcall vkCmdDispatchIndirect(ptr int64 int64) winevulkan.wine_vkCmdDispatchIndirect
+@ stdcall vkCmdDraw(ptr long long long long) winevulkan.wine_vkCmdDraw
+@ stdcall vkCmdDrawIndexed(ptr long long long long long) winevulkan.wine_vkCmdDrawIndexed
+@ stdcall vkCmdDrawIndexedIndirect(ptr int64 int64 long long) winevulkan.wine_vkCmdDrawIndexedIndirect
+@ stdcall vkCmdDrawIndirect(ptr int64 int64 long long) winevulkan.wine_vkCmdDrawIndirect
+@ stdcall vkCmdEndQuery(ptr int64 long) winevulkan.wine_vkCmdEndQuery
+@ stdcall vkCmdEndRenderPass(ptr) winevulkan.wine_vkCmdEndRenderPass
+@ stdcall vkCmdExecuteCommands(ptr long ptr) winevulkan.wine_vkCmdExecuteCommands
+@ stdcall vkCmdFillBuffer(ptr int64 int64 int64 long) winevulkan.wine_vkCmdFillBuffer
+@ stdcall vkCmdNextSubpass(ptr long) winevulkan.wine_vkCmdNextSubpass
+@ stdcall vkCmdPipelineBarrier(ptr long long long long ptr long ptr long ptr) winevulkan.wine_vkCmdPipelineBarrier
+@ stdcall vkCmdPushConstants(ptr int64 long long long ptr) winevulkan.wine_vkCmdPushConstants
+@ stdcall vkCmdResetEvent(ptr int64 long) winevulkan.wine_vkCmdResetEvent
+@ stdcall vkCmdResetQueryPool(ptr int64 long long) winevulkan.wine_vkCmdResetQueryPool
+@ stdcall vkCmdResolveImage(ptr int64 long int64 long long ptr) winevulkan.wine_vkCmdResolveImage
+@ stdcall vkCmdSetBlendConstants(ptr ptr) winevulkan.wine_vkCmdSetBlendConstants
+@ stdcall vkCmdSetDepthBias(ptr float float float) winevulkan.wine_vkCmdSetDepthBias
+@ stdcall vkCmdSetDepthBounds(ptr float float) winevulkan.wine_vkCmdSetDepthBounds
+@ stdcall vkCmdSetEvent(ptr int64 long) winevulkan.wine_vkCmdSetEvent
+@ stdcall vkCmdSetLineWidth(ptr float) winevulkan.wine_vkCmdSetLineWidth
+@ stdcall vkCmdSetScissor(ptr long long ptr) winevulkan.wine_vkCmdSetScissor
+@ stdcall vkCmdSetStencilCompareMask(ptr long long) winevulkan.wine_vkCmdSetStencilCompareMask
+@ stdcall vkCmdSetStencilReference(ptr long long) winevulkan.wine_vkCmdSetStencilReference
+@ stdcall vkCmdSetStencilWriteMask(ptr long long) winevulkan.wine_vkCmdSetStencilWriteMask
+@ stdcall vkCmdSetViewport(ptr long long ptr) winevulkan.wine_vkCmdSetViewport
+@ stdcall vkCmdUpdateBuffer(ptr int64 int64 int64 ptr) winevulkan.wine_vkCmdUpdateBuffer
+@ stdcall vkCmdWaitEvents(ptr long ptr long long long ptr long ptr long ptr) winevulkan.wine_vkCmdWaitEvents
+@ stdcall vkCmdWriteTimestamp(ptr long int64 long) winevulkan.wine_vkCmdWriteTimestamp
+@ stdcall vkCreateBuffer(ptr ptr ptr ptr) winevulkan.wine_vkCreateBuffer
+@ stdcall vkCreateBufferView(ptr ptr ptr ptr) winevulkan.wine_vkCreateBufferView
+@ stdcall vkCreateCommandPool(ptr ptr ptr ptr) winevulkan.wine_vkCreateCommandPool
+@ stdcall vkCreateComputePipelines(ptr int64 long ptr ptr ptr) winevulkan.wine_vkCreateComputePipelines
+@ stdcall vkCreateDescriptorPool(ptr ptr ptr ptr) winevulkan.wine_vkCreateDescriptorPool
+@ stdcall vkCreateDescriptorSetLayout(ptr ptr ptr ptr) winevulkan.wine_vkCreateDescriptorSetLayout
+@ stdcall vkCreateDevice(ptr ptr ptr ptr) winevulkan.wine_vkCreateDevice
+@ stub vkCreateDisplayModeKHR
+@ stub vkCreateDisplayPlaneSurfaceKHR
+@ stdcall vkCreateEvent(ptr ptr ptr ptr) winevulkan.wine_vkCreateEvent
+@ stdcall vkCreateFence(ptr ptr ptr ptr) winevulkan.wine_vkCreateFence
+@ stdcall vkCreateFramebuffer(ptr ptr ptr ptr) winevulkan.wine_vkCreateFramebuffer
+@ stdcall vkCreateGraphicsPipelines(ptr int64 long ptr ptr ptr) winevulkan.wine_vkCreateGraphicsPipelines
+@ stdcall vkCreateImage(ptr ptr ptr ptr) winevulkan.wine_vkCreateImage
+@ stdcall vkCreateImageView(ptr ptr ptr ptr) winevulkan.wine_vkCreateImageView
+@ stdcall vkCreateInstance(ptr ptr ptr) winevulkan.wine_vkCreateInstance
+@ stdcall vkCreatePipelineCache(ptr ptr ptr ptr) winevulkan.wine_vkCreatePipelineCache
+@ stdcall vkCreatePipelineLayout(ptr ptr ptr ptr) winevulkan.wine_vkCreatePipelineLayout
+@ stdcall vkCreateQueryPool(ptr ptr ptr ptr) winevulkan.wine_vkCreateQueryPool
+@ stdcall vkCreateRenderPass(ptr ptr ptr ptr) winevulkan.wine_vkCreateRenderPass
+@ stdcall vkCreateSampler(ptr ptr ptr ptr) winevulkan.wine_vkCreateSampler
+@ stdcall vkCreateSemaphore(ptr ptr ptr ptr) winevulkan.wine_vkCreateSemaphore
+@ stdcall vkCreateShaderModule(ptr ptr ptr ptr) winevulkan.wine_vkCreateShaderModule
+@ stub vkCreateSharedSwapchainsKHR
+@ stdcall vkCreateSwapchainKHR(ptr ptr ptr ptr) winevulkan.wine_vkCreateSwapchainKHR
+@ stdcall vkCreateWin32SurfaceKHR(ptr ptr ptr ptr) winevulkan.wine_vkCreateWin32SurfaceKHR
+@ stdcall vkDestroyBuffer(ptr int64 ptr) winevulkan.wine_vkDestroyBuffer
+@ stdcall vkDestroyBufferView(ptr int64 ptr) winevulkan.wine_vkDestroyBufferView
+@ stdcall vkDestroyCommandPool(ptr int64 ptr) winevulkan.wine_vkDestroyCommandPool
+@ stdcall vkDestroyDescriptorPool(ptr int64 ptr) winevulkan.wine_vkDestroyDescriptorPool
+@ stdcall vkDestroyDescriptorSetLayout(ptr int64 ptr) winevulkan.wine_vkDestroyDescriptorSetLayout
+@ stdcall vkDestroyDevice(ptr ptr) winevulkan.wine_vkDestroyDevice
+@ stdcall vkDestroyEvent(ptr int64 ptr) winevulkan.wine_vkDestroyEvent
+@ stdcall vkDestroyFence(ptr int64 ptr) winevulkan.wine_vkDestroyFence
+@ stdcall vkDestroyFramebuffer(ptr int64 ptr) winevulkan.wine_vkDestroyFramebuffer
+@ stdcall vkDestroyImage(ptr int64 ptr) winevulkan.wine_vkDestroyImage
+@ stdcall vkDestroyImageView(ptr int64 ptr) winevulkan.wine_vkDestroyImageView
+@ stdcall vkDestroyInstance(ptr ptr) winevulkan.wine_vkDestroyInstance
+@ stdcall vkDestroyPipeline(ptr int64 ptr) winevulkan.wine_vkDestroyPipeline
+@ stdcall vkDestroyPipelineCache(ptr int64 ptr) winevulkan.wine_vkDestroyPipelineCache
+@ stdcall vkDestroyPipelineLayout(ptr int64 ptr) winevulkan.wine_vkDestroyPipelineLayout
+@ stdcall vkDestroyQueryPool(ptr int64 ptr) winevulkan.wine_vkDestroyQueryPool
+@ stdcall vkDestroyRenderPass(ptr int64 ptr) winevulkan.wine_vkDestroyRenderPass
+@ stdcall vkDestroySampler(ptr int64 ptr) winevulkan.wine_vkDestroySampler
+@ stdcall vkDestroySemaphore(ptr int64 ptr) winevulkan.wine_vkDestroySemaphore
+@ stdcall vkDestroyShaderModule(ptr int64 ptr) winevulkan.wine_vkDestroyShaderModule
+@ stdcall vkDestroySurfaceKHR(ptr int64 ptr) winevulkan.wine_vkDestroySurfaceKHR
+@ stdcall vkDestroySwapchainKHR(ptr int64 ptr) winevulkan.wine_vkDestroySwapchainKHR
+@ stdcall vkDeviceWaitIdle(ptr) winevulkan.wine_vkDeviceWaitIdle
+@ stdcall vkEndCommandBuffer(ptr) winevulkan.wine_vkEndCommandBuffer
+@ stdcall vkEnumerateDeviceExtensionProperties(ptr str ptr ptr) winevulkan.wine_vkEnumerateDeviceExtensionProperties
+@ stdcall vkEnumerateDeviceLayerProperties(ptr ptr ptr) winevulkan.wine_vkEnumerateDeviceLayerProperties
+@ stdcall vkEnumerateInstanceExtensionProperties(str ptr ptr)
+@ stdcall vkEnumerateInstanceLayerProperties(ptr ptr)
+@ stdcall vkEnumeratePhysicalDevices(ptr ptr ptr) winevulkan.wine_vkEnumeratePhysicalDevices
+@ stdcall vkFlushMappedMemoryRanges(ptr long ptr) winevulkan.wine_vkFlushMappedMemoryRanges
+@ stdcall vkFreeCommandBuffers(ptr int64 long ptr) winevulkan.wine_vkFreeCommandBuffers
+@ stdcall vkFreeDescriptorSets(ptr int64 long ptr) winevulkan.wine_vkFreeDescriptorSets
+@ stdcall vkFreeMemory(ptr int64 ptr) winevulkan.wine_vkFreeMemory
+@ stdcall vkGetBufferMemoryRequirements(ptr int64 ptr) winevulkan.wine_vkGetBufferMemoryRequirements
+@ stdcall vkGetDeviceMemoryCommitment(ptr int64 ptr) winevulkan.wine_vkGetDeviceMemoryCommitment
+@ stdcall vkGetDeviceProcAddr(ptr str) winevulkan.wine_vkGetDeviceProcAddr
+@ stdcall vkGetDeviceQueue(ptr long long ptr) winevulkan.wine_vkGetDeviceQueue
+@ stub vkGetDisplayModePropertiesKHR
+@ stub vkGetDisplayPlaneCapabilitiesKHR
+@ stub vkGetDisplayPlaneSupportedDisplaysKHR
+@ stdcall vkGetEventStatus(ptr int64) winevulkan.wine_vkGetEventStatus
+@ stdcall vkGetFenceStatus(ptr int64) winevulkan.wine_vkGetFenceStatus
+@ stdcall vkGetImageMemoryRequirements(ptr int64 ptr) winevulkan.wine_vkGetImageMemoryRequirements
+@ stdcall vkGetImageSparseMemoryRequirements(ptr int64 ptr ptr) winevulkan.wine_vkGetImageSparseMemoryRequirements
+@ stdcall vkGetImageSubresourceLayout(ptr int64 ptr ptr) winevulkan.wine_vkGetImageSubresourceLayout
+@ stdcall vkGetInstanceProcAddr(ptr str)
+@ stub vkGetPhysicalDeviceDisplayPlanePropertiesKHR
+@ stub vkGetPhysicalDeviceDisplayPropertiesKHR
+@ stdcall vkGetPhysicalDeviceFeatures(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceFeatures
+@ stdcall vkGetPhysicalDeviceFormatProperties(ptr long ptr) winevulkan.wine_vkGetPhysicalDeviceFormatProperties
+@ stdcall vkGetPhysicalDeviceImageFormatProperties(ptr long long long long long ptr) winevulkan.wine_vkGetPhysicalDeviceImageFormatProperties
+@ stdcall vkGetPhysicalDeviceMemoryProperties(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceMemoryProperties
+@ stdcall vkGetPhysicalDeviceProperties(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceProperties
+@ stdcall vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceQueueFamilyProperties
+@ stdcall vkGetPhysicalDeviceSparseImageFormatProperties(ptr long long long long long ptr ptr) winevulkan.wine_vkGetPhysicalDeviceSparseImageFormatProperties
+@ stdcall vkGetPhysicalDeviceSurfaceCapabilitiesKHR(ptr int64 ptr) winevulkan.wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
+@ stdcall vkGetPhysicalDeviceSurfaceFormatsKHR(ptr int64 ptr ptr) winevulkan.wine_vkGetPhysicalDeviceSurfaceFormatsKHR
+@ stdcall vkGetPhysicalDeviceSurfacePresentModesKHR(ptr int64 ptr long) winevulkan.wine_vkGetPhysicalDeviceSurfacePresentModesKHR
+@ stdcall vkGetPhysicalDeviceSurfaceSupportKHR(ptr long int64 ptr) winevulkan.wine_vkGetPhysicalDeviceSurfaceSupportKHR
+@ stdcall vkGetPhysicalDeviceWin32PresentationSupportKHR(ptr long) winevulkan.wine_vkGetPhysicalDeviceWin32PresentationSupportKHR
+@ stdcall vkGetPipelineCacheData(ptr int64 ptr ptr) winevulkan.wine_vkGetPipelineCacheData
+@ stdcall vkGetQueryPoolResults(ptr int64 long long long ptr int64 long) winevulkan.wine_vkGetQueryPoolResults
+@ stdcall vkGetRenderAreaGranularity(ptr int64 ptr) winevulkan.wine_vkGetRenderAreaGranularity
+@ stdcall vkGetSwapchainImagesKHR(ptr int64 ptr ptr) winevulkan.wine_vkGetSwapchainImagesKHR
+@ stdcall vkInvalidateMappedMemoryRanges(ptr long ptr) winevulkan.wine_vkInvalidateMappedMemoryRanges
+@ stdcall vkMapMemory(ptr int64 int64 int64 long ptr) winevulkan.wine_vkMapMemory
+@ stdcall vkMergePipelineCaches(ptr int64 long ptr) winevulkan.wine_vkMergePipelineCaches
+@ stdcall vkQueueBindSparse(ptr long ptr int64) winevulkan.wine_vkQueueBindSparse
+@ stdcall vkQueuePresentKHR(ptr ptr) winevulkan.wine_vkQueuePresentKHR
+@ stdcall vkQueueSubmit(ptr long ptr int64) winevulkan.wine_vkQueueSubmit
+@ stdcall vkQueueWaitIdle(ptr) winevulkan.wine_vkQueueWaitIdle
+@ stdcall vkResetCommandBuffer(ptr long) winevulkan.wine_vkResetCommandBuffer
+@ stdcall vkResetCommandPool(ptr int64 long) winevulkan.wine_vkResetCommandPool
+@ stdcall vkResetDescriptorPool(ptr int64 long) winevulkan.wine_vkResetDescriptorPool
+@ stdcall vkResetEvent(ptr int64) winevulkan.wine_vkResetEvent
+@ stdcall vkResetFences(ptr long ptr) winevulkan.wine_vkResetFences
+@ stdcall vkSetEvent(ptr int64) winevulkan.wine_vkSetEvent
+@ stdcall vkUnmapMemory(ptr int64) winevulkan.wine_vkUnmapMemory
+@ stdcall vkUpdateDescriptorSets(ptr long ptr long ptr) winevulkan.wine_vkUpdateDescriptorSets
+@ stdcall vkWaitForFences(ptr long ptr long int64) winevulkan.wine_vkWaitForFences
diff --git a/dlls/vulkan-1/vulkan.c b/dlls/vulkan-1/vulkan.c
new file mode 100644
index 0000000000..5f974eed52
--- /dev/null
+++ b/dlls/vulkan-1/vulkan.c
@@ -0,0 +1,68 @@
+/* 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;
+}
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 7c4dc348be..e781313440 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -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()
-- 
2.14.3




More information about the wine-devel mailing list