Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 22 +++++++ dlls/winevulkan/vulkan.c | 138 +++++++++++++++++++++++++++++++++++---- dlls/winevulkan/vulkan_private.h | 4 ++ dlls/winevulkan/vulkan_thunks.c | 16 +++++ dlls/winevulkan/vulkan_thunks.h | 2 + 5 files changed, 168 insertions(+), 14 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 5fff3f1511..ddae964457 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1803,6 +1803,26 @@ class VkGenerator(object): f.write(" }\n") f.write(" }\n") f.write(" return NULL;\n") + f.write("}\n\n") + + # Create array of device extensions. + f.write("static const char *vk_device_extensions[] =\n{\n") + for ext in self.registry.extensions: + if ext["type"] != "device": + continue + + f.write(" "{0}",\n".format(ext["name"])) + f.write("};\n\n") + + f.write("BOOL wine_vk_device_extension_supported(const char *name)\n") + f.write("{\n") + f.write(" unsigned int i;\n") + f.write(" for (i = 0; i < ARRAY_SIZE(vk_device_extensions); i++)\n") + f.write(" {\n") + f.write(" if (strcmp(vk_device_extensions[i], name) == 0)\n") + f.write(" return TRUE;\n") + f.write(" }\n") + f.write(" return FALSE;\n") f.write("}\n")
def generate_thunks_h(self, f, prefix): @@ -1820,6 +1840,8 @@ class VkGenerator(object): f.write("void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN;\n") f.write("void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;\n\n")
+ f.write("BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;\n\n") + # Generate prototypes for device and instance functions requiring a custom implementation. f.write("/* Functions for which we have custom implementations outside of the thunks. */\n") for vk_func in self.registry.funcs.values(): diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index fe1f85121f..7b0a15f2af 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -46,6 +46,9 @@ struct wine_vk_structure_header };
static void *wine_vk_get_global_proc_addr(const char *name); +static struct VkPhysicalDevice_T *wine_vk_physical_device_alloc(struct VkInstance_T *instance, + VkPhysicalDevice phys_dev_host); +static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev);
static const struct vulkan_funcs *vk_funcs = NULL;
@@ -170,7 +173,7 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst /* Wrap each native physical device handle into a dispatchable object for the ICD loader. */ for (i = 0; i < num_phys_devs; i++) { - struct VkPhysicalDevice_T *phys_dev = heap_alloc(sizeof(*phys_dev)); + struct VkPhysicalDevice_T *phys_dev = wine_vk_physical_device_alloc(instance, tmp_phys_devs[i]); if (!phys_dev) { ERR("Unable to allocate memory for physical device!\n"); @@ -178,10 +181,6 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst goto err; }
- phys_dev->base.loader_magic = VULKAN_ICD_MAGIC_VALUE; - phys_dev->instance = instance; - phys_dev->phys_dev = tmp_phys_devs[i]; - instance->phys_devs[i] = phys_dev; instance->num_phys_devs = i + 1; } @@ -192,7 +191,6 @@ static VkResult wine_vk_instance_load_physical_devices(struct VkInstance_T *inst
err: heap_free(tmp_phys_devs); - return res; }
@@ -210,7 +208,7 @@ static void wine_vk_instance_free(struct VkInstance_T *instance)
for (i = 0; i < instance->num_phys_devs; i++) { - heap_free(&instance->phys_devs[i]); + wine_vk_physical_device_free(instance->phys_devs[i]); } heap_free(instance->phys_devs); } @@ -221,6 +219,99 @@ static void wine_vk_instance_free(struct VkInstance_T *instance) heap_free(instance); }
+static struct VkPhysicalDevice_T *wine_vk_physical_device_alloc(struct VkInstance_T *instance, + VkPhysicalDevice phys_dev) +{ + struct VkPhysicalDevice_T *object; + uint32_t num_host_properties, num_properties = 0; + VkExtensionProperties *host_properties = NULL; + VkResult res; + unsigned int i, j; + + object = heap_alloc_zero(sizeof(*object)); + if (!object) + return NULL; + + object->base.loader_magic = VULKAN_ICD_MAGIC_VALUE; + object->instance = instance; + object->phys_dev = phys_dev; + + res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(phys_dev, + NULL, &num_host_properties, NULL); + if (res != VK_SUCCESS) + { + ERR("Failed to enumerate device extensions, res=%d\n", res); + goto err; + } + + host_properties = heap_calloc(num_host_properties, sizeof(*host_properties)); + if (!host_properties) + { + ERR("Failed to allocate memory for device properties!\n"); + goto err; + } + + res = instance->funcs.p_vkEnumerateDeviceExtensionProperties(phys_dev, + NULL, &num_host_properties, host_properties); + if (res != VK_SUCCESS) + { + ERR("Failed to enumerate device extensions, res=%d\n", res); + goto err; + } + + /* Count list of extensions for which we have an implementation. + * TODO: perform translation for platform specific extensions. + */ + for (i = 0; i < num_host_properties; i++) + { + if (wine_vk_device_extension_supported(host_properties[i].extensionName)) + { + TRACE("Enabling extension '%s' for physical device %p\n", host_properties[i].extensionName, object); + num_properties++; + } + else + TRACE("Skipping extension '%s', no implementation found in winevulkan.\n", host_properties[i].extensionName); + } + + TRACE("Host supported extensions %d, Wine supported extensions %d\n", num_host_properties, num_properties); + + object->properties = heap_calloc(num_properties, sizeof(*object->properties)); + if (!object->properties) + { + ERR("Failed to allocate memory for device properties!\n"); + goto err; + } + + for (i = 0, j = 0; i < num_host_properties; i++) + { + if (wine_vk_device_extension_supported(host_properties[i].extensionName)) + { + memcpy(&object->properties[j], &host_properties[i], sizeof(*object->properties)); + j++; + } + } + object->num_properties = num_properties; + + heap_free(host_properties); + return object; + +err: + wine_vk_physical_device_free(object); + heap_free(host_properties); + return NULL; +} + +static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev) +{ + if (!phys_dev) + return; + + if (phys_dev->properties) + heap_free(phys_dev->properties); + + heap_free(phys_dev); +} + VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *image_index) { @@ -460,6 +551,9 @@ void WINAPI wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice phys_dev, const char *layer_name, uint32_t *count, VkExtensionProperties *properties) { + VkResult res; + unsigned int i, num_copies; + TRACE("%p, %p, %p, %p\n", phys_dev, layer_name, count, properties);
/* This shouldn't get called with layer_name set, the ICD loader prevents it. */ @@ -471,16 +565,32 @@ VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice phys_
if (!properties) { - *count = 0; /* No extensions yet. */ + *count = phys_dev->num_properties; return VK_SUCCESS; }
- /* When properties is not NULL, we copy the extensions over and set count to - * the number of copied extensions. For now we don't have much to do as we don't support - * any extensions yet. - */ - *count = 0; - return VK_SUCCESS; + if (*count < phys_dev->num_properties) + { + /* Incomplete is a type of success used to signal the application + * that not all devices got copied. + */ + num_copies = *count; + res = VK_INCOMPLETE; + } + else + { + num_copies = phys_dev->num_properties; + res = VK_SUCCESS; + } + + for (i = 0; i < num_copies; i++) + { + memcpy(&properties[i], &phys_dev->properties[i], sizeof(phys_dev->properties[i])); + } + *count = num_copies; + + TRACE("Result %d, extensions copied %d\n", res, num_copies); + return res; }
static VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_name, diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index 897c1e1418..d49366fa5f 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -74,6 +74,10 @@ struct VkPhysicalDevice_T { struct wine_vk_base base; struct VkInstance_T *instance; /* parent */ + + uint32_t num_properties; + VkExtensionProperties *properties; + VkPhysicalDevice phys_dev; /* native physical device */ };
diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 5d9826cd67..51de005a7f 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -1073,3 +1073,19 @@ void *wine_vk_get_instance_proc_addr(const char *name) } return NULL; } + +static const char *vk_device_extensions[] = +{ + "VK_KHR_swapchain", +}; + +BOOL wine_vk_device_extension_supported(const char *name) +{ + unsigned int i; + for (i = 0; i < ARRAY_SIZE(vk_device_extensions); i++) + { + if (strcmp(vk_device_extensions[i], name) == 0) + return TRUE; + } + return FALSE; +} diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index a91612e62b..13c1228196 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -12,6 +12,8 @@ void *wine_vk_get_device_proc_addr(const char *name) DECLSPEC_HIDDEN; void *wine_vk_get_instance_proc_addr(const char *name) DECLSPEC_HIDDEN;
+BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN; + /* Functions for which we have custom implementations outside of the thunks. */ VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) DECLSPEC_HIDDEN;
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winex11.drv/vulkan.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 3c122fbd07..1d9bc606eb 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -62,10 +62,13 @@ typedef struct VkXlibSurfaceCreateInfoKHR Window window; } VkXlibSurfaceCreateInfoKHR;
+static VkResult (*pvkAcquireNextImageKHR)(VkDevice, VkSwapchainKHR, uint64_t, VkSemaphore, VkFence, uint32_t *); static VkResult (*pvkCreateInstance)(const VkInstanceCreateInfo *, const VkAllocationCallbacks *, VkInstance *); +static VkResult (*pvkCreateSwapchainKHR)(VkDevice, const VkSwapchainCreateInfoKHR *, const VkAllocationCallbacks *, VkSwapchainKHR *); static VkResult (*pvkCreateXlibSurfaceKHR)(VkInstance, const VkXlibSurfaceCreateInfoKHR *, const VkAllocationCallbacks *, VkSurfaceKHR *); static void (*pvkDestroyInstance)(VkInstance, const VkAllocationCallbacks *); static void (*pvkDestroySurfaceKHR)(VkInstance, VkSurfaceKHR, const VkAllocationCallbacks *); +static void (*pvkDestroySwapchainKHR)(VkDevice, VkSwapchainKHR, const VkAllocationCallbacks *); static void * (*pvkGetDeviceProcAddr)(VkDevice, const char *); static void * (*pvkGetInstanceProcAddr)(VkInstance, const char *); static VkResult (*pvkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice, VkSurfaceKHR, VkSurfaceCapabilitiesKHR *); @@ -73,6 +76,8 @@ static VkResult (*pvkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice, VkSur static VkResult (*pvkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice, VkSurfaceKHR, uint32_t *, VkPresentModeKHR *); static VkResult (*pvkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice, uint32_t, VkSurfaceKHR, VkBool32 *); static VkBool32 (*pvkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice, uint32_t, Display *, VisualID); +static VkResult (*pvkGetSwapchainImagesKHR)(VkDevice, VkSwapchainKHR, uint32_t *, VkImage *); +static VkResult (*pvkQueuePresentKHR)(VkQueue, const VkPresentInfoKHR *);
/* TODO: dynamically generate based on host driver capabilities. */ static const struct VkExtensionProperties winex11_vk_instance_extensions[] = @@ -98,10 +103,13 @@ static BOOL wine_vk_init(void) if (!(vulkan_handle = wine_dlopen(SONAME_LIBVULKAN, RTLD_NOW, NULL, 0))) return FALSE;
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(vulkan_handle, #f, NULL, 0)) == NULL) return FALSE; +LOAD_FUNCPTR(vkAcquireNextImageKHR) LOAD_FUNCPTR(vkCreateInstance) +LOAD_FUNCPTR(vkCreateSwapchainKHR) LOAD_FUNCPTR(vkCreateXlibSurfaceKHR) LOAD_FUNCPTR(vkDestroyInstance) LOAD_FUNCPTR(vkDestroySurfaceKHR) +LOAD_FUNCPTR(vkDestroySwapchainKHR) LOAD_FUNCPTR(vkGetDeviceProcAddr) LOAD_FUNCPTR(vkGetInstanceProcAddr) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) @@ -109,6 +117,8 @@ LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceFormatsKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfacePresentModesKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceSurfaceSupportKHR) LOAD_FUNCPTR(vkGetPhysicalDeviceXlibPresentationSupportKHR) +LOAD_FUNCPTR(vkGetSwapchainImagesKHR) +LOAD_FUNCPTR(vkQueuePresentKHR) #undef LOAD_FUNCPTR
return TRUE; @@ -179,11 +189,11 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *index) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s, 0x%s, %p\n", device, + TRACE("%p, 0x%s, 0x%s, 0x%s, 0x%s, %p\n", device, wine_dbgstr_longlong(swapchain), wine_dbgstr_longlong(timeout), wine_dbgstr_longlong(semaphore), wine_dbgstr_longlong(fence), index);
- return VK_ERROR_OUT_OF_HOST_MEMORY; + return pvkAcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, index); }
static VkResult X11DRV_vkCreateInstance(const VkInstanceCreateInfo *create_info, @@ -217,8 +227,17 @@ static VkResult X11DRV_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *create_info, const VkAllocationCallbacks *allocator, VkSwapchainKHR *swapchain) { - FIXME("stub: %p %p %p %p\n", device, create_info, allocator, swapchain); - return VK_ERROR_OUT_OF_HOST_MEMORY; + VkSwapchainCreateInfoKHR create_info_host; + TRACE("%p %p %p %p\n", device, create_info, allocator, swapchain); + + if (allocator) + FIXME("Support for allocation callbacks not implemented yet\n"); + + create_info_host = *create_info; + create_info_host.surface = surface_from_handle(create_info->surface)->surface; + + return pvkCreateSwapchainKHR(device, &create_info_host, NULL /* allocator */, + swapchain); }
static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance, @@ -304,7 +323,12 @@ static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *allocator) { - FIXME("stub: %p, 0x%s %p\n", device, wine_dbgstr_longlong(swapchain), allocator); + TRACE("%p, 0x%s %p\n", device, wine_dbgstr_longlong(swapchain), allocator); + + if (allocator) + FIXME("Support for allocation callbacks not implemented yet\n"); + + pvkDestroySwapchainKHR(device, swapchain, NULL /* allocator */); }
static VkResult X11DRV_vkEnumerateInstanceExtensionProperties(const char *layer_name, @@ -425,14 +449,14 @@ static VkBool32 X11DRV_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysical static VkResult X11DRV_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *count, VkImage *images) { - FIXME("stub: %p, 0x%s %p %p\n", device, wine_dbgstr_longlong(swapchain), count, images); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s %p %p\n", device, wine_dbgstr_longlong(swapchain), count, images); + return pvkGetSwapchainImagesKHR(device, swapchain, count, images); }
static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info) { - FIXME("stub: %p, %p\n", queue, present_info); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p\n", queue, present_info); + return pvkQueuePresentKHR(queue, present_info); }
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 4 +- dlls/winevulkan/vulkan.c | 96 +++++++++++++++++++++++++++++++++++++++- dlls/winevulkan/vulkan_private.h | 13 ++++++ dlls/winevulkan/vulkan_thunks.c | 5 --- dlls/winevulkan/vulkan_thunks.h | 1 + 5 files changed, 109 insertions(+), 10 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index ddae964457..24160997ec 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -113,6 +113,7 @@ FUNCTION_OVERRIDES = { # Device functions "vkDestroyDevice" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : False}, + "vkGetDeviceQueue" : {"dispatch": True, "driver" : False, "thunk" : False},
# VK_KHR_surface "vkDestroySurfaceKHR" : {"dispatch" : True, "driver" : True, "thunk" : False}, @@ -396,9 +397,6 @@ class VkFunction(object): if self.name == "vkCreateSwapchainKHR": return False
- if self.params[0].type != "VkPhysicalDevice": - return True - if self.is_device_func(): return True
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 7b0a15f2af..556f6a20ac 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -52,6 +52,36 @@ static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev);
static const struct vulkan_funcs *vk_funcs = NULL;
+/* Helper function to create queues for a given family index. */ +static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device, + uint32_t fam_index, uint32_t queue_count) +{ + unsigned int i; + + struct VkQueue_T *queues = heap_calloc(queue_count, sizeof(struct VkQueue_T)); + if (!queues) + { + ERR("Failed to allocate memory for queues\n"); + return NULL; + } + + for (i = 0; i < queue_count; i++) + { + struct VkQueue_T *queue = &queues[i]; + queue->device = device; + + /* The native device was already allocated with the required number of queues, + * so just fetch them from there. + */ + device->funcs.p_vkGetDeviceQueue(device->device, fam_index, i, &queue->queue); + + /* Set special header for ICD loader. */ + ((struct wine_vk_base*)queue)->loader_magic = VULKAN_ICD_MAGIC_VALUE; + } + + return queues; +} + /* Helper function used for freeing a device structure. This function supports full * and partial object cleanups and can thus be used for vkCreateDevice failures. */ @@ -60,6 +90,21 @@ static void wine_vk_device_free(struct VkDevice_T *device) if (!device) return;
+ if (device->queues) + { + unsigned int i; + for (i = 0; i < device->max_queue_families; i++) + { + if (device->queues[i]) + heap_free(device->queues[i]); + } + heap_free(device->queues); + device->queues = NULL; + } + + if (device->queue_count) + heap_free(device->queue_count); + if (device->device && device->funcs.p_vkDestroyDevice) { device->funcs.p_vkDestroyDevice(device->device, NULL /* pAllocator */); @@ -328,14 +373,14 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, const VkAllocationCallbacks *allocator, VkDevice *device) { struct VkDevice_T *object = NULL; + uint32_t max_queue_families; VkResult res; + unsigned int i;
TRACE("%p %p %p %p\n", phys_dev, create_info, allocator, device);
if (allocator) - { FIXME("Support for allocation callbacks not implemented yet\n"); - }
object = heap_alloc_zero(sizeof(*object)); if (!object) @@ -367,6 +412,45 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, ALL_VK_DEVICE_FUNCS() #undef USE_VK_FUNC
+ /* We need to cache all queues within the device as each requires wrapping since queues are + * dispatchable objects. + */ + phys_dev->instance->funcs.p_vkGetPhysicalDeviceQueueFamilyProperties(phys_dev->phys_dev, + &max_queue_families, NULL); + object->max_queue_families = max_queue_families; + TRACE("Max queue families: %d\n", object->max_queue_families); + + object->queues = heap_calloc(max_queue_families, sizeof(*object->queues)); + if (!object->queues) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto err; + } + + object->queue_count = heap_calloc(max_queue_families, sizeof(*object->queue_count)); + if (!object->queue_count) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + goto err; + } + + for (i = 0; i < create_info->queueCreateInfoCount; i++) + { + uint32_t fam_index = create_info->pQueueCreateInfos[i].queueFamilyIndex; + uint32_t queue_count = create_info->pQueueCreateInfos[i].queueCount; + + TRACE("queueFamilyIndex %d, queueCount %d\n", fam_index, queue_count); + + object->queues[fam_index] = wine_vk_device_alloc_queues(object, fam_index, queue_count); + if (!object->queues[fam_index]) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + ERR("Failed to allocate memory for queues\n"); + goto err; + } + object->queue_count[fam_index] = queue_count; + } + *device = object; return VK_SUCCESS;
@@ -660,6 +744,14 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char * return NULL; }
+void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t family_index, + uint32_t queue_index, VkQueue *queue) +{ + TRACE("%p %u %u %p\n", device, family_index, queue_index, queue); + + *queue = &device->queues[family_index][queue_index]; +} + static PFN_vkVoidFunction WINAPI wine_vkGetInstanceProcAddr(VkInstance instance, const char *name) { void *func; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index d49366fa5f..d9791cb14d 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -53,6 +53,12 @@ struct VkDevice_T struct wine_vk_base base; struct vulkan_device_funcs funcs; struct VkPhysicalDevice_T *phys_dev; /* parent */ + + uint32_t max_queue_families; + struct VkQueue_T **queues; + /* Stores number of queues per queue family */ + uint32_t *queue_count; + VkDevice device; /* native device */ };
@@ -81,4 +87,11 @@ struct VkPhysicalDevice_T VkPhysicalDevice phys_dev; /* native physical device */ };
+struct VkQueue_T +{ + struct wine_vk_base base; + VkDevice device; /* parent */ + VkQueue queue; /* native queue */ +}; + #endif /* __WINE_VULKAN_PRIVATE_H */ diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 51de005a7f..792f90e764 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -685,11 +685,6 @@ static void WINAPI wine_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMem FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pCommittedMemoryInBytes); }
-static void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) -{ - FIXME("stub: %p, %u, %u, %p\n", device, queueFamilyIndex, queueIndex, pQueue); -} - static VkResult WINAPI wine_vkGetEventStatus(VkDevice device, VkEvent event) { FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(event)); diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 13c1228196..7be86bfa6f 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -26,6 +26,7 @@ void WINAPI wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) DECLSPEC_HIDDEN; PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName) DECLSPEC_HIDDEN; +void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) DECLSPEC_HIDDEN;
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 16 +- dlls/winevulkan/vulkan_thunks.c | 753 ++++++++++++++++++++++++++++++++++------ dlls/winevulkan/vulkan_thunks.h | 232 +++++++++++++ 3 files changed, 894 insertions(+), 107 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 24160997ec..81d0e55c6b 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -397,7 +397,10 @@ class VkFunction(object): if self.name == "vkCreateSwapchainKHR": return False
- if self.is_device_func(): + if self.name in ["vkAllocateCommandBuffers", "vkFreeCommandBuffers"]: + return True + + if self.params[0].type in ["VkCommandBuffer", "VkQueue"]: return True
return False @@ -1863,7 +1866,16 @@ class VkGenerator(object): LOGGER.debug("skipping {0} in vulkan_device_funcs".format(vk_func.name)) continue
- f.write(" {0};\n".format(vk_func.pfn(conv=False))) + # Temporary filter out functions, which need conversion, but for which + # we are only implemented stubs at this point. + if not vk_func.needs_stub() and vk_func.needs_conversion(): + f.write("#if defined(USE_STRUCT_CONVERSION)\n") + f.write(" {0};\n".format(vk_func.pfn(conv=True))) + f.write("#else\n") + f.write(" {0};\n".format(vk_func.pfn(conv=False))) + f.write("#endif\n") + else: + f.write(" {0};\n".format(vk_func.pfn(conv=False))) f.write("};\n\n")
f.write("/* For use by vkInstance and children */\n") diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 792f90e764..130d91f321 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -12,6 +12,248 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#if defined(USE_STRUCT_CONVERSION) +static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->descriptorPool = in->descriptorPool; + out->descriptorSetCount = in->descriptorSetCount; + out->pSetLayouts = in->pSetLayouts; +} + +static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAllocateInfo *in, VkMemoryAllocateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->allocationSize = in->allocationSize; + out->memoryTypeIndex = in->memoryTypeIndex; +} + +static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->size = in->size; + out->usage = in->usage; + out->sharingMode = in->sharingMode; + out->queueFamilyIndexCount = in->queueFamilyIndexCount; + out->pQueueFamilyIndices = in->pQueueFamilyIndices; +} + +static inline void convert_VkBufferViewCreateInfo_win_to_host(const VkBufferViewCreateInfo *in, VkBufferViewCreateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->buffer = in->buffer; + out->format = in->format; + out->offset = in->offset; + out->range = in->range; +} + +static inline void convert_VkPipelineShaderStageCreateInfo_win_to_host(const VkPipelineShaderStageCreateInfo *in, VkPipelineShaderStageCreateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->stage = in->stage; + out->module = in->module; + out->pName = in->pName; + out->pSpecializationInfo = in->pSpecializationInfo; +} + +static inline VkComputePipelineCreateInfo_host * convert_VkComputePipelineCreateInfo_array_win_to_host(const VkComputePipelineCreateInfo *in, uint32_t count) +{ + VkComputePipelineCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkComputePipelineCreateInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].flags = in[i].flags; + convert_VkPipelineShaderStageCreateInfo_win_to_host(&in[i].stage, &out[i].stage); + out[i].layout = in[i].layout; + out[i].basePipelineHandle = in[i].basePipelineHandle; + out[i].basePipelineIndex = in[i].basePipelineIndex; + } + + return out; +} + +static inline void free_VkComputePipelineCreateInfo_array(VkComputePipelineCreateInfo_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline void convert_VkFramebufferCreateInfo_win_to_host(const VkFramebufferCreateInfo *in, VkFramebufferCreateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->renderPass = in->renderPass; + out->attachmentCount = in->attachmentCount; + out->pAttachments = in->pAttachments; + out->width = in->width; + out->height = in->height; + out->layers = in->layers; +} + +static inline VkPipelineShaderStageCreateInfo_host * convert_VkPipelineShaderStageCreateInfo_array_win_to_host(const VkPipelineShaderStageCreateInfo *in, uint32_t count) +{ + VkPipelineShaderStageCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkPipelineShaderStageCreateInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].flags = in[i].flags; + out[i].stage = in[i].stage; + out[i].module = in[i].module; + out[i].pName = in[i].pName; + out[i].pSpecializationInfo = in[i].pSpecializationInfo; + } + + return out; +} + +static inline void free_VkPipelineShaderStageCreateInfo_array(VkPipelineShaderStageCreateInfo_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkGraphicsPipelineCreateInfo_host * convert_VkGraphicsPipelineCreateInfo_array_win_to_host(const VkGraphicsPipelineCreateInfo *in, uint32_t count) +{ + VkGraphicsPipelineCreateInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkGraphicsPipelineCreateInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].flags = in[i].flags; + out[i].stageCount = in[i].stageCount; + out[i].pStages = convert_VkPipelineShaderStageCreateInfo_array_win_to_host(in[i].pStages, in[i].stageCount); + out[i].pVertexInputState = in[i].pVertexInputState; + out[i].pInputAssemblyState = in[i].pInputAssemblyState; + out[i].pTessellationState = in[i].pTessellationState; + out[i].pViewportState = in[i].pViewportState; + out[i].pRasterizationState = in[i].pRasterizationState; + out[i].pMultisampleState = in[i].pMultisampleState; + out[i].pDepthStencilState = in[i].pDepthStencilState; + out[i].pColorBlendState = in[i].pColorBlendState; + out[i].pDynamicState = in[i].pDynamicState; + out[i].layout = in[i].layout; + out[i].renderPass = in[i].renderPass; + out[i].subpass = in[i].subpass; + out[i].basePipelineHandle = in[i].basePipelineHandle; + out[i].basePipelineIndex = in[i].basePipelineIndex; + } + + return out; +} + +static inline void free_VkGraphicsPipelineCreateInfo_array(VkGraphicsPipelineCreateInfo_host *in, uint32_t count) +{ + unsigned int i; + + if (!in) return; + + for (i = 0; i < count; i++) + { + free_VkPipelineShaderStageCreateInfo_array((VkPipelineShaderStageCreateInfo_host *)in[i].pStages, in[i].stageCount); + } + heap_free(in); +} + +static inline void convert_VkImageViewCreateInfo_win_to_host(const VkImageViewCreateInfo *in, VkImageViewCreateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->image = in->image; + out->viewType = in->viewType; + out->format = in->format; + out->components = in->components; + out->subresourceRange = in->subresourceRange; +} + +static inline VkMappedMemoryRange_host * convert_VkMappedMemoryRange_array_win_to_host(const VkMappedMemoryRange *in, uint32_t count) +{ + VkMappedMemoryRange_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkMappedMemoryRange_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].memory = in[i].memory; + out[i].offset = in[i].offset; + out[i].size = in[i].size; + } + + return out; +} + +static inline void free_VkMappedMemoryRange_array(VkMappedMemoryRange_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline void convert_VkMemoryRequirements_host_to_win(const VkMemoryRequirements_host *in, VkMemoryRequirements *out) +{ + if (!in) return; + + out->size = in->size; + out->alignment = in->alignment; + out->memoryTypeBits = in->memoryTypeBits; +} + +static inline void convert_VkSubresourceLayout_host_to_win(const VkSubresourceLayout_host *in, VkSubresourceLayout *out) +{ + if (!in) return; + + out->offset = in->offset; + out->size = in->size; + out->rowPitch = in->rowPitch; + out->arrayPitch = in->arrayPitch; + out->depthPitch = in->depthPitch; +} + static inline void convert_VkImageFormatProperties_host_to_win(const VkImageFormatProperties_host *in, VkImageFormatProperties *out) { if (!in) return; @@ -173,6 +415,126 @@ static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysic out->sparseProperties = in->sparseProperties; }
+static inline VkDescriptorImageInfo_host * convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count) +{ + VkDescriptorImageInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkDescriptorImageInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sampler = in[i].sampler; + out[i].imageView = in[i].imageView; + out[i].imageLayout = in[i].imageLayout; + } + + return out; +} + +static inline void free_VkDescriptorImageInfo_array(VkDescriptorImageInfo_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkDescriptorBufferInfo_host * convert_VkDescriptorBufferInfo_array_win_to_host(const VkDescriptorBufferInfo *in, uint32_t count) +{ + VkDescriptorBufferInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkDescriptorBufferInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].buffer = in[i].buffer; + out[i].offset = in[i].offset; + out[i].range = in[i].range; + } + + return out; +} + +static inline void free_VkDescriptorBufferInfo_array(VkDescriptorBufferInfo_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkWriteDescriptorSet_host * convert_VkWriteDescriptorSet_array_win_to_host(const VkWriteDescriptorSet *in, uint32_t count) +{ + VkWriteDescriptorSet_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkWriteDescriptorSet_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].dstSet = in[i].dstSet; + out[i].dstBinding = in[i].dstBinding; + out[i].dstArrayElement = in[i].dstArrayElement; + out[i].descriptorCount = in[i].descriptorCount; + out[i].descriptorType = in[i].descriptorType; + out[i].pImageInfo = convert_VkDescriptorImageInfo_array_win_to_host(in[i].pImageInfo, in[i].descriptorCount); + out[i].pBufferInfo = convert_VkDescriptorBufferInfo_array_win_to_host(in[i].pBufferInfo, in[i].descriptorCount); + out[i].pTexelBufferView = in[i].pTexelBufferView; + } + + return out; +} + +static inline void free_VkWriteDescriptorSet_array(VkWriteDescriptorSet_host *in, uint32_t count) +{ + unsigned int i; + + if (!in) return; + + for (i = 0; i < count; i++) + { + free_VkDescriptorImageInfo_array((VkDescriptorImageInfo_host *)in[i].pImageInfo, in[i].descriptorCount); + free_VkDescriptorBufferInfo_array((VkDescriptorBufferInfo_host *)in[i].pBufferInfo, in[i].descriptorCount); + } + heap_free(in); +} + +static inline VkCopyDescriptorSet_host * convert_VkCopyDescriptorSet_array_win_to_host(const VkCopyDescriptorSet *in, uint32_t count) +{ + VkCopyDescriptorSet_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkCopyDescriptorSet_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].srcSet = in[i].srcSet; + out[i].srcBinding = in[i].srcBinding; + out[i].srcArrayElement = in[i].srcArrayElement; + out[i].dstSet = in[i].dstSet; + out[i].dstBinding = in[i].dstBinding; + out[i].dstArrayElement = in[i].dstArrayElement; + out[i].descriptorCount = in[i].descriptorCount; + } + + return out; +} + +static inline void free_VkCopyDescriptorSet_array(VkCopyDescriptorSet_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + #endif /* USE_STRUCT_CONVERSION */
static VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) @@ -183,14 +545,36 @@ static VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCo
static VkResult WINAPI wine_vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) { - FIXME("stub: %p, %p, %p\n", device, pAllocateInfo, pDescriptorSets); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkDescriptorSetAllocateInfo_host pAllocateInfo_host; + TRACE("%p, %p, %p\n", device, pAllocateInfo, pDescriptorSets); + + convert_VkDescriptorSetAllocateInfo_win_to_host(pAllocateInfo, &pAllocateInfo_host); + result = device->funcs.p_vkAllocateDescriptorSets(device->device, &pAllocateInfo_host, pDescriptorSets); + + return result; +#else + TRACE("%p, %p, %p\n", device, pAllocateInfo, pDescriptorSets); + return device->funcs.p_vkAllocateDescriptorSets(device->device, pAllocateInfo, pDescriptorSets); +#endif }
static VkResult WINAPI wine_vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { - FIXME("stub: %p, %p, %p, %p\n", device, pAllocateInfo, pAllocator, pMemory); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkMemoryAllocateInfo_host pAllocateInfo_host; + TRACE("%p, %p, %p, %p\n", device, pAllocateInfo, pAllocator, pMemory); + + convert_VkMemoryAllocateInfo_win_to_host(pAllocateInfo, &pAllocateInfo_host); + result = device->funcs.p_vkAllocateMemory(device->device, &pAllocateInfo_host, NULL, pMemory); + + return result; +#else + TRACE("%p, %p, %p, %p\n", device, pAllocateInfo, pAllocator, pMemory); + return device->funcs.p_vkAllocateMemory(device->device, pAllocateInfo, NULL, pMemory); +#endif }
static VkResult WINAPI wine_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) @@ -201,14 +585,14 @@ static VkResult WINAPI wine_vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
static VkResult WINAPI wine_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s\n", device, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(memory), wine_dbgstr_longlong(memoryOffset)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, 0x%s, 0x%s\n", device, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(memory), wine_dbgstr_longlong(memoryOffset)); + return device->funcs.p_vkBindBufferMemory(device->device, buffer, memory, memoryOffset); }
static VkResult WINAPI wine_vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s\n", device, wine_dbgstr_longlong(image), wine_dbgstr_longlong(memory), wine_dbgstr_longlong(memoryOffset)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, 0x%s, 0x%s\n", device, wine_dbgstr_longlong(image), wine_dbgstr_longlong(memory), wine_dbgstr_longlong(memoryOffset)); + return device->funcs.p_vkBindImageMemory(device->device, image, memory, memoryOffset); }
static void WINAPI wine_vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) @@ -433,212 +817,298 @@ static void WINAPI wine_vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPip
static VkResult WINAPI wine_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pBuffer); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkBufferCreateInfo_host pCreateInfo_host; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pBuffer); + + convert_VkBufferCreateInfo_win_to_host(pCreateInfo, &pCreateInfo_host); + result = device->funcs.p_vkCreateBuffer(device->device, &pCreateInfo_host, NULL, pBuffer); + + return result; +#else + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pBuffer); + return device->funcs.p_vkCreateBuffer(device->device, pCreateInfo, NULL, pBuffer); +#endif }
static VkResult WINAPI wine_vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkBufferViewCreateInfo_host pCreateInfo_host; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); + + convert_VkBufferViewCreateInfo_win_to_host(pCreateInfo, &pCreateInfo_host); + result = device->funcs.p_vkCreateBufferView(device->device, &pCreateInfo_host, NULL, pView); + + return result; +#else + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); + return device->funcs.p_vkCreateBufferView(device->device, pCreateInfo, NULL, pView); +#endif }
static VkResult WINAPI wine_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pCommandPool); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pCommandPool); + return device->funcs.p_vkCreateCommandPool(device->device, pCreateInfo, NULL, pCommandPool); }
static VkResult WINAPI wine_vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { - FIXME("stub: %p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkComputePipelineCreateInfo_host *pCreateInfos_host; + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); + + pCreateInfos_host = convert_VkComputePipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount); + result = device->funcs.p_vkCreateComputePipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines); + + free_VkComputePipelineCreateInfo_array(pCreateInfos_host, createInfoCount); + return result; +#else + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); + return device->funcs.p_vkCreateComputePipelines(device->device, pipelineCache, createInfoCount, pCreateInfos, NULL, pPipelines); +#endif }
static VkResult WINAPI wine_vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pDescriptorPool); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pDescriptorPool); + return device->funcs.p_vkCreateDescriptorPool(device->device, pCreateInfo, NULL, pDescriptorPool); }
static VkResult WINAPI wine_vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSetLayout); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSetLayout); + return device->funcs.p_vkCreateDescriptorSetLayout(device->device, pCreateInfo, NULL, pSetLayout); }
static VkResult WINAPI wine_vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pEvent); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pEvent); + return device->funcs.p_vkCreateEvent(device->device, pCreateInfo, NULL, pEvent); }
static VkResult WINAPI wine_vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pFence); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pFence); + return device->funcs.p_vkCreateFence(device->device, pCreateInfo, NULL, pFence); }
static VkResult WINAPI wine_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pFramebuffer); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkFramebufferCreateInfo_host pCreateInfo_host; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pFramebuffer); + + convert_VkFramebufferCreateInfo_win_to_host(pCreateInfo, &pCreateInfo_host); + result = device->funcs.p_vkCreateFramebuffer(device->device, &pCreateInfo_host, NULL, pFramebuffer); + + return result; +#else + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pFramebuffer); + return device->funcs.p_vkCreateFramebuffer(device->device, pCreateInfo, NULL, pFramebuffer); +#endif }
static VkResult WINAPI wine_vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) { - FIXME("stub: %p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkGraphicsPipelineCreateInfo_host *pCreateInfos_host; + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); + + pCreateInfos_host = convert_VkGraphicsPipelineCreateInfo_array_win_to_host(pCreateInfos, createInfoCount); + result = device->funcs.p_vkCreateGraphicsPipelines(device->device, pipelineCache, createInfoCount, pCreateInfos_host, NULL, pPipelines); + + free_VkGraphicsPipelineCreateInfo_array(pCreateInfos_host, createInfoCount); + return result; +#else + TRACE("%p, 0x%s, %u, %p, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), createInfoCount, pCreateInfos, pAllocator, pPipelines); + return device->funcs.p_vkCreateGraphicsPipelines(device->device, pipelineCache, createInfoCount, pCreateInfos, NULL, pPipelines); +#endif }
static VkResult WINAPI wine_vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pImage); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pImage); + return device->funcs.p_vkCreateImage(device->device, pCreateInfo, NULL, pImage); }
static VkResult WINAPI wine_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkImageViewCreateInfo_host pCreateInfo_host; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); + + convert_VkImageViewCreateInfo_win_to_host(pCreateInfo, &pCreateInfo_host); + result = device->funcs.p_vkCreateImageView(device->device, &pCreateInfo_host, NULL, pView); + + return result; +#else + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pView); + return device->funcs.p_vkCreateImageView(device->device, pCreateInfo, NULL, pView); +#endif }
static VkResult WINAPI wine_vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pPipelineCache); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pPipelineCache); + return device->funcs.p_vkCreatePipelineCache(device->device, pCreateInfo, NULL, pPipelineCache); }
static VkResult WINAPI wine_vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pPipelineLayout); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pPipelineLayout); + return device->funcs.p_vkCreatePipelineLayout(device->device, pCreateInfo, NULL, pPipelineLayout); }
static VkResult WINAPI wine_vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pQueryPool); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pQueryPool); + return device->funcs.p_vkCreateQueryPool(device->device, pCreateInfo, NULL, pQueryPool); }
static VkResult WINAPI wine_vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pRenderPass); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pRenderPass); + return device->funcs.p_vkCreateRenderPass(device->device, pCreateInfo, NULL, pRenderPass); }
static VkResult WINAPI wine_vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSampler); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSampler); + return device->funcs.p_vkCreateSampler(device->device, pCreateInfo, NULL, pSampler); }
static VkResult WINAPI wine_vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSemaphore); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pSemaphore); + return device->funcs.p_vkCreateSemaphore(device->device, pCreateInfo, NULL, pSemaphore); }
static VkResult WINAPI wine_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) { - FIXME("stub: %p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pShaderModule); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %p, %p, %p\n", device, pCreateInfo, pAllocator, pShaderModule); + return device->funcs.p_vkCreateShaderModule(device->device, pCreateInfo, NULL, pShaderModule); }
static void WINAPI wine_vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(buffer), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(buffer), pAllocator); + device->funcs.p_vkDestroyBuffer(device->device, buffer, NULL); }
static void WINAPI wine_vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(bufferView), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(bufferView), pAllocator); + device->funcs.p_vkDestroyBufferView(device->device, bufferView, NULL); }
static void WINAPI wine_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(commandPool), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(commandPool), pAllocator); + device->funcs.p_vkDestroyCommandPool(device->device, commandPool, NULL); }
static void WINAPI wine_vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(descriptorPool), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(descriptorPool), pAllocator); + device->funcs.p_vkDestroyDescriptorPool(device->device, descriptorPool, NULL); }
static void WINAPI wine_vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(descriptorSetLayout), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(descriptorSetLayout), pAllocator); + device->funcs.p_vkDestroyDescriptorSetLayout(device->device, descriptorSetLayout, NULL); }
static void WINAPI wine_vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(event), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(event), pAllocator); + device->funcs.p_vkDestroyEvent(device->device, event, NULL); }
static void WINAPI wine_vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(fence), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(fence), pAllocator); + device->funcs.p_vkDestroyFence(device->device, fence, NULL); }
static void WINAPI wine_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(framebuffer), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(framebuffer), pAllocator); + device->funcs.p_vkDestroyFramebuffer(device->device, framebuffer, NULL); }
static void WINAPI wine_vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(image), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(image), pAllocator); + device->funcs.p_vkDestroyImage(device->device, image, NULL); }
static void WINAPI wine_vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(imageView), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(imageView), pAllocator); + device->funcs.p_vkDestroyImageView(device->device, imageView, NULL); }
static void WINAPI wine_vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipeline), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipeline), pAllocator); + device->funcs.p_vkDestroyPipeline(device->device, pipeline, NULL); }
static void WINAPI wine_vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipelineCache), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipelineCache), pAllocator); + device->funcs.p_vkDestroyPipelineCache(device->device, pipelineCache, NULL); }
static void WINAPI wine_vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipelineLayout), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(pipelineLayout), pAllocator); + device->funcs.p_vkDestroyPipelineLayout(device->device, pipelineLayout, NULL); }
static void WINAPI wine_vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(queryPool), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(queryPool), pAllocator); + device->funcs.p_vkDestroyQueryPool(device->device, queryPool, NULL); }
static void WINAPI wine_vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(renderPass), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(renderPass), pAllocator); + device->funcs.p_vkDestroyRenderPass(device->device, renderPass, NULL); }
static void WINAPI wine_vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(sampler), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(sampler), pAllocator); + device->funcs.p_vkDestroySampler(device->device, sampler, NULL); }
static void WINAPI wine_vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(semaphore), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(semaphore), pAllocator); + device->funcs.p_vkDestroySemaphore(device->device, semaphore, NULL); }
static void WINAPI wine_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(shaderModule), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(shaderModule), pAllocator); + device->funcs.p_vkDestroyShaderModule(device->device, shaderModule, NULL); }
static VkResult WINAPI wine_vkDeviceWaitIdle(VkDevice device) { - FIXME("stub: %p\n", device); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p\n", device); + return device->funcs.p_vkDeviceWaitIdle(device->device); }
static VkResult WINAPI wine_vkEndCommandBuffer(VkCommandBuffer commandBuffer) @@ -655,8 +1125,20 @@ static VkResult WINAPI wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice ph
static VkResult WINAPI wine_vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) { - FIXME("stub: %p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkMappedMemoryRange_host *pMemoryRanges_host; + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); + + pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount); + result = device->funcs.p_vkFlushMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host); + + free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount); + return result; +#else + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); + return device->funcs.p_vkFlushMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges); +#endif }
static void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) @@ -666,50 +1148,83 @@ static void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool comm
static VkResult WINAPI wine_vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) { - FIXME("stub: %p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(descriptorPool), descriptorSetCount, pDescriptorSets); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(descriptorPool), descriptorSetCount, pDescriptorSets); + return device->funcs.p_vkFreeDescriptorSets(device->device, descriptorPool, descriptorSetCount, pDescriptorSets); }
static void WINAPI wine_vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pAllocator); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pAllocator); + device->funcs.p_vkFreeMemory(device->device, memory, NULL); }
static void WINAPI wine_vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(buffer), pMemoryRequirements); +#if defined(USE_STRUCT_CONVERSION) + VkMemoryRequirements_host pMemoryRequirements_host; + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(buffer), pMemoryRequirements); + + device->funcs.p_vkGetBufferMemoryRequirements(device->device, buffer, &pMemoryRequirements_host); + + convert_VkMemoryRequirements_host_to_win(&pMemoryRequirements_host, pMemoryRequirements); +#else + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(buffer), pMemoryRequirements); + device->funcs.p_vkGetBufferMemoryRequirements(device->device, buffer, pMemoryRequirements); +#endif }
static void WINAPI wine_vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pCommittedMemoryInBytes); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(memory), pCommittedMemoryInBytes); + device->funcs.p_vkGetDeviceMemoryCommitment(device->device, memory, pCommittedMemoryInBytes); }
static VkResult WINAPI wine_vkGetEventStatus(VkDevice device, VkEvent event) { - FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(event)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s\n", device, wine_dbgstr_longlong(event)); + return device->funcs.p_vkGetEventStatus(device->device, event); }
static VkResult WINAPI wine_vkGetFenceStatus(VkDevice device, VkFence fence) { - FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(fence)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s\n", device, wine_dbgstr_longlong(fence)); + return device->funcs.p_vkGetFenceStatus(device->device, fence); }
static void WINAPI wine_vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(image), pMemoryRequirements); +#if defined(USE_STRUCT_CONVERSION) + VkMemoryRequirements_host pMemoryRequirements_host; + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(image), pMemoryRequirements); + + device->funcs.p_vkGetImageMemoryRequirements(device->device, image, &pMemoryRequirements_host); + + convert_VkMemoryRequirements_host_to_win(&pMemoryRequirements_host, pMemoryRequirements); +#else + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(image), pMemoryRequirements); + device->funcs.p_vkGetImageMemoryRequirements(device->device, image, pMemoryRequirements); +#endif }
static void WINAPI wine_vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { - FIXME("stub: %p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(image), pSparseMemoryRequirementCount, pSparseMemoryRequirements); + TRACE("%p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(image), pSparseMemoryRequirementCount, pSparseMemoryRequirements); + device->funcs.p_vkGetImageSparseMemoryRequirements(device->device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); }
static void WINAPI wine_vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout) { - FIXME("stub: %p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(image), pSubresource, pLayout); +#if defined(USE_STRUCT_CONVERSION) + VkSubresourceLayout_host pLayout_host; + TRACE("%p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(image), pSubresource, pLayout); + + device->funcs.p_vkGetImageSubresourceLayout(device->device, image, pSubresource, &pLayout_host); + + convert_VkSubresourceLayout_host_to_win(&pLayout_host, pLayout); +#else + TRACE("%p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(image), pSubresource, pLayout); + device->funcs.p_vkGetImageSubresourceLayout(device->device, image, pSubresource, pLayout); +#endif }
static void WINAPI wine_vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) @@ -785,37 +1300,50 @@ static void WINAPI wine_vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysica
static VkResult WINAPI wine_vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) { - FIXME("stub: %p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), pDataSize, pData); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %p, %p\n", device, wine_dbgstr_longlong(pipelineCache), pDataSize, pData); + return device->funcs.p_vkGetPipelineCacheData(device->device, pipelineCache, pDataSize, pData); }
static VkResult WINAPI wine_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) { - FIXME("stub: %p, 0x%s, %u, %u, 0x%s, %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dataSize), pData, wine_dbgstr_longlong(stride), flags); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %u, %u, 0x%s, %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dataSize), pData, wine_dbgstr_longlong(stride), flags); + return device->funcs.p_vkGetQueryPoolResults(device->device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); }
static void WINAPI wine_vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) { - FIXME("stub: %p, 0x%s, %p\n", device, wine_dbgstr_longlong(renderPass), pGranularity); + TRACE("%p, 0x%s, %p\n", device, wine_dbgstr_longlong(renderPass), pGranularity); + device->funcs.p_vkGetRenderAreaGranularity(device->device, renderPass, pGranularity); }
static VkResult WINAPI wine_vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) { - FIXME("stub: %p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkMappedMemoryRange_host *pMemoryRanges_host; + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); + + pMemoryRanges_host = convert_VkMappedMemoryRange_array_win_to_host(pMemoryRanges, memoryRangeCount); + result = device->funcs.p_vkInvalidateMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges_host); + + free_VkMappedMemoryRange_array(pMemoryRanges_host, memoryRangeCount); + return result; +#else + TRACE("%p, %u, %p\n", device, memoryRangeCount, pMemoryRanges); + return device->funcs.p_vkInvalidateMappedMemoryRanges(device->device, memoryRangeCount, pMemoryRanges); +#endif }
static VkResult WINAPI wine_vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s, %#x, %p\n", device, wine_dbgstr_longlong(memory), wine_dbgstr_longlong(offset), wine_dbgstr_longlong(size), flags, ppData); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, 0x%s, 0x%s, %#x, %p\n", device, wine_dbgstr_longlong(memory), wine_dbgstr_longlong(offset), wine_dbgstr_longlong(size), flags, ppData); + return device->funcs.p_vkMapMemory(device->device, memory, offset, size, flags, ppData); }
static VkResult WINAPI wine_vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) { - FIXME("stub: %p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(dstCache), srcCacheCount, pSrcCaches); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(dstCache), srcCacheCount, pSrcCaches); + return device->funcs.p_vkMergePipelineCaches(device->device, dstCache, srcCacheCount, pSrcCaches); }
static VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) @@ -844,48 +1372,63 @@ static VkResult WINAPI wine_vkResetCommandBuffer(VkCommandBuffer commandBuffer,
static VkResult WINAPI wine_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) { - FIXME("stub: %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(commandPool), flags); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %#x\n", device, wine_dbgstr_longlong(commandPool), flags); + return device->funcs.p_vkResetCommandPool(device->device, commandPool, flags); }
static VkResult WINAPI wine_vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) { - FIXME("stub: %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(descriptorPool), flags); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s, %#x\n", device, wine_dbgstr_longlong(descriptorPool), flags); + return device->funcs.p_vkResetDescriptorPool(device->device, descriptorPool, flags); }
static VkResult WINAPI wine_vkResetEvent(VkDevice device, VkEvent event) { - FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(event)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s\n", device, wine_dbgstr_longlong(event)); + return device->funcs.p_vkResetEvent(device->device, event); }
static VkResult WINAPI wine_vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { - FIXME("stub: %p, %u, %p\n", device, fenceCount, pFences); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %u, %p\n", device, fenceCount, pFences); + return device->funcs.p_vkResetFences(device->device, fenceCount, pFences); }
static VkResult WINAPI wine_vkSetEvent(VkDevice device, VkEvent event) { - FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(event)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, 0x%s\n", device, wine_dbgstr_longlong(event)); + return device->funcs.p_vkSetEvent(device->device, event); }
static void WINAPI wine_vkUnmapMemory(VkDevice device, VkDeviceMemory memory) { - FIXME("stub: %p, 0x%s\n", device, wine_dbgstr_longlong(memory)); + TRACE("%p, 0x%s\n", device, wine_dbgstr_longlong(memory)); + device->funcs.p_vkUnmapMemory(device->device, memory); }
static void WINAPI wine_vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) { - FIXME("stub: %p, %u, %p, %u, %p\n", device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); +#if defined(USE_STRUCT_CONVERSION) + VkWriteDescriptorSet_host *pDescriptorWrites_host; + VkCopyDescriptorSet_host *pDescriptorCopies_host; + TRACE("%p, %u, %p, %u, %p\n", device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); + + pDescriptorWrites_host = convert_VkWriteDescriptorSet_array_win_to_host(pDescriptorWrites, descriptorWriteCount); + pDescriptorCopies_host = convert_VkCopyDescriptorSet_array_win_to_host(pDescriptorCopies, descriptorCopyCount); + device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites_host, descriptorCopyCount, pDescriptorCopies_host); + + free_VkWriteDescriptorSet_array(pDescriptorWrites_host, descriptorWriteCount); + free_VkCopyDescriptorSet_array(pDescriptorCopies_host, descriptorCopyCount); +#else + TRACE("%p, %u, %p, %u, %p\n", device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); + device->funcs.p_vkUpdateDescriptorSets(device->device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); +#endif }
static VkResult WINAPI wine_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout) { - FIXME("stub: %p, %u, %p, %u, 0x%s\n", device, fenceCount, pFences, waitAll, wine_dbgstr_longlong(timeout)); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %u, %p, %u, 0x%s\n", device, fenceCount, pFences, waitAll, wine_dbgstr_longlong(timeout)); + return device->funcs.p_vkWaitForFences(device->device, fenceCount, pFences, waitAll, timeout); }
static const struct vulkan_func vk_device_dispatch_table[] = diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 7be86bfa6f..20f68dc90e 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -35,6 +35,116 @@ VkBool32 WINAPI wine_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDe VkResult WINAPI wine_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) DECLSPEC_HIDDEN;
+typedef struct VkDescriptorSetAllocateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkDescriptorPool descriptorPool; + uint32_t descriptorSetCount; + const VkDescriptorSetLayout *pSetLayouts; +} VkDescriptorSetAllocateInfo_host; + +typedef struct VkMemoryAllocateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeIndex; +} VkMemoryAllocateInfo_host; + +typedef struct VkBufferCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkBufferCreateFlags flags; + VkDeviceSize size; + VkBufferUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t *pQueueFamilyIndices; +} VkBufferCreateInfo_host; + +typedef struct VkBufferViewCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkBufferViewCreateFlags flags; + VkBuffer buffer; + VkFormat format; + VkDeviceSize offset; + VkDeviceSize range; +} VkBufferViewCreateInfo_host; + +typedef struct VkPipelineShaderStageCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkPipelineShaderStageCreateFlags flags; + VkShaderStageFlagBits stage; + VkShaderModule module; + const char *pName; + const VkSpecializationInfo *pSpecializationInfo; +} VkPipelineShaderStageCreateInfo_host; + +typedef struct VkComputePipelineCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkPipelineCreateFlags flags; + VkPipelineShaderStageCreateInfo_host stage; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkComputePipelineCreateInfo_host; + +typedef struct VkFramebufferCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkFramebufferCreateFlags flags; + VkRenderPass renderPass; + uint32_t attachmentCount; + const VkImageView *pAttachments; + uint32_t width; + uint32_t height; + uint32_t layers; +} VkFramebufferCreateInfo_host; + +typedef struct VkGraphicsPipelineCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo_host *pStages; + const VkPipelineVertexInputStateCreateInfo *pVertexInputState; + const VkPipelineInputAssemblyStateCreateInfo *pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo *pTessellationState; + const VkPipelineViewportStateCreateInfo *pViewportState; + const VkPipelineRasterizationStateCreateInfo *pRasterizationState; + const VkPipelineMultisampleStateCreateInfo *pMultisampleState; + const VkPipelineDepthStencilStateCreateInfo *pDepthStencilState; + const VkPipelineColorBlendStateCreateInfo *pColorBlendState; + const VkPipelineDynamicStateCreateInfo *pDynamicState; + VkPipelineLayout layout; + VkRenderPass renderPass; + uint32_t subpass; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkGraphicsPipelineCreateInfo_host; + +typedef struct VkImageViewCreateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkImageViewCreateFlags flags; + VkImage image; + VkImageViewType viewType; + VkFormat format; + VkComponentMapping components; + VkImageSubresourceRange subresourceRange; +} VkImageViewCreateInfo_host; + typedef struct VkSwapchainCreateInfoKHR_host { VkStructureType sType; @@ -57,6 +167,31 @@ typedef struct VkSwapchainCreateInfoKHR_host VkSwapchainKHR oldSwapchain; } VkSwapchainCreateInfoKHR_host;
+typedef struct VkMappedMemoryRange_host +{ + VkStructureType sType; + const void *pNext; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMappedMemoryRange_host; + +typedef struct VkMemoryRequirements_host +{ + VkDeviceSize size; + VkDeviceSize alignment; + uint32_t memoryTypeBits; +} VkMemoryRequirements_host; + +typedef struct VkSubresourceLayout_host +{ + VkDeviceSize offset; + VkDeviceSize size; + VkDeviceSize rowPitch; + VkDeviceSize arrayPitch; + VkDeviceSize depthPitch; +} VkSubresourceLayout_host; + typedef struct VkImageFormatProperties_host { VkExtent3D maxExtent; @@ -203,13 +338,62 @@ typedef struct VkPhysicalDeviceProperties_host VkPhysicalDeviceSparseProperties sparseProperties; } VkPhysicalDeviceProperties_host;
+typedef struct VkDescriptorImageInfo_host +{ + VkSampler sampler; + VkImageView imageView; + VkImageLayout imageLayout; +} VkDescriptorImageInfo_host; + +typedef struct VkDescriptorBufferInfo_host +{ + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize range; +} VkDescriptorBufferInfo_host; + +typedef struct VkWriteDescriptorSet_host +{ + VkStructureType sType; + const void *pNext; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + const VkDescriptorImageInfo_host *pImageInfo; + const VkDescriptorBufferInfo_host *pBufferInfo; + const VkBufferView *pTexelBufferView; +} VkWriteDescriptorSet_host; + +typedef struct VkCopyDescriptorSet_host +{ + VkStructureType sType; + const void *pNext; + VkDescriptorSet srcSet; + uint32_t srcBinding; + uint32_t srcArrayElement; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; +} VkCopyDescriptorSet_host; +
/* For use by vkDevice and children */ struct vulkan_device_funcs { VkResult (*p_vkAllocateCommandBuffers)(VkDevice, const VkCommandBufferAllocateInfo *, VkCommandBuffer *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkAllocateDescriptorSets)(VkDevice, const VkDescriptorSetAllocateInfo_host *, VkDescriptorSet *); +#else VkResult (*p_vkAllocateDescriptorSets)(VkDevice, const VkDescriptorSetAllocateInfo *, VkDescriptorSet *); +#endif +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkAllocateMemory)(VkDevice, const VkMemoryAllocateInfo_host *, const VkAllocationCallbacks *, VkDeviceMemory *); +#else VkResult (*p_vkAllocateMemory)(VkDevice, const VkMemoryAllocateInfo *, const VkAllocationCallbacks *, VkDeviceMemory *); +#endif VkResult (*p_vkBeginCommandBuffer)(VkCommandBuffer, const VkCommandBufferBeginInfo *); VkResult (*p_vkBindBufferMemory)(VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize); VkResult (*p_vkBindImageMemory)(VkDevice, VkImage, VkDeviceMemory, VkDeviceSize); @@ -257,18 +441,42 @@ struct vulkan_device_funcs void (*p_vkCmdUpdateBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, const void *); void (*p_vkCmdWaitEvents)(VkCommandBuffer, uint32_t, const VkEvent *, VkPipelineStageFlags, VkPipelineStageFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); void (*p_vkCmdWriteTimestamp)(VkCommandBuffer, VkPipelineStageFlagBits, VkQueryPool, uint32_t); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateBuffer)(VkDevice, const VkBufferCreateInfo_host *, const VkAllocationCallbacks *, VkBuffer *); +#else VkResult (*p_vkCreateBuffer)(VkDevice, const VkBufferCreateInfo *, const VkAllocationCallbacks *, VkBuffer *); +#endif +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateBufferView)(VkDevice, const VkBufferViewCreateInfo_host *, const VkAllocationCallbacks *, VkBufferView *); +#else VkResult (*p_vkCreateBufferView)(VkDevice, const VkBufferViewCreateInfo *, const VkAllocationCallbacks *, VkBufferView *); +#endif VkResult (*p_vkCreateCommandPool)(VkDevice, const VkCommandPoolCreateInfo *, const VkAllocationCallbacks *, VkCommandPool *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateComputePipelines)(VkDevice, VkPipelineCache, uint32_t, const VkComputePipelineCreateInfo_host *, const VkAllocationCallbacks *, VkPipeline *); +#else VkResult (*p_vkCreateComputePipelines)(VkDevice, VkPipelineCache, uint32_t, const VkComputePipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); +#endif VkResult (*p_vkCreateDescriptorPool)(VkDevice, const VkDescriptorPoolCreateInfo *, const VkAllocationCallbacks *, VkDescriptorPool *); VkResult (*p_vkCreateDescriptorSetLayout)(VkDevice, const VkDescriptorSetLayoutCreateInfo *, const VkAllocationCallbacks *, VkDescriptorSetLayout *); VkResult (*p_vkCreateEvent)(VkDevice, const VkEventCreateInfo *, const VkAllocationCallbacks *, VkEvent *); VkResult (*p_vkCreateFence)(VkDevice, const VkFenceCreateInfo *, const VkAllocationCallbacks *, VkFence *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateFramebuffer)(VkDevice, const VkFramebufferCreateInfo_host *, const VkAllocationCallbacks *, VkFramebuffer *); +#else VkResult (*p_vkCreateFramebuffer)(VkDevice, const VkFramebufferCreateInfo *, const VkAllocationCallbacks *, VkFramebuffer *); +#endif +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateGraphicsPipelines)(VkDevice, VkPipelineCache, uint32_t, const VkGraphicsPipelineCreateInfo_host *, const VkAllocationCallbacks *, VkPipeline *); +#else VkResult (*p_vkCreateGraphicsPipelines)(VkDevice, VkPipelineCache, uint32_t, const VkGraphicsPipelineCreateInfo *, const VkAllocationCallbacks *, VkPipeline *); +#endif VkResult (*p_vkCreateImage)(VkDevice, const VkImageCreateInfo *, const VkAllocationCallbacks *, VkImage *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkCreateImageView)(VkDevice, const VkImageViewCreateInfo_host *, const VkAllocationCallbacks *, VkImageView *); +#else VkResult (*p_vkCreateImageView)(VkDevice, const VkImageViewCreateInfo *, const VkAllocationCallbacks *, VkImageView *); +#endif VkResult (*p_vkCreatePipelineCache)(VkDevice, const VkPipelineCacheCreateInfo *, const VkAllocationCallbacks *, VkPipelineCache *); VkResult (*p_vkCreatePipelineLayout)(VkDevice, const VkPipelineLayoutCreateInfo *, const VkAllocationCallbacks *, VkPipelineLayout *); VkResult (*p_vkCreateQueryPool)(VkDevice, const VkQueryPoolCreateInfo *, const VkAllocationCallbacks *, VkQueryPool *); @@ -297,22 +505,42 @@ struct vulkan_device_funcs void (*p_vkDestroyShaderModule)(VkDevice, VkShaderModule, const VkAllocationCallbacks *); VkResult (*p_vkDeviceWaitIdle)(VkDevice); VkResult (*p_vkEndCommandBuffer)(VkCommandBuffer); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkFlushMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange_host *); +#else VkResult (*p_vkFlushMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); +#endif void (*p_vkFreeCommandBuffers)(VkDevice, VkCommandPool, uint32_t, const VkCommandBuffer *); VkResult (*p_vkFreeDescriptorSets)(VkDevice, VkDescriptorPool, uint32_t, const VkDescriptorSet *); void (*p_vkFreeMemory)(VkDevice, VkDeviceMemory, const VkAllocationCallbacks *); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkGetBufferMemoryRequirements)(VkDevice, VkBuffer, VkMemoryRequirements_host *); +#else void (*p_vkGetBufferMemoryRequirements)(VkDevice, VkBuffer, VkMemoryRequirements *); +#endif void (*p_vkGetDeviceMemoryCommitment)(VkDevice, VkDeviceMemory, VkDeviceSize *); void (*p_vkGetDeviceQueue)(VkDevice, uint32_t, uint32_t, VkQueue *); VkResult (*p_vkGetEventStatus)(VkDevice, VkEvent); VkResult (*p_vkGetFenceStatus)(VkDevice, VkFence); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkGetImageMemoryRequirements)(VkDevice, VkImage, VkMemoryRequirements_host *); +#else void (*p_vkGetImageMemoryRequirements)(VkDevice, VkImage, VkMemoryRequirements *); +#endif void (*p_vkGetImageSparseMemoryRequirements)(VkDevice, VkImage, uint32_t *, VkSparseImageMemoryRequirements *); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout_host *); +#else void (*p_vkGetImageSubresourceLayout)(VkDevice, VkImage, const VkImageSubresource *, VkSubresourceLayout *); +#endif VkResult (*p_vkGetPipelineCacheData)(VkDevice, VkPipelineCache, size_t *, void *); VkResult (*p_vkGetQueryPoolResults)(VkDevice, VkQueryPool, uint32_t, uint32_t, size_t, void *, VkDeviceSize, VkQueryResultFlags); void (*p_vkGetRenderAreaGranularity)(VkDevice, VkRenderPass, VkExtent2D *); +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkInvalidateMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange_host *); +#else VkResult (*p_vkInvalidateMappedMemoryRanges)(VkDevice, uint32_t, const VkMappedMemoryRange *); +#endif VkResult (*p_vkMapMemory)(VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, void **); VkResult (*p_vkMergePipelineCaches)(VkDevice, VkPipelineCache, uint32_t, const VkPipelineCache *); VkResult (*p_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo *, VkFence); @@ -325,7 +553,11 @@ struct vulkan_device_funcs VkResult (*p_vkResetFences)(VkDevice, uint32_t, const VkFence *); VkResult (*p_vkSetEvent)(VkDevice, VkEvent); void (*p_vkUnmapMemory)(VkDevice, VkDeviceMemory); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkUpdateDescriptorSets)(VkDevice, uint32_t, const VkWriteDescriptorSet_host *, uint32_t, const VkCopyDescriptorSet_host *); +#else void (*p_vkUpdateDescriptorSets)(VkDevice, uint32_t, const VkWriteDescriptorSet *, uint32_t, const VkCopyDescriptorSet *); +#endif VkResult (*p_vkWaitForFences)(VkDevice, uint32_t, const VkFence *, VkBool32, uint64_t); };
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 9 +---- dlls/winevulkan/vulkan.c | 80 ++++++++++++++++++++++++++++++++++++++++ dlls/winevulkan/vulkan_private.h | 7 ++++ dlls/winevulkan/vulkan_thunks.c | 22 +++++------ dlls/winevulkan/vulkan_thunks.h | 15 ++++++++ 5 files changed, 115 insertions(+), 18 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 81d0e55c6b..a158d88dc8 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -111,7 +111,9 @@ FUNCTION_OVERRIDES = { "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
# Device functions + "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkDestroyDevice" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkFreeCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : False}, "vkGetDeviceQueue" : {"dispatch": True, "driver" : False, "thunk" : False},
@@ -393,13 +395,6 @@ class VkFunction(object): def needs_stub(self): """ Temporary function to limit script hacks until more code is implemented. """
- # Temporary hack to pull in VkSwapChainCreateInfoKHR. - if self.name == "vkCreateSwapchainKHR": - return False - - if self.name in ["vkAllocateCommandBuffers", "vkFreeCommandBuffers"]: - return True - if self.params[0].type in ["VkCommandBuffer", "VkQueue"]: return True
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 556f6a20ac..579968d5c8 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -52,6 +52,22 @@ static void wine_vk_physical_device_free(struct VkPhysicalDevice_T *phys_dev);
static const struct vulkan_funcs *vk_funcs = NULL;
+/* Helper function for release command buffers. */ +static void wine_vk_command_buffers_free(struct VkDevice_T *device, VkCommandPool pool, + uint32_t count, const VkCommandBuffer *buffers) +{ + unsigned int i; + + for (i = 0; i < count; i++) + { + if (buffers[i]->command_buffer) + device->funcs.p_vkFreeCommandBuffers(device->device, pool, 1, + &buffers[i]->command_buffer); + + heap_free(buffers[i]); + } +} + /* Helper function to create queues for a given family index. */ static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device, uint32_t fam_index, uint32_t queue_count) @@ -368,6 +384,62 @@ VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapc semaphore, fence, image_index); }
+VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, + const VkCommandBufferAllocateInfo *allocate_info, VkCommandBuffer *buffers) +{ + VkResult res = VK_SUCCESS; + unsigned int i; + + TRACE("%p %p %p\n", device, allocate_info, buffers); + + /* The application provides an array of buffers, we just clear it for error handling reasons. */ + memset(buffers, 0, allocate_info->commandBufferCount * sizeof(*buffers)); + + for (i = 0; i < allocate_info->commandBufferCount; i++) + { +#if defined(USE_STRUCT_CONVERSION) + VkCommandBufferAllocateInfo_host allocate_info_host; +#else + VkCommandBufferAllocateInfo allocate_info_host; +#endif + /* TODO: future extensions (none yet) may require pNext conversion. */ + allocate_info_host.pNext = allocate_info->pNext; + allocate_info_host.sType = allocate_info->sType; + allocate_info_host.commandPool = allocate_info->commandPool; + allocate_info_host.level = allocate_info->level; + allocate_info_host.commandBufferCount = 1; + + TRACE("Creating command buffer %d, pool 0x%s, level %d\n", i, + wine_dbgstr_longlong(allocate_info_host.commandPool), + allocate_info_host.level); + + buffers[i] = heap_alloc_zero(sizeof(struct VkCommandBuffer_T)); + if (!buffers[i]) + { + res = VK_ERROR_OUT_OF_HOST_MEMORY; + break; + } + + buffers[i]->base.loader_magic = VULKAN_ICD_MAGIC_VALUE; + buffers[i]->device = device; + res = device->funcs.p_vkAllocateCommandBuffers(device->device, + &allocate_info_host, &buffers[i]->command_buffer); + if (res != VK_SUCCESS) + { + ERR("Failed to allocate command buffer, res=%d\n", res); + break; + } + } + + if (res != VK_SUCCESS) + { + wine_vk_command_buffers_free(device, allocate_info->commandPool, i, buffers); + return res; + } + + return VK_SUCCESS; +} + VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkDevice *device) @@ -722,6 +794,14 @@ VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *d return res; }
+void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool pool, uint32_t count, + const VkCommandBuffer *buffers) +{ + TRACE("%p 0x%s %d %p\n", device, wine_dbgstr_longlong(pool), count, buffers); + + wine_vk_command_buffers_free(device, pool, count, buffers); +} + PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *name) { void *func; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index d9791cb14d..92df159cb5 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -48,6 +48,13 @@ struct wine_vk_base UINT_PTR loader_magic; };
+struct VkCommandBuffer_T +{ + struct wine_vk_base base; + VkDevice device; /* parent */ + VkCommandBuffer command_buffer; /* native command buffer */ +}; + struct VkDevice_T { struct wine_vk_base base; diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 130d91f321..8397a223fe 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -12,6 +12,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#if defined(USE_STRUCT_CONVERSION) +static inline void convert_VkCommandBufferAllocateInfo_win_to_host(const VkCommandBufferAllocateInfo *in, VkCommandBufferAllocateInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->commandPool = in->commandPool; + out->level = in->level; + out->commandBufferCount = in->commandBufferCount; +} + static inline void convert_VkDescriptorSetAllocateInfo_win_to_host(const VkDescriptorSetAllocateInfo *in, VkDescriptorSetAllocateInfo_host *out) { if (!in) return; @@ -537,12 +548,6 @@ static inline void free_VkCopyDescriptorSet_array(VkCopyDescriptorSet_host *in,
#endif /* USE_STRUCT_CONVERSION */
-static VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) -{ - FIXME("stub: %p, %p, %p\n", device, pAllocateInfo, pCommandBuffers); - return VK_ERROR_OUT_OF_HOST_MEMORY; -} - static VkResult WINAPI wine_vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) { #if defined(USE_STRUCT_CONVERSION) @@ -1141,11 +1146,6 @@ static VkResult WINAPI wine_vkFlushMappedMemoryRanges(VkDevice device, uint32_t #endif }
-static void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) -{ - FIXME("stub: %p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(commandPool), commandBufferCount, pCommandBuffers); -} - static VkResult WINAPI wine_vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) { TRACE("%p, 0x%s, %u, %p\n", device, wine_dbgstr_longlong(descriptorPool), descriptorSetCount, pDescriptorSets); diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 20f68dc90e..188598b101 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -16,6 +16,7 @@ BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN;
/* Functions for which we have custom implementations outside of the thunks. */ VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) DECLSPEC_HIDDEN; +VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) DECLSPEC_HIDDEN; @@ -25,6 +26,7 @@ void WINAPI wine_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, void WINAPI wine_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) DECLSPEC_HIDDEN; +void WINAPI wine_vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) DECLSPEC_HIDDEN; PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *pName) DECLSPEC_HIDDEN; void WINAPI wine_vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) DECLSPEC_HIDDEN; @@ -35,6 +37,15 @@ VkBool32 WINAPI wine_vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDe VkResult WINAPI wine_vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) DECLSPEC_HIDDEN;
+typedef struct VkCommandBufferAllocateInfo_host +{ + VkStructureType sType; + const void *pNext; + VkCommandPool commandPool; + VkCommandBufferLevel level; + uint32_t commandBufferCount; +} VkCommandBufferAllocateInfo_host; + typedef struct VkDescriptorSetAllocateInfo_host { VkStructureType sType; @@ -383,7 +394,11 @@ typedef struct VkCopyDescriptorSet_host /* For use by vkDevice and children */ struct vulkan_device_funcs { +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkAllocateCommandBuffers)(VkDevice, const VkCommandBufferAllocateInfo_host *, VkCommandBuffer *); +#else VkResult (*p_vkAllocateCommandBuffers)(VkDevice, const VkCommandBufferAllocateInfo *, VkCommandBuffer *); +#endif #if defined(USE_STRUCT_CONVERSION) VkResult (*p_vkAllocateDescriptorSets)(VkDevice, const VkDescriptorSetAllocateInfo_host *, VkDescriptorSet *); #else
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 1 + dlls/winevulkan/vulkan.c | 31 +++++++++++++++++++++++++++++++ dlls/winevulkan/vulkan_thunks.c | 5 ----- dlls/winevulkan/vulkan_thunks.h | 1 + 4 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index a158d88dc8..14882eb081 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -112,6 +112,7 @@ FUNCTION_OVERRIDES = {
# Device functions "vkAllocateCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, + "vkCmdExecuteCommands" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkDestroyDevice" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkFreeCommandBuffers" : {"dispatch" : True, "driver" : False, "thunk" : False}, "vkGetDeviceProcAddr" : {"dispatch" : True, "driver" : True, "thunk" : False}, diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 579968d5c8..902aa2e7e6 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -440,6 +440,37 @@ VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, return VK_SUCCESS; }
+void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer buffer, uint32_t count, + const VkCommandBuffer *buffers) +{ + VkCommandBuffer *tmp_buffers; + unsigned int i; + + TRACE("%p %u %p\n", buffer, count, buffers); + + if (!buffers || !count) + return; + + /* Unfortunately we need a temporary buffer as our command buffers are wrapped. + * This call is called often and if a performance concern, we may want to use + * alloca as we shouldn't need much memory and it needs to be cleaned up after + * the call anyway. + */ + tmp_buffers = heap_alloc(count * sizeof(VkCommandBuffer)); + if (!tmp_buffers) + { + ERR("Failed to allocate memory for temporary command buffers\n"); + return; + } + + for (i = 0; i < count; i++) + tmp_buffers[i] = buffers[i]->command_buffer; + + buffer->device->funcs.p_vkCmdExecuteCommands(buffer->command_buffer, count, tmp_buffers); + + heap_free(tmp_buffers); +} + VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkDevice *device) diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 8397a223fe..4190e7ec7d 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -715,11 +715,6 @@ static void WINAPI wine_vkCmdEndRenderPass(VkCommandBuffer commandBuffer) FIXME("stub: %p\n", commandBuffer); }
-static void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) -{ - FIXME("stub: %p, %u, %p\n", commandBuffer, commandBufferCount, pCommandBuffers); -} - static void WINAPI wine_vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) { FIXME("stub: %p, 0x%s, 0x%s, 0x%s, %u\n", commandBuffer, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(size), data); diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 188598b101..187969eed8 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -17,6 +17,7 @@ BOOL wine_vk_device_extension_supported(const char *name) DECLSPEC_HIDDEN; /* Functions for which we have custom implementations outside of the thunks. */ VkResult WINAPI wine_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) DECLSPEC_HIDDEN; +void WINAPI wine_vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) DECLSPEC_HIDDEN;
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com --- dlls/winevulkan/make_vulkan | 2 +- dlls/winevulkan/vulkan_thunks.c | 392 +++++++++++++++++++++++++++++++++++----- dlls/winevulkan/vulkan_thunks.h | 103 +++++++++++ 3 files changed, 447 insertions(+), 50 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 14882eb081..45093d3496 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -396,7 +396,7 @@ class VkFunction(object): def needs_stub(self): """ Temporary function to limit script hacks until more code is implemented. """
- if self.params[0].type in ["VkCommandBuffer", "VkQueue"]: + if self.params[0].type in ["VkQueue"]: return True
return False diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 4190e7ec7d..5d55e7cb06 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -44,6 +44,180 @@ static inline void convert_VkMemoryAllocateInfo_win_to_host(const VkMemoryAlloca out->memoryTypeIndex = in->memoryTypeIndex; }
+static inline VkCommandBufferInheritanceInfo_host * convert_VkCommandBufferInheritanceInfo_array_win_to_host(const VkCommandBufferInheritanceInfo *in, uint32_t count) +{ + VkCommandBufferInheritanceInfo_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkCommandBufferInheritanceInfo_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].renderPass = in[i].renderPass; + out[i].subpass = in[i].subpass; + out[i].framebuffer = in[i].framebuffer; + out[i].occlusionQueryEnable = in[i].occlusionQueryEnable; + out[i].queryFlags = in[i].queryFlags; + out[i].pipelineStatistics = in[i].pipelineStatistics; + } + + return out; +} + +static inline void free_VkCommandBufferInheritanceInfo_array(VkCommandBufferInheritanceInfo_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline void convert_VkCommandBufferBeginInfo_win_to_host(const VkCommandBufferBeginInfo *in, VkCommandBufferBeginInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->flags = in->flags; + out->pInheritanceInfo = convert_VkCommandBufferInheritanceInfo_array_win_to_host(in->pInheritanceInfo, 1); +} + +static inline void free_VkCommandBufferBeginInfo(VkCommandBufferBeginInfo_host *in) +{ + free_VkCommandBufferInheritanceInfo_array((VkCommandBufferInheritanceInfo_host *)in->pInheritanceInfo, 1); +} + +static inline void convert_VkRenderPassBeginInfo_win_to_host(const VkRenderPassBeginInfo *in, VkRenderPassBeginInfo_host *out) +{ + if (!in) return; + + out->sType = in->sType; + out->pNext = in->pNext; + out->renderPass = in->renderPass; + out->framebuffer = in->framebuffer; + out->renderArea = in->renderArea; + out->clearValueCount = in->clearValueCount; + out->pClearValues = in->pClearValues; +} + +static inline VkBufferCopy_host * convert_VkBufferCopy_array_win_to_host(const VkBufferCopy *in, uint32_t count) +{ + VkBufferCopy_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkBufferCopy_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].srcOffset = in[i].srcOffset; + out[i].dstOffset = in[i].dstOffset; + out[i].size = in[i].size; + } + + return out; +} + +static inline void free_VkBufferCopy_array(VkBufferCopy_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkBufferImageCopy_host * convert_VkBufferImageCopy_array_win_to_host(const VkBufferImageCopy *in, uint32_t count) +{ + VkBufferImageCopy_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkBufferImageCopy_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].bufferOffset = in[i].bufferOffset; + out[i].bufferRowLength = in[i].bufferRowLength; + out[i].bufferImageHeight = in[i].bufferImageHeight; + out[i].imageSubresource = in[i].imageSubresource; + out[i].imageOffset = in[i].imageOffset; + out[i].imageExtent = in[i].imageExtent; + } + + return out; +} + +static inline void free_VkBufferImageCopy_array(VkBufferImageCopy_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkBufferMemoryBarrier_host * convert_VkBufferMemoryBarrier_array_win_to_host(const VkBufferMemoryBarrier *in, uint32_t count) +{ + VkBufferMemoryBarrier_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkBufferMemoryBarrier_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].srcAccessMask = in[i].srcAccessMask; + out[i].dstAccessMask = in[i].dstAccessMask; + out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; + out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; + out[i].buffer = in[i].buffer; + out[i].offset = in[i].offset; + out[i].size = in[i].size; + } + + return out; +} + +static inline void free_VkBufferMemoryBarrier_array(VkBufferMemoryBarrier_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + +static inline VkImageMemoryBarrier_host * convert_VkImageMemoryBarrier_array_win_to_host(const VkImageMemoryBarrier *in, uint32_t count) +{ + VkImageMemoryBarrier_host *out; + unsigned int i; + + if (!in) return NULL; + + out = (VkImageMemoryBarrier_host *)heap_alloc(count * sizeof(*out)); + for (i = 0; i < count; i++) + { + out[i].sType = in[i].sType; + out[i].pNext = in[i].pNext; + out[i].srcAccessMask = in[i].srcAccessMask; + out[i].dstAccessMask = in[i].dstAccessMask; + out[i].oldLayout = in[i].oldLayout; + out[i].newLayout = in[i].newLayout; + out[i].srcQueueFamilyIndex = in[i].srcQueueFamilyIndex; + out[i].dstQueueFamilyIndex = in[i].dstQueueFamilyIndex; + out[i].image = in[i].image; + out[i].subresourceRange = in[i].subresourceRange; + } + + return out; +} + +static inline void free_VkImageMemoryBarrier_array(VkImageMemoryBarrier_host *in, uint32_t count) +{ + if (!in) return; + + heap_free(in); +} + static inline void convert_VkBufferCreateInfo_win_to_host(const VkBufferCreateInfo *in, VkBufferCreateInfo_host *out) { if (!in) return; @@ -584,8 +758,20 @@ static VkResult WINAPI wine_vkAllocateMemory(VkDevice device, const VkMemoryAllo
static VkResult WINAPI wine_vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) { - FIXME("stub: %p, %p\n", commandBuffer, pBeginInfo); - return VK_ERROR_OUT_OF_HOST_MEMORY; +#if defined(USE_STRUCT_CONVERSION) + VkResult result; + VkCommandBufferBeginInfo_host pBeginInfo_host; + TRACE("%p, %p\n", commandBuffer, pBeginInfo); + + convert_VkCommandBufferBeginInfo_win_to_host(pBeginInfo, &pBeginInfo_host); + result = commandBuffer->device->funcs.p_vkBeginCommandBuffer(commandBuffer->command_buffer, &pBeginInfo_host); + + free_VkCommandBufferBeginInfo(&pBeginInfo_host); + return result; +#else + TRACE("%p, %p\n", commandBuffer, pBeginInfo); + return commandBuffer->device->funcs.p_vkBeginCommandBuffer(commandBuffer->command_buffer, pBeginInfo); +#endif }
static VkResult WINAPI wine_vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) @@ -602,217 +788,325 @@ static VkResult WINAPI wine_vkBindImageMemory(VkDevice device, VkImage image, Vk
static void WINAPI wine_vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) { - FIXME("stub: %p, 0x%s, %u, %#x\n", commandBuffer, wine_dbgstr_longlong(queryPool), query, flags); + TRACE("%p, 0x%s, %u, %#x\n", commandBuffer, wine_dbgstr_longlong(queryPool), query, flags); + commandBuffer->device->funcs.p_vkCmdBeginQuery(commandBuffer->command_buffer, queryPool, query, flags); }
static void WINAPI wine_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) { - FIXME("stub: %p, %p, %d\n", commandBuffer, pRenderPassBegin, contents); +#if defined(USE_STRUCT_CONVERSION) + VkRenderPassBeginInfo_host pRenderPassBegin_host; + TRACE("%p, %p, %d\n", commandBuffer, pRenderPassBegin, contents); + + convert_VkRenderPassBeginInfo_win_to_host(pRenderPassBegin, &pRenderPassBegin_host); + commandBuffer->device->funcs.p_vkCmdBeginRenderPass(commandBuffer->command_buffer, &pRenderPassBegin_host, contents); + +#else + TRACE("%p, %p, %d\n", commandBuffer, pRenderPassBegin, contents); + commandBuffer->device->funcs.p_vkCmdBeginRenderPass(commandBuffer->command_buffer, pRenderPassBegin, contents); +#endif }
static void WINAPI wine_vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) { - FIXME("stub: %p, %d, 0x%s, %u, %u, %p, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); + TRACE("%p, %d, 0x%s, %u, %u, %p, %u, %p\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(layout), firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); + commandBuffer->device->funcs.p_vkCmdBindDescriptorSets(commandBuffer->command_buffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); }
static void WINAPI wine_vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) { - FIXME("stub: %p, 0x%s, 0x%s, %d\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), indexType); + TRACE("%p, 0x%s, 0x%s, %d\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), indexType); + commandBuffer->device->funcs.p_vkCmdBindIndexBuffer(commandBuffer->command_buffer, buffer, offset, indexType); }
static void WINAPI wine_vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { - FIXME("stub: %p, %d, 0x%s\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(pipeline)); + TRACE("%p, %d, 0x%s\n", commandBuffer, pipelineBindPoint, wine_dbgstr_longlong(pipeline)); + commandBuffer->device->funcs.p_vkCmdBindPipeline(commandBuffer->command_buffer, pipelineBindPoint, pipeline); }
static void WINAPI wine_vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) { - FIXME("stub: %p, %u, %u, %p, %p\n", commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); + TRACE("%p, %u, %u, %p, %p\n", commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); + commandBuffer->device->funcs.p_vkCmdBindVertexBuffers(commandBuffer->command_buffer, firstBinding, bindingCount, pBuffers, pOffsets); }
static void WINAPI wine_vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) { - FIXME("stub: %p, 0x%s, %d, 0x%s, %d, %u, %p, %d\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions, filter); + TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p, %d\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions, filter); + commandBuffer->device->funcs.p_vkCmdBlitImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); }
static void WINAPI wine_vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects) { - FIXME("stub: %p, %u, %p, %u, %p\n", commandBuffer, attachmentCount, pAttachments, rectCount, pRects); + TRACE("%p, %u, %p, %u, %p\n", commandBuffer, attachmentCount, pAttachments, rectCount, pRects); + commandBuffer->device->funcs.p_vkCmdClearAttachments(commandBuffer->command_buffer, attachmentCount, pAttachments, rectCount, pRects); }
static void WINAPI wine_vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { - FIXME("stub: %p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pColor, rangeCount, pRanges); + TRACE("%p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pColor, rangeCount, pRanges); + commandBuffer->device->funcs.p_vkCmdClearColorImage(commandBuffer->command_buffer, image, imageLayout, pColor, rangeCount, pRanges); }
static void WINAPI wine_vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { - FIXME("stub: %p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pDepthStencil, rangeCount, pRanges); + TRACE("%p, 0x%s, %d, %p, %u, %p\n", commandBuffer, wine_dbgstr_longlong(image), imageLayout, pDepthStencil, rangeCount, pRanges); + commandBuffer->device->funcs.p_vkCmdClearDepthStencilImage(commandBuffer->command_buffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); }
static void WINAPI wine_vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy *pRegions) { - FIXME("stub: %p, 0x%s, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); +#if defined(USE_STRUCT_CONVERSION) + VkBufferCopy_host *pRegions_host; + TRACE("%p, 0x%s, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + + pRegions_host = convert_VkBufferCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions_host); + + free_VkBufferCopy_array(pRegions_host, regionCount); +#else + TRACE("%p, 0x%s, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyBuffer(commandBuffer->command_buffer, srcBuffer, dstBuffer, regionCount, pRegions); +#endif }
static void WINAPI wine_vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions) { - FIXME("stub: %p, 0x%s, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); +#if defined(USE_STRUCT_CONVERSION) + VkBufferImageCopy_host *pRegions_host; + TRACE("%p, 0x%s, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + + pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions_host); + + free_VkBufferImageCopy_array(pRegions_host, regionCount); +#else + TRACE("%p, 0x%s, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcBuffer), wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyBufferToImage(commandBuffer->command_buffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); +#endif }
static void WINAPI wine_vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) { - FIXME("stub: %p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
static void WINAPI wine_vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) { - FIXME("stub: %p, 0x%s, %d, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); +#if defined(USE_STRUCT_CONVERSION) + VkBufferImageCopy_host *pRegions_host; + TRACE("%p, 0x%s, %d, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + + pRegions_host = convert_VkBufferImageCopy_array_win_to_host(pRegions, regionCount); + commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions_host); + + free_VkBufferImageCopy_array(pRegions_host, regionCount); +#else + TRACE("%p, 0x%s, %d, 0x%s, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstBuffer), regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdCopyImageToBuffer(commandBuffer->command_buffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); +#endif }
static void WINAPI wine_vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) { - FIXME("stub: %p, 0x%s, %u, %u, 0x%s, 0x%s, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(stride), flags); + TRACE("%p, 0x%s, %u, %u, 0x%s, 0x%s, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(stride), flags); + commandBuffer->device->funcs.p_vkCmdCopyQueryPoolResults(commandBuffer->command_buffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); }
static void WINAPI wine_vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) { - FIXME("stub: %p, %u, %u, %u\n", commandBuffer, groupCountX, groupCountY, groupCountZ); + TRACE("%p, %u, %u, %u\n", commandBuffer, groupCountX, groupCountY, groupCountZ); + commandBuffer->device->funcs.p_vkCmdDispatch(commandBuffer->command_buffer, groupCountX, groupCountY, groupCountZ); }
static void WINAPI wine_vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) { - FIXME("stub: %p, 0x%s, 0x%s\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset)); + TRACE("%p, 0x%s, 0x%s\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset)); + commandBuffer->device->funcs.p_vkCmdDispatchIndirect(commandBuffer->command_buffer, buffer, offset); }
static void WINAPI wine_vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { - FIXME("stub: %p, %u, %u, %u, %u\n", commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); + TRACE("%p, %u, %u, %u, %u\n", commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); + commandBuffer->device->funcs.p_vkCmdDraw(commandBuffer->command_buffer, vertexCount, instanceCount, firstVertex, firstInstance); }
static void WINAPI wine_vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) { - FIXME("stub: %p, %u, %u, %u, %d, %u\n", commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); + TRACE("%p, %u, %u, %u, %d, %u\n", commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); + commandBuffer->device->funcs.p_vkCmdDrawIndexed(commandBuffer->command_buffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); }
static void WINAPI wine_vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { - FIXME("stub: %p, 0x%s, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), drawCount, stride); + TRACE("%p, 0x%s, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), drawCount, stride); + commandBuffer->device->funcs.p_vkCmdDrawIndexedIndirect(commandBuffer->command_buffer, buffer, offset, drawCount, stride); }
static void WINAPI wine_vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { - FIXME("stub: %p, 0x%s, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), drawCount, stride); + TRACE("%p, 0x%s, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(buffer), wine_dbgstr_longlong(offset), drawCount, stride); + commandBuffer->device->funcs.p_vkCmdDrawIndirect(commandBuffer->command_buffer, buffer, offset, drawCount, stride); }
static void WINAPI wine_vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) { - FIXME("stub: %p, 0x%s, %u\n", commandBuffer, wine_dbgstr_longlong(queryPool), query); + TRACE("%p, 0x%s, %u\n", commandBuffer, wine_dbgstr_longlong(queryPool), query); + commandBuffer->device->funcs.p_vkCmdEndQuery(commandBuffer->command_buffer, queryPool, query); }
static void WINAPI wine_vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { - FIXME("stub: %p\n", commandBuffer); + TRACE("%p\n", commandBuffer); + commandBuffer->device->funcs.p_vkCmdEndRenderPass(commandBuffer->command_buffer); }
static void WINAPI wine_vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s, %u\n", commandBuffer, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(size), data); + TRACE("%p, 0x%s, 0x%s, 0x%s, %u\n", commandBuffer, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(size), data); + commandBuffer->device->funcs.p_vkCmdFillBuffer(commandBuffer->command_buffer, dstBuffer, dstOffset, size, data); }
static void WINAPI wine_vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { - FIXME("stub: %p, %d\n", commandBuffer, contents); + TRACE("%p, %d\n", commandBuffer, contents); + commandBuffer->device->funcs.p_vkCmdNextSubpass(commandBuffer->command_buffer, contents); }
static void WINAPI wine_vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { - FIXME("stub: %p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +#if defined(USE_STRUCT_CONVERSION) + VkBufferMemoryBarrier_host *pBufferMemoryBarriers_host; + VkImageMemoryBarrier_host *pImageMemoryBarriers_host; + TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + + pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win_to_host(pBufferMemoryBarriers, bufferMemoryBarrierCount); + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host); + + free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); + free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); +#else + TRACE("%p, %#x, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + commandBuffer->device->funcs.p_vkCmdPipelineBarrier(commandBuffer->command_buffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +#endif }
static void WINAPI wine_vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues) { - FIXME("stub: %p, 0x%s, %#x, %u, %u, %p\n", commandBuffer, wine_dbgstr_longlong(layout), stageFlags, offset, size, pValues); + TRACE("%p, 0x%s, %#x, %u, %u, %p\n", commandBuffer, wine_dbgstr_longlong(layout), stageFlags, offset, size, pValues); + commandBuffer->device->funcs.p_vkCmdPushConstants(commandBuffer->command_buffer, layout, stageFlags, offset, size, pValues); }
static void WINAPI wine_vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { - FIXME("stub: %p, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(event), stageMask); + TRACE("%p, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(event), stageMask); + commandBuffer->device->funcs.p_vkCmdResetEvent(commandBuffer->command_buffer, event, stageMask); }
static void WINAPI wine_vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) { - FIXME("stub: %p, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(queryPool), firstQuery, queryCount); + TRACE("%p, 0x%s, %u, %u\n", commandBuffer, wine_dbgstr_longlong(queryPool), firstQuery, queryCount); + commandBuffer->device->funcs.p_vkCmdResetQueryPool(commandBuffer->command_buffer, queryPool, firstQuery, queryCount); }
static void WINAPI wine_vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) { - FIXME("stub: %p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + TRACE("%p, 0x%s, %d, 0x%s, %d, %u, %p\n", commandBuffer, wine_dbgstr_longlong(srcImage), srcImageLayout, wine_dbgstr_longlong(dstImage), dstImageLayout, regionCount, pRegions); + commandBuffer->device->funcs.p_vkCmdResolveImage(commandBuffer->command_buffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
static void WINAPI wine_vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { - FIXME("stub: %p, %p\n", commandBuffer, blendConstants); + TRACE("%p, %p\n", commandBuffer, blendConstants); + commandBuffer->device->funcs.p_vkCmdSetBlendConstants(commandBuffer->command_buffer, blendConstants); }
static void WINAPI wine_vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) { - FIXME("stub: %p, %f, %f, %f\n", commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); + TRACE("%p, %f, %f, %f\n", commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); + commandBuffer->device->funcs.p_vkCmdSetDepthBias(commandBuffer->command_buffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); }
static void WINAPI wine_vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) { - FIXME("stub: %p, %f, %f\n", commandBuffer, minDepthBounds, maxDepthBounds); + TRACE("%p, %f, %f\n", commandBuffer, minDepthBounds, maxDepthBounds); + commandBuffer->device->funcs.p_vkCmdSetDepthBounds(commandBuffer->command_buffer, minDepthBounds, maxDepthBounds); }
static void WINAPI wine_vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) { - FIXME("stub: %p, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(event), stageMask); + TRACE("%p, 0x%s, %#x\n", commandBuffer, wine_dbgstr_longlong(event), stageMask); + commandBuffer->device->funcs.p_vkCmdSetEvent(commandBuffer->command_buffer, event, stageMask); }
static void WINAPI wine_vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { - FIXME("stub: %p, %f\n", commandBuffer, lineWidth); + TRACE("%p, %f\n", commandBuffer, lineWidth); + commandBuffer->device->funcs.p_vkCmdSetLineWidth(commandBuffer->command_buffer, lineWidth); }
static void WINAPI wine_vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors) { - FIXME("stub: %p, %u, %u, %p\n", commandBuffer, firstScissor, scissorCount, pScissors); + TRACE("%p, %u, %u, %p\n", commandBuffer, firstScissor, scissorCount, pScissors); + commandBuffer->device->funcs.p_vkCmdSetScissor(commandBuffer->command_buffer, firstScissor, scissorCount, pScissors); }
static void WINAPI wine_vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) { - FIXME("stub: %p, %#x, %u\n", commandBuffer, faceMask, compareMask); + TRACE("%p, %#x, %u\n", commandBuffer, faceMask, compareMask); + commandBuffer->device->funcs.p_vkCmdSetStencilCompareMask(commandBuffer->command_buffer, faceMask, compareMask); }
static void WINAPI wine_vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) { - FIXME("stub: %p, %#x, %u\n", commandBuffer, faceMask, reference); + TRACE("%p, %#x, %u\n", commandBuffer, faceMask, reference); + commandBuffer->device->funcs.p_vkCmdSetStencilReference(commandBuffer->command_buffer, faceMask, reference); }
static void WINAPI wine_vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) { - FIXME("stub: %p, %#x, %u\n", commandBuffer, faceMask, writeMask); + TRACE("%p, %#x, %u\n", commandBuffer, faceMask, writeMask); + commandBuffer->device->funcs.p_vkCmdSetStencilWriteMask(commandBuffer->command_buffer, faceMask, writeMask); }
static void WINAPI wine_vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports) { - FIXME("stub: %p, %u, %u, %p\n", commandBuffer, firstViewport, viewportCount, pViewports); + TRACE("%p, %u, %u, %p\n", commandBuffer, firstViewport, viewportCount, pViewports); + commandBuffer->device->funcs.p_vkCmdSetViewport(commandBuffer->command_buffer, firstViewport, viewportCount, pViewports); }
static void WINAPI wine_vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) { - FIXME("stub: %p, 0x%s, 0x%s, 0x%s, %p\n", commandBuffer, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(dataSize), pData); + TRACE("%p, 0x%s, 0x%s, 0x%s, %p\n", commandBuffer, wine_dbgstr_longlong(dstBuffer), wine_dbgstr_longlong(dstOffset), wine_dbgstr_longlong(dataSize), pData); + commandBuffer->device->funcs.p_vkCmdUpdateBuffer(commandBuffer->command_buffer, dstBuffer, dstOffset, dataSize, pData); }
static void WINAPI wine_vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) { - FIXME("stub: %p, %u, %p, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +#if defined(USE_STRUCT_CONVERSION) + VkBufferMemoryBarrier_host *pBufferMemoryBarriers_host; + VkImageMemoryBarrier_host *pImageMemoryBarriers_host; + TRACE("%p, %u, %p, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + + pBufferMemoryBarriers_host = convert_VkBufferMemoryBarrier_array_win_to_host(pBufferMemoryBarriers, bufferMemoryBarrierCount); + pImageMemoryBarriers_host = convert_VkImageMemoryBarrier_array_win_to_host(pImageMemoryBarriers, imageMemoryBarrierCount); + commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers_host, imageMemoryBarrierCount, pImageMemoryBarriers_host); + + free_VkBufferMemoryBarrier_array(pBufferMemoryBarriers_host, bufferMemoryBarrierCount); + free_VkImageMemoryBarrier_array(pImageMemoryBarriers_host, imageMemoryBarrierCount); +#else + TRACE("%p, %u, %p, %#x, %#x, %u, %p, %u, %p, %u, %p\n", commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + commandBuffer->device->funcs.p_vkCmdWaitEvents(commandBuffer->command_buffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); +#endif }
static void WINAPI wine_vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) { - FIXME("stub: %p, %d, 0x%s, %u\n", commandBuffer, pipelineStage, wine_dbgstr_longlong(queryPool), query); + TRACE("%p, %d, 0x%s, %u\n", commandBuffer, pipelineStage, wine_dbgstr_longlong(queryPool), query); + commandBuffer->device->funcs.p_vkCmdWriteTimestamp(commandBuffer->command_buffer, pipelineStage, queryPool, query); }
static VkResult WINAPI wine_vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) @@ -1113,8 +1407,8 @@ static VkResult WINAPI wine_vkDeviceWaitIdle(VkDevice device)
static VkResult WINAPI wine_vkEndCommandBuffer(VkCommandBuffer commandBuffer) { - FIXME("stub: %p\n", commandBuffer); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p\n", commandBuffer); + return commandBuffer->device->funcs.p_vkEndCommandBuffer(commandBuffer->command_buffer); }
static VkResult WINAPI wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) @@ -1361,8 +1655,8 @@ static VkResult WINAPI wine_vkQueueWaitIdle(VkQueue queue)
static VkResult WINAPI wine_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { - FIXME("stub: %p, %#x\n", commandBuffer, flags); - return VK_ERROR_OUT_OF_HOST_MEMORY; + TRACE("%p, %#x\n", commandBuffer, flags); + return commandBuffer->device->funcs.p_vkResetCommandBuffer(commandBuffer->command_buffer, flags); }
static VkResult WINAPI wine_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) diff --git a/dlls/winevulkan/vulkan_thunks.h b/dlls/winevulkan/vulkan_thunks.h index 187969eed8..951945d548 100644 --- a/dlls/winevulkan/vulkan_thunks.h +++ b/dlls/winevulkan/vulkan_thunks.h @@ -64,6 +64,81 @@ typedef struct VkMemoryAllocateInfo_host uint32_t memoryTypeIndex; } VkMemoryAllocateInfo_host;
+typedef struct VkCommandBufferInheritanceInfo_host +{ + VkStructureType sType; + const void *pNext; + VkRenderPass renderPass; + uint32_t subpass; + VkFramebuffer framebuffer; + VkBool32 occlusionQueryEnable; + VkQueryControlFlags queryFlags; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkCommandBufferInheritanceInfo_host; + +typedef struct VkCommandBufferBeginInfo_host +{ + VkStructureType sType; + const void *pNext; + VkCommandBufferUsageFlags flags; + const VkCommandBufferInheritanceInfo_host *pInheritanceInfo; +} VkCommandBufferBeginInfo_host; + +typedef struct VkRenderPassBeginInfo_host +{ + VkStructureType sType; + const void *pNext; + VkRenderPass renderPass; + VkFramebuffer framebuffer; + VkRect2D renderArea; + uint32_t clearValueCount; + const VkClearValue *pClearValues; +} VkRenderPassBeginInfo_host; + +typedef struct VkBufferCopy_host +{ + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy_host; + +typedef struct VkBufferImageCopy_host +{ + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy_host; + +typedef struct VkBufferMemoryBarrier_host +{ + VkStructureType sType; + const void *pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier_host; + +typedef struct VkImageMemoryBarrier_host +{ + VkStructureType sType; + const void *pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier_host; + typedef struct VkBufferCreateInfo_host { VkStructureType sType; @@ -410,11 +485,19 @@ struct vulkan_device_funcs #else VkResult (*p_vkAllocateMemory)(VkDevice, const VkMemoryAllocateInfo *, const VkAllocationCallbacks *, VkDeviceMemory *); #endif +#if defined(USE_STRUCT_CONVERSION) + VkResult (*p_vkBeginCommandBuffer)(VkCommandBuffer, const VkCommandBufferBeginInfo_host *); +#else VkResult (*p_vkBeginCommandBuffer)(VkCommandBuffer, const VkCommandBufferBeginInfo *); +#endif VkResult (*p_vkBindBufferMemory)(VkDevice, VkBuffer, VkDeviceMemory, VkDeviceSize); VkResult (*p_vkBindImageMemory)(VkDevice, VkImage, VkDeviceMemory, VkDeviceSize); void (*p_vkCmdBeginQuery)(VkCommandBuffer, VkQueryPool, uint32_t, VkQueryControlFlags); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdBeginRenderPass)(VkCommandBuffer, const VkRenderPassBeginInfo_host *, VkSubpassContents); +#else void (*p_vkCmdBeginRenderPass)(VkCommandBuffer, const VkRenderPassBeginInfo *, VkSubpassContents); +#endif void (*p_vkCmdBindDescriptorSets)(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, const VkDescriptorSet *, uint32_t, const uint32_t *); void (*p_vkCmdBindIndexBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkIndexType); void (*p_vkCmdBindPipeline)(VkCommandBuffer, VkPipelineBindPoint, VkPipeline); @@ -423,10 +506,22 @@ struct vulkan_device_funcs void (*p_vkCmdClearAttachments)(VkCommandBuffer, uint32_t, const VkClearAttachment *, uint32_t, const VkClearRect *); void (*p_vkCmdClearColorImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearColorValue *, uint32_t, const VkImageSubresourceRange *); void (*p_vkCmdClearDepthStencilImage)(VkCommandBuffer, VkImage, VkImageLayout, const VkClearDepthStencilValue *, uint32_t, const VkImageSubresourceRange *); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdCopyBuffer)(VkCommandBuffer, VkBuffer, VkBuffer, uint32_t, const VkBufferCopy_host *); +#else void (*p_vkCmdCopyBuffer)(VkCommandBuffer, VkBuffer, VkBuffer, uint32_t, const VkBufferCopy *); +#endif +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdCopyBufferToImage)(VkCommandBuffer, VkBuffer, VkImage, VkImageLayout, uint32_t, const VkBufferImageCopy_host *); +#else void (*p_vkCmdCopyBufferToImage)(VkCommandBuffer, VkBuffer, VkImage, VkImageLayout, uint32_t, const VkBufferImageCopy *); +#endif void (*p_vkCmdCopyImage)(VkCommandBuffer, VkImage, VkImageLayout, VkImage, VkImageLayout, uint32_t, const VkImageCopy *); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdCopyImageToBuffer)(VkCommandBuffer, VkImage, VkImageLayout, VkBuffer, uint32_t, const VkBufferImageCopy_host *); +#else void (*p_vkCmdCopyImageToBuffer)(VkCommandBuffer, VkImage, VkImageLayout, VkBuffer, uint32_t, const VkBufferImageCopy *); +#endif void (*p_vkCmdCopyQueryPoolResults)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t, VkBuffer, VkDeviceSize, VkDeviceSize, VkQueryResultFlags); void (*p_vkCmdDispatch)(VkCommandBuffer, uint32_t, uint32_t, uint32_t); void (*p_vkCmdDispatchIndirect)(VkCommandBuffer, VkBuffer, VkDeviceSize); @@ -439,7 +534,11 @@ struct vulkan_device_funcs void (*p_vkCmdExecuteCommands)(VkCommandBuffer, uint32_t, const VkCommandBuffer *); void (*p_vkCmdFillBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, uint32_t); void (*p_vkCmdNextSubpass)(VkCommandBuffer, VkSubpassContents); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdPipelineBarrier)(VkCommandBuffer, VkPipelineStageFlags, VkPipelineStageFlags, VkDependencyFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier_host *, uint32_t, const VkImageMemoryBarrier_host *); +#else void (*p_vkCmdPipelineBarrier)(VkCommandBuffer, VkPipelineStageFlags, VkPipelineStageFlags, VkDependencyFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); +#endif void (*p_vkCmdPushConstants)(VkCommandBuffer, VkPipelineLayout, VkShaderStageFlags, uint32_t, uint32_t, const void *); void (*p_vkCmdResetEvent)(VkCommandBuffer, VkEvent, VkPipelineStageFlags); void (*p_vkCmdResetQueryPool)(VkCommandBuffer, VkQueryPool, uint32_t, uint32_t); @@ -455,7 +554,11 @@ struct vulkan_device_funcs void (*p_vkCmdSetStencilWriteMask)(VkCommandBuffer, VkStencilFaceFlags, uint32_t); void (*p_vkCmdSetViewport)(VkCommandBuffer, uint32_t, uint32_t, const VkViewport *); void (*p_vkCmdUpdateBuffer)(VkCommandBuffer, VkBuffer, VkDeviceSize, VkDeviceSize, const void *); +#if defined(USE_STRUCT_CONVERSION) + void (*p_vkCmdWaitEvents)(VkCommandBuffer, uint32_t, const VkEvent *, VkPipelineStageFlags, VkPipelineStageFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier_host *, uint32_t, const VkImageMemoryBarrier_host *); +#else void (*p_vkCmdWaitEvents)(VkCommandBuffer, uint32_t, const VkEvent *, VkPipelineStageFlags, VkPipelineStageFlags, uint32_t, const VkMemoryBarrier *, uint32_t, const VkBufferMemoryBarrier *, uint32_t, const VkImageMemoryBarrier *); +#endif void (*p_vkCmdWriteTimestamp)(VkCommandBuffer, VkPipelineStageFlagBits, VkQueryPool, uint32_t); #if defined(USE_STRUCT_CONVERSION) VkResult (*p_vkCreateBuffer)(VkDevice, const VkBufferCreateInfo_host *, const VkAllocationCallbacks *, VkBuffer *);