From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/vulkan.c | 43 +--- dlls/winemac.drv/vulkan.c | 6 - dlls/winevulkan/loader.c | 39 +++- dlls/winevulkan/make_vulkan | 22 -- dlls/winevulkan/vulkan.c | 107 +++------ dlls/winevulkan/vulkan_loader.h | 11 - dlls/winevulkan/vulkan_private.h | 5 - dlls/winevulkan/vulkan_thunks.c | 358 ------------------------------- dlls/winewayland.drv/vulkan.c | 9 - dlls/winex11.drv/vulkan.c | 9 - include/wine/vulkan_driver.h | 16 +- 11 files changed, 91 insertions(+), 534 deletions(-)
diff --git a/dlls/win32u/vulkan.c b/dlls/win32u/vulkan.c index 5989a1e103a..f4310089f70 100644 --- a/dlls/win32u/vulkan.c +++ b/dlls/win32u/vulkan.c @@ -234,25 +234,26 @@ static VkResult allocate_external_host_memory( struct vulkan_device *device, VkM
static VkExternalMemoryHandleTypeFlagBits get_host_external_memory_type(void) { - const char *host_extension = driver_funcs->p_get_host_extension( "VK_KHR_external_memory_win32" ); - if (!strcmp( host_extension, "VK_KHR_external_memory_fd" )) return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; - if (!strcmp( host_extension, "VK_EXT_external_memory_dma_buf" )) return VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT; + struct vulkan_device_extensions extensions = {.has_VK_KHR_external_memory_win32 = 1}; + driver_funcs->p_map_device_extensions( &extensions ); + if (extensions.has_VK_KHR_external_memory_fd) return VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT; + if (extensions.has_VK_EXT_external_memory_dma_buf) return VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT; return 0; }
static VkExternalSemaphoreHandleTypeFlagBits get_host_external_semaphore_type(void) { - const char *host_extension = driver_funcs->p_get_host_extension( "VK_KHR_external_semaphore_win32" ); - if (!strcmp( host_extension, "VK_KHR_external_semaphore_fd" )) return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; - if (!strcmp( host_extension, "VK_KHR_external_semaphore_capabilities" )) return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT; + struct vulkan_device_extensions extensions = {.has_VK_KHR_external_semaphore_win32 = 1}; + driver_funcs->p_map_device_extensions( &extensions ); + if (extensions.has_VK_KHR_external_semaphore_fd) return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT; return 0; }
static VkExternalFenceHandleTypeFlagBits get_host_external_fence_type(void) { - const char *host_extension = driver_funcs->p_get_host_extension( "VK_KHR_external_fence_win32" ); - if (!strcmp( host_extension, "VK_KHR_external_fence_fd" )) return VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT; - if (!strcmp( host_extension, "VK_KHR_external_fence_capabilities" )) return VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT; + struct vulkan_device_extensions extensions = {.has_VK_KHR_external_fence_win32 = 1}; + driver_funcs->p_map_device_extensions( &extensions ); + if (extensions.has_VK_KHR_external_fence_fd) return VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT; return 0; }
@@ -395,7 +396,7 @@ static VkResult win32u_vkAllocateMemory( VkDevice client_device, const VkMemoryA break; }
- if (device->has_win32_keyed_mutex && memory->sync) + if (device->client.device->extensions.has_VK_KHR_win32_keyed_mutex && memory->sync) { VkSemaphoreTypeCreateInfo semaphore_type = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO}; VkSemaphoreCreateInfo semaphore_create = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO, .pNext = &semaphore_type}; @@ -2262,11 +2263,6 @@ static void win32u_vkGetPhysicalDeviceExternalFencePropertiesKHR( VkPhysicalDevi get_physical_device_external_fence_properties( physical_device, fence_info, fence_properties, instance->p_vkGetPhysicalDeviceExternalFencePropertiesKHR ); }
-static const char *win32u_get_host_extension( const char *name ) -{ - return driver_funcs->p_get_host_extension( name ); -} - static void win32u_map_instance_extensions( struct vulkan_instance_extensions *extensions ) { return driver_funcs->p_map_instance_extensions( extensions ); @@ -2326,7 +2322,6 @@ static struct vulkan_funcs vulkan_funcs = .p_vkQueueSubmit2KHR = win32u_vkQueueSubmit2KHR, .p_vkUnmapMemory = win32u_vkUnmapMemory, .p_vkUnmapMemory2KHR = win32u_vkUnmapMemory2KHR, - .p_get_host_extension = win32u_get_host_extension, .p_map_instance_extensions = win32u_map_instance_extensions, .p_map_device_extensions = win32u_map_device_extensions, }; @@ -2352,14 +2347,6 @@ static VkBool32 nulldrv_get_physical_device_presentation_support( struct vulkan_ return VK_TRUE; }
-static const char *nulldrv_get_host_extension( const char *name ) -{ - if (!strcmp( name, "VK_KHR_external_memory_win32" )) return "VK_KHR_external_memory_fd"; - if (!strcmp( name, "VK_KHR_external_semaphore_win32" )) return "VK_KHR_external_semaphore_fd"; - if (!strcmp( name, "VK_KHR_external_fence_win32" )) return "VK_KHR_external_fence_fd"; - return name; -} - static void nulldrv_map_instance_extensions( struct vulkan_instance_extensions *extensions ) { if (extensions->has_VK_KHR_win32_surface) extensions->has_VK_EXT_headless_surface = 1; @@ -2380,7 +2367,6 @@ static const struct vulkan_driver_funcs nulldrv_funcs = { .p_vulkan_surface_create = nulldrv_vulkan_surface_create, .p_get_physical_device_presentation_support = nulldrv_get_physical_device_presentation_support, - .p_get_host_extension = nulldrv_get_host_extension, .p_map_instance_extensions = nulldrv_map_instance_extensions, .p_map_device_extensions = nulldrv_map_device_extensions, }; @@ -2418,12 +2404,6 @@ static VkBool32 lazydrv_get_physical_device_presentation_support( struct vulkan_ return driver_funcs->p_get_physical_device_presentation_support( physical_device, queue ); }
-static const char *lazydrv_get_host_extension( const char *name ) -{ - vulkan_driver_load(); - return driver_funcs->p_get_host_extension( name ); -} - static void lazydrv_map_instance_extensions( struct vulkan_instance_extensions *extensions ) { vulkan_driver_load(); @@ -2440,7 +2420,6 @@ static const struct vulkan_driver_funcs lazydrv_funcs = { .p_vulkan_surface_create = lazydrv_vulkan_surface_create, .p_get_physical_device_presentation_support = lazydrv_get_physical_device_presentation_support, - .p_get_host_extension = lazydrv_get_host_extension, .p_map_instance_extensions = lazydrv_map_instance_extensions, .p_map_device_extensions = lazydrv_map_device_extensions, }; diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c index 382bae8e0a4..d146a45e351 100644 --- a/dlls/winemac.drv/vulkan.c +++ b/dlls/winemac.drv/vulkan.c @@ -100,11 +100,6 @@ static VkBool32 macdrv_get_physical_device_presentation_support(struct vulkan_ph
static BOOL use_VK_EXT_metal_surface;
-static const char *macdrv_get_host_extension(const char *name) -{ - return name; -} - static void macdrv_map_instance_extensions(struct vulkan_instance_extensions *extensions) { if (use_VK_EXT_metal_surface) @@ -127,7 +122,6 @@ static const struct vulkan_driver_funcs macdrv_vulkan_driver_funcs = { .p_vulkan_surface_create = macdrv_vulkan_surface_create, .p_get_physical_device_presentation_support = macdrv_get_physical_device_presentation_support, - .p_get_host_extension = macdrv_get_host_extension, .p_map_instance_extensions = macdrv_map_instance_extensions, .p_map_device_extensions = macdrv_map_device_extensions, }; diff --git a/dlls/winevulkan/loader.c b/dlls/winevulkan/loader.c index 5beb9bd1cd0..730a2f09647 100644 --- a/dlls/winevulkan/loader.c +++ b/dlls/winevulkan/loader.c @@ -141,6 +141,30 @@ PFN_vkVoidFunction WINAPI vkGetDeviceProcAddr(VkDevice device, const char *name) if (!device || !name) return NULL;
+ if (device->extensions.has_VK_KHR_external_memory_win32) + { + if (!strcmp(name, "vkGetMemoryWin32HandleKHR")) + return (PFN_vkVoidFunction)vkGetMemoryWin32HandleKHR; + if (!strcmp(name, "vkGetMemoryWin32HandlePropertiesKHR")) + return (PFN_vkVoidFunction)vkGetMemoryWin32HandlePropertiesKHR; + } + + if (device->extensions.has_VK_KHR_external_semaphore_win32) + { + if (!strcmp(name, "vkGetSemaphoreWin32HandleKHR")) + return (PFN_vkVoidFunction)vkGetSemaphoreWin32HandleKHR; + if (!strcmp(name, "vkImportSemaphoreWin32HandleKHR")) + return (PFN_vkVoidFunction)vkImportSemaphoreWin32HandleKHR; + } + + if (device->extensions.has_VK_KHR_external_fence_win32) + { + if (!strcmp(name, "vkGetFenceWin32HandleKHR")) + return (PFN_vkVoidFunction)vkGetFenceWin32HandleKHR; + if (!strcmp(name, "vkImportFenceWin32HandleKHR")) + return (PFN_vkVoidFunction)vkImportFenceWin32HandleKHR; + } + /* Per the spec, we are only supposed to return device functions as in functions * for which the first parameter is vkDevice or a child of vkDevice like a * vkCommandBuffer or vkQueue. @@ -569,22 +593,33 @@ VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version) return params.result; }
-VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateInfo *create_info, +VkResult WINAPI vkCreateDevice(VkPhysicalDevice physical_device, const VkDeviceCreateInfo *create_info, const VkAllocationCallbacks *allocator, VkDevice *ret) { + struct vulkan_device_extensions extensions = {0}; struct vkCreateDevice_params params; uint32_t queue_count = 0, i; VkDevice device; NTSTATUS status;
+ TRACE("Enabling %u client device extensions\n", create_info->enabledExtensionCount); + for (uint32_t i = 0; i < create_info->enabledExtensionCount; i++) + { + const char *extension = create_info->ppEnabledExtensionNames[i]; + if (!is_device_extension_supported(physical_device, extension, &extensions)) + return VK_ERROR_EXTENSION_NOT_PRESENT; + TRACE(" - %s\n", extension); + } + for (i = 0; i < create_info->queueCreateInfoCount; i++) queue_count += create_info->pQueueCreateInfos[i].queueCount; if (!(device = vulkan_client_object_create(FIELD_OFFSET(struct VkDevice_T, queues[queue_count])))) return VK_ERROR_OUT_OF_HOST_MEMORY; for (i = 0; i < queue_count; i++) device->queues[i].obj.loader_magic = VULKAN_ICD_MAGIC_VALUE; + device->extensions = extensions;
- params.physicalDevice = phys_dev; + params.physicalDevice = physical_device; params.pCreateInfo = create_info; params.pAllocator = allocator; params.pDevice = ret; diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 647b5364564..c13c0534665 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -2642,28 +2642,6 @@ class VkGenerator(object): f.write(conv_helpers) f.write(thunks)
- # Create array of device extensions. - f.write("static const char * const vk_device_extensions[] =\n{\n") - for ext in self.registry.extensions: - if ext["type"] != "device": - continue - if ext["name"] in UNEXPOSED_EXTENSIONS: - 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\n") - f.write("BOOL wine_vk_is_type_wrapped(VkObjectType type)\n") f.write("{\n") f.write(" return FALSE") diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 2ae96e60a8c..dd13d38de06 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -492,14 +492,9 @@ static void wine_vk_device_init_queues(struct wine_device *object, const VkDevic static VkResult wine_vk_device_convert_create_info(struct vulkan_physical_device *physical_device, struct conversion_context *ctx, const VkDeviceCreateInfo *src, VkDeviceCreateInfo *dst, struct wine_device *device) { - bool has_swapchain_maintenance1 = false; - bool has_external_memory_host = false; - bool has_map_memory_placed = false; - bool has_external_memory = false; - bool has_map_memory2 = false; - bool has_swapchain = false; + struct vulkan_instance *instance = physical_device->instance; const char **extensions; - uint32_t count; + uint32_t count = 0;
*dst = *src;
@@ -507,51 +502,17 @@ static VkResult wine_vk_device_convert_create_info(struct vulkan_physical_device dst->enabledLayerCount = 0; dst->ppEnabledLayerNames = NULL;
- count = src->enabledExtensionCount; - extensions = conversion_context_alloc(ctx, (count + 16) * sizeof(*extensions)); - memcpy(extensions, dst->ppEnabledExtensionNames, count * sizeof(*extensions)); - dst->ppEnabledExtensionNames = extensions; + if (device->obj.extensions.has_VK_KHR_win32_keyed_mutex) + device->obj.extensions.has_VK_KHR_timeline_semaphore = 1;
- for (const char **extension = extensions, **end = extension + count; extension < end; extension++) - { - if (!wine_vk_device_extension_supported(*extension)) - { - WARN("Extension %s is not supported.\n", debugstr_a(*extension)); - return VK_ERROR_EXTENSION_NOT_PRESENT; - } - if (!strcmp(*extension, "VK_EXT_map_memory_placed")) has_map_memory_placed = true; - if (!strcmp(*extension, "VK_KHR_map_memory2")) has_map_memory2 = true; - if (!strcmp(*extension, "VK_KHR_external_memory")) has_external_memory = true; - if (!strcmp(*extension, "VK_EXT_external_memory_host")) has_external_memory_host = true; - if (!strcmp(*extension, "VK_EXT_swapchain_maintenance1")) has_swapchain_maintenance1 = true; - if (!strcmp(*extension, "VK_KHR_swapchain")) has_swapchain = true; - if (!strcmp(*extension, "VK_KHR_win32_keyed_mutex")) - { - device->obj.has_win32_keyed_mutex = true; - *extension = "VK_KHR_timeline_semaphore"; - } - if (!strcmp(*extension, "VK_KHR_external_memory_win32")) - { - if (zero_bits && !physical_device->map_placed_align) - { - FIXME("Cannot export WOW64 memory without VK_EXT_map_memory_placed\n"); - return VK_ERROR_EXTENSION_NOT_PRESENT; - } - device->has_external_memory_win32 = true; - *extension = vk_funcs->p_get_host_extension("VK_KHR_external_memory_win32"); - if (!strcmp(*extension, "VK_EXT_external_memory_dma_buf")) extensions[count++] = "VK_KHR_external_memory_fd"; - } - if (!strcmp(*extension, "VK_KHR_external_semaphore_win32")) - { - device->has_external_semaphore_win32 = true; - *extension = vk_funcs->p_get_host_extension("VK_KHR_external_semaphore_win32"); - } - if (!strcmp(*extension, "VK_KHR_external_fence_win32")) - { - device->has_external_fence_win32 = true; - *extension = vk_funcs->p_get_host_extension("VK_KHR_external_fence_win32"); - } - } + vk_funcs->p_map_device_extensions(&device->obj.extensions); + device->obj.extensions.has_VK_KHR_win32_keyed_mutex = 0; + device->obj.extensions.has_VK_KHR_external_memory_win32 = 0; + device->obj.extensions.has_VK_KHR_external_fence_win32 = 0; + device->obj.extensions.has_VK_KHR_external_semaphore_win32 = 0; + + if (device->obj.extensions.has_VK_EXT_external_memory_dma_buf) + device->obj.extensions.has_VK_KHR_external_memory_fd = 1;
if (physical_device->map_placed_align) { @@ -564,23 +525,30 @@ static VkResult wine_vk_device_convert_create_info(struct vulkan_physical_device map_placed_features->memoryUnmapReserve = VK_TRUE; dst->pNext = map_placed_features;
- if (!has_map_memory_placed) extensions[count++] = "VK_EXT_map_memory_placed"; - if (!has_map_memory2) extensions[count++] = "VK_KHR_map_memory2"; + device->obj.extensions.has_VK_EXT_map_memory_placed = 1; + device->obj.extensions.has_VK_KHR_map_memory2 = 1; } else if (physical_device->external_memory_align) { - if (!has_external_memory) extensions[count++] = "VK_KHR_external_memory"; - if (!has_external_memory_host) extensions[count++] = "VK_EXT_external_memory_host"; + device->obj.extensions.has_VK_KHR_external_memory = 1; + device->obj.extensions.has_VK_EXT_external_memory_host = 1; }
/* win32u uses VkSwapchainPresentScalingCreateInfoEXT if available. */ - if (physical_device->extensions.has_VK_EXT_swapchain_maintenance1 && has_swapchain && !has_swapchain_maintenance1) - extensions[count++] = "VK_EXT_swapchain_maintenance1"; + if (device->obj.extensions.has_VK_KHR_swapchain && instance->extensions.has_VK_EXT_surface_maintenance1 && + physical_device->extensions.has_VK_EXT_swapchain_maintenance1) + device->obj.extensions.has_VK_EXT_swapchain_maintenance1 = 1; + + extensions = conversion_context_alloc(ctx, sizeof(device->obj.extensions) * 8 * sizeof(*extensions)); +#define USE_VK_EXT(x) if (device->obj.extensions.has_ ## x) extensions[count++] = #x; + ALL_VK_DEVICE_EXTS +#undef USE_VK_EXT
- TRACE("Enabling %u device extensions\n", count); + TRACE("Enabling %u host device extensions\n", count); for (const char **extension = extensions, **end = extension + count; extension < end; extension++) TRACE(" - %s\n", debugstr_a(*extension));
+ dst->ppEnabledExtensionNames = extensions; dst->enabledExtensionCount = count; return VK_SUCCESS; } @@ -708,6 +676,9 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context * return VK_ERROR_LAYER_NOT_PRESENT; }
+ vk_funcs->p_map_instance_extensions(&instance->obj.extensions); + instance->obj.extensions.has_VK_KHR_win32_surface = 0; + if (instance->obj.extensions.has_VK_EXT_debug_utils || instance->obj.extensions.has_VK_EXT_debug_report) { rb_init(&instance->objects, vulkan_object_compare); @@ -722,9 +693,6 @@ static VkResult wine_vk_instance_convert_create_info(struct conversion_context * instance->obj.extensions.has_VK_KHR_external_memory_capabilities = 1; }
- vk_funcs->p_map_instance_extensions(&instance->obj.extensions); - instance->obj.extensions.has_VK_KHR_win32_surface = 0; - extensions = conversion_context_alloc(ctx, sizeof(instance->obj.extensions) * 8 * sizeof(*extensions)); #define USE_VK_EXT(x) if (instance->obj.extensions.has_ ## x) extensions[count++] = #x; ALL_VK_INSTANCE_EXTS @@ -896,6 +864,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice client_physical_device, const VkDe
if (!(device = calloc(1, offsetof(struct wine_device, queues[queue_count])))) return VK_ERROR_OUT_OF_HOST_MEMORY; + device->obj.extensions = client_device->extensions;
init_conversion_context(&ctx); res = wine_vk_device_convert_create_info(physical_device, &ctx, create_info, &create_info_host, device); @@ -1662,22 +1631,6 @@ static NTSTATUS is_available_instance_function(VkInstance handle, const char *na static NTSTATUS is_available_device_function(VkDevice handle, const char *name) { struct wine_device *device = wine_device_from_handle(handle); - - if (!strcmp(name, "vkGetMemoryWin32HandleKHR")) - return device->has_external_memory_win32; - if (!strcmp(name, "vkGetMemoryWin32HandlePropertiesKHR")) - return device->has_external_memory_win32; - - if (!strcmp(name, "vkGetSemaphoreWin32HandleKHR")) - return device->has_external_semaphore_win32; - if (!strcmp(name, "vkImportSemaphoreWin32HandleKHR")) - return device->has_external_semaphore_win32; - - if (!strcmp(name, "vkGetFenceWin32HandleKHR")) - return device->has_external_fence_win32; - if (!strcmp(name, "vkImportFenceWin32HandleKHR")) - return device->has_external_fence_win32; - return !!vk_funcs->p_vkGetDeviceProcAddr(device->obj.host.device, name); }
diff --git a/dlls/winevulkan/vulkan_loader.h b/dlls/winevulkan/vulkan_loader.h index 9bfc0d87a42..e60467d0658 100644 --- a/dlls/winevulkan/vulkan_loader.h +++ b/dlls/winevulkan/vulkan_loader.h @@ -40,17 +40,6 @@ /* Magic value defined by Vulkan ICD / Loader spec */ #define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
-struct VkQueue_T -{ - struct vulkan_client_object obj; -}; - -struct VkDevice_T -{ - struct vulkan_client_object obj; - struct VkQueue_T queues[1]; -}; - struct vk_command_pool { struct vulkan_client_object obj; diff --git a/dlls/winevulkan/vulkan_private.h b/dlls/winevulkan/vulkan_private.h index a9ddb6dd67d..ad42681af97 100644 --- a/dlls/winevulkan/vulkan_private.h +++ b/dlls/winevulkan/vulkan_private.h @@ -41,9 +41,6 @@ struct wine_queue struct wine_device { struct vulkan_device obj; - bool has_external_memory_win32; - bool has_external_semaphore_win32; - bool has_external_fence_win32; uint64_t queue_count; struct wine_queue queues[]; }; @@ -108,8 +105,6 @@ static inline struct wine_debug_report_callback *wine_debug_report_callback_from return (struct wine_debug_report_callback *)(uintptr_t)handle; }
-BOOL wine_vk_device_extension_supported(const char *name); - BOOL wine_vk_is_type_wrapped(VkObjectType type);
NTSTATUS init_vulkan(void *args); diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index a3cd56d759a..99827f2e7ac 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -61023,364 +61023,6 @@ static NTSTATUS thunk32_vkWriteMicromapsPropertiesEXT(void *args) return STATUS_SUCCESS; }
-static const char * const vk_device_extensions[] = -{ - "VK_AMD_anti_lag", - "VK_AMD_buffer_marker", - "VK_AMD_device_coherent_memory", - "VK_AMD_draw_indirect_count", - "VK_AMD_gcn_shader", - "VK_AMD_gpu_shader_half_float", - "VK_AMD_gpu_shader_int16", - "VK_AMD_memory_overallocation_behavior", - "VK_AMD_mixed_attachment_samples", - "VK_AMD_negative_viewport_height", - "VK_AMD_pipeline_compiler_control", - "VK_AMD_rasterization_order", - "VK_AMD_shader_ballot", - "VK_AMD_shader_core_properties", - "VK_AMD_shader_core_properties2", - "VK_AMD_shader_early_and_late_fragment_tests", - "VK_AMD_shader_explicit_vertex_parameter", - "VK_AMD_shader_fragment_mask", - "VK_AMD_shader_image_load_store_lod", - "VK_AMD_shader_info", - "VK_AMD_shader_trinary_minmax", - "VK_AMD_texture_gather_bias_lod", - "VK_ARM_data_graph", - "VK_ARM_format_pack", - "VK_ARM_pipeline_opacity_micromap", - "VK_ARM_rasterization_order_attachment_access", - "VK_ARM_render_pass_striped", - "VK_ARM_scheduling_controls", - "VK_ARM_shader_core_builtins", - "VK_ARM_shader_core_properties", - "VK_ARM_tensors", - "VK_EXT_4444_formats", - "VK_EXT_astc_decode_mode", - "VK_EXT_attachment_feedback_loop_dynamic_state", - "VK_EXT_attachment_feedback_loop_layout", - "VK_EXT_blend_operation_advanced", - "VK_EXT_border_color_swizzle", - "VK_EXT_buffer_device_address", - "VK_EXT_calibrated_timestamps", - "VK_EXT_color_write_enable", - "VK_EXT_conditional_rendering", - "VK_EXT_conservative_rasterization", - "VK_EXT_custom_border_color", - "VK_EXT_debug_marker", - "VK_EXT_depth_bias_control", - "VK_EXT_depth_clamp_control", - "VK_EXT_depth_clamp_zero_one", - "VK_EXT_depth_clip_control", - "VK_EXT_depth_clip_enable", - "VK_EXT_depth_range_unrestricted", - "VK_EXT_descriptor_buffer", - "VK_EXT_descriptor_indexing", - "VK_EXT_device_address_binding_report", - "VK_EXT_device_fault", - "VK_EXT_device_generated_commands", - "VK_EXT_discard_rectangles", - "VK_EXT_dynamic_rendering_unused_attachments", - "VK_EXT_extended_dynamic_state", - "VK_EXT_extended_dynamic_state2", - "VK_EXT_extended_dynamic_state3", - "VK_EXT_external_memory_acquire_unmodified", - "VK_EXT_external_memory_host", - "VK_EXT_filter_cubic", - "VK_EXT_fragment_density_map", - "VK_EXT_fragment_density_map2", - "VK_EXT_fragment_density_map_offset", - "VK_EXT_fragment_shader_interlock", - "VK_EXT_frame_boundary", - "VK_EXT_global_priority", - "VK_EXT_global_priority_query", - "VK_EXT_graphics_pipeline_library", - "VK_EXT_hdr_metadata", - "VK_EXT_host_image_copy", - "VK_EXT_host_query_reset", - "VK_EXT_image_2d_view_of_3d", - "VK_EXT_image_compression_control", - "VK_EXT_image_compression_control_swapchain", - "VK_EXT_image_robustness", - "VK_EXT_image_sliced_view_of_3d", - "VK_EXT_image_view_min_lod", - "VK_EXT_index_type_uint8", - "VK_EXT_inline_uniform_block", - "VK_EXT_legacy_dithering", - "VK_EXT_legacy_vertex_attributes", - "VK_EXT_line_rasterization", - "VK_EXT_load_store_op_none", - "VK_EXT_memory_budget", - "VK_EXT_memory_priority", - "VK_EXT_mesh_shader", - "VK_EXT_multi_draw", - "VK_EXT_multisampled_render_to_single_sampled", - "VK_EXT_mutable_descriptor_type", - "VK_EXT_nested_command_buffer", - "VK_EXT_non_seamless_cube_map", - "VK_EXT_opacity_micromap", - "VK_EXT_pageable_device_local_memory", - "VK_EXT_pci_bus_info", - "VK_EXT_pipeline_creation_cache_control", - "VK_EXT_pipeline_creation_feedback", - "VK_EXT_pipeline_library_group_handles", - "VK_EXT_pipeline_properties", - "VK_EXT_pipeline_protected_access", - "VK_EXT_pipeline_robustness", - "VK_EXT_post_depth_coverage", - "VK_EXT_present_mode_fifo_latest_ready", - "VK_EXT_primitive_topology_list_restart", - "VK_EXT_primitives_generated_query", - "VK_EXT_private_data", - "VK_EXT_provoking_vertex", - "VK_EXT_queue_family_foreign", - "VK_EXT_rasterization_order_attachment_access", - "VK_EXT_rgba10x6_formats", - "VK_EXT_robustness2", - "VK_EXT_sample_locations", - "VK_EXT_sampler_filter_minmax", - "VK_EXT_scalar_block_layout", - "VK_EXT_separate_stencil_usage", - "VK_EXT_shader_atomic_float", - "VK_EXT_shader_atomic_float2", - "VK_EXT_shader_demote_to_helper_invocation", - "VK_EXT_shader_float8", - "VK_EXT_shader_image_atomic_int64", - "VK_EXT_shader_module_identifier", - "VK_EXT_shader_object", - "VK_EXT_shader_replicated_composites", - "VK_EXT_shader_stencil_export", - "VK_EXT_shader_subgroup_ballot", - "VK_EXT_shader_subgroup_vote", - "VK_EXT_shader_tile_image", - "VK_EXT_shader_viewport_index_layer", - "VK_EXT_subgroup_size_control", - "VK_EXT_subpass_merge_feedback", - "VK_EXT_swapchain_maintenance1", - "VK_EXT_texel_buffer_alignment", - "VK_EXT_texture_compression_astc_hdr", - "VK_EXT_tooling_info", - "VK_EXT_transform_feedback", - "VK_EXT_validation_cache", - "VK_EXT_vertex_attribute_divisor", - "VK_EXT_vertex_attribute_robustness", - "VK_EXT_vertex_input_dynamic_state", - "VK_EXT_ycbcr_2plane_444_formats", - "VK_EXT_ycbcr_image_arrays", - "VK_EXT_zero_initialize_device_memory", - "VK_GOOGLE_decorate_string", - "VK_GOOGLE_hlsl_functionality1", - "VK_GOOGLE_user_type", - "VK_HUAWEI_cluster_culling_shader", - "VK_HUAWEI_hdr_vivid", - "VK_HUAWEI_invocation_mask", - "VK_HUAWEI_subpass_shading", - "VK_IMG_filter_cubic", - "VK_IMG_format_pvrtc", - "VK_IMG_relaxed_line_rasterization", - "VK_INTEL_performance_query", - "VK_INTEL_shader_integer_functions2", - "VK_KHR_16bit_storage", - "VK_KHR_8bit_storage", - "VK_KHR_acceleration_structure", - "VK_KHR_bind_memory2", - "VK_KHR_buffer_device_address", - "VK_KHR_calibrated_timestamps", - "VK_KHR_compute_shader_derivatives", - "VK_KHR_cooperative_matrix", - "VK_KHR_copy_commands2", - "VK_KHR_copy_memory_indirect", - "VK_KHR_create_renderpass2", - "VK_KHR_dedicated_allocation", - "VK_KHR_deferred_host_operations", - "VK_KHR_depth_clamp_zero_one", - "VK_KHR_depth_stencil_resolve", - "VK_KHR_descriptor_update_template", - "VK_KHR_device_group", - "VK_KHR_draw_indirect_count", - "VK_KHR_driver_properties", - "VK_KHR_dynamic_rendering", - "VK_KHR_dynamic_rendering_local_read", - "VK_KHR_external_fence", - "VK_KHR_external_fence_win32", - "VK_KHR_external_memory", - "VK_KHR_external_memory_win32", - "VK_KHR_external_semaphore", - "VK_KHR_external_semaphore_win32", - "VK_KHR_format_feature_flags2", - "VK_KHR_fragment_shader_barycentric", - "VK_KHR_fragment_shading_rate", - "VK_KHR_get_memory_requirements2", - "VK_KHR_global_priority", - "VK_KHR_image_format_list", - "VK_KHR_imageless_framebuffer", - "VK_KHR_incremental_present", - "VK_KHR_index_type_uint8", - "VK_KHR_line_rasterization", - "VK_KHR_load_store_op_none", - "VK_KHR_maintenance1", - "VK_KHR_maintenance2", - "VK_KHR_maintenance3", - "VK_KHR_maintenance4", - "VK_KHR_maintenance5", - "VK_KHR_maintenance6", - "VK_KHR_maintenance8", - "VK_KHR_maintenance9", - "VK_KHR_map_memory2", - "VK_KHR_multiview", - "VK_KHR_performance_query", - "VK_KHR_pipeline_binary", - "VK_KHR_pipeline_executable_properties", - "VK_KHR_pipeline_library", - "VK_KHR_present_id", - "VK_KHR_present_id2", - "VK_KHR_present_mode_fifo_latest_ready", - "VK_KHR_present_wait", - "VK_KHR_present_wait2", - "VK_KHR_push_descriptor", - "VK_KHR_ray_query", - "VK_KHR_ray_tracing_maintenance1", - "VK_KHR_ray_tracing_pipeline", - "VK_KHR_ray_tracing_position_fetch", - "VK_KHR_relaxed_block_layout", - "VK_KHR_robustness2", - "VK_KHR_sampler_mirror_clamp_to_edge", - "VK_KHR_sampler_ycbcr_conversion", - "VK_KHR_separate_depth_stencil_layouts", - "VK_KHR_shader_atomic_int64", - "VK_KHR_shader_bfloat16", - "VK_KHR_shader_clock", - "VK_KHR_shader_draw_parameters", - "VK_KHR_shader_expect_assume", - "VK_KHR_shader_float16_int8", - "VK_KHR_shader_float_controls", - "VK_KHR_shader_float_controls2", - "VK_KHR_shader_fma", - "VK_KHR_shader_integer_dot_product", - "VK_KHR_shader_maximal_reconvergence", - "VK_KHR_shader_non_semantic_info", - "VK_KHR_shader_quad_control", - "VK_KHR_shader_relaxed_extended_instruction", - "VK_KHR_shader_subgroup_extended_types", - "VK_KHR_shader_subgroup_rotate", - "VK_KHR_shader_subgroup_uniform_control_flow", - "VK_KHR_shader_terminate_invocation", - "VK_KHR_shader_untyped_pointers", - "VK_KHR_spirv_1_4", - "VK_KHR_storage_buffer_storage_class", - "VK_KHR_swapchain", - "VK_KHR_swapchain_maintenance1", - "VK_KHR_swapchain_mutable_format", - "VK_KHR_synchronization2", - "VK_KHR_timeline_semaphore", - "VK_KHR_unified_image_layouts", - "VK_KHR_uniform_buffer_standard_layout", - "VK_KHR_variable_pointers", - "VK_KHR_vertex_attribute_divisor", - "VK_KHR_video_decode_av1", - "VK_KHR_video_decode_h264", - "VK_KHR_video_decode_queue", - "VK_KHR_video_decode_vp9", - "VK_KHR_video_encode_av1", - "VK_KHR_video_encode_h264", - "VK_KHR_video_encode_intra_refresh", - "VK_KHR_video_encode_quantization_map", - "VK_KHR_video_encode_queue", - "VK_KHR_video_maintenance1", - "VK_KHR_video_queue", - "VK_KHR_vulkan_memory_model", - "VK_KHR_win32_keyed_mutex", - "VK_KHR_workgroup_memory_explicit_layout", - "VK_KHR_zero_initialize_workgroup_memory", - "VK_MESA_image_alignment_control", - "VK_MSFT_layered_driver", - "VK_NVX_binary_import", - "VK_NVX_image_view_handle", - "VK_NV_clip_space_w_scaling", - "VK_NV_cluster_acceleration_structure", - "VK_NV_command_buffer_inheritance", - "VK_NV_compute_shader_derivatives", - "VK_NV_cooperative_matrix", - "VK_NV_cooperative_matrix2", - "VK_NV_cooperative_vector", - "VK_NV_copy_memory_indirect", - "VK_NV_corner_sampled_image", - "VK_NV_coverage_reduction_mode", - "VK_NV_dedicated_allocation", - "VK_NV_dedicated_allocation_image_aliasing", - "VK_NV_descriptor_pool_overallocation", - "VK_NV_device_diagnostic_checkpoints", - "VK_NV_device_diagnostics_config", - "VK_NV_device_generated_commands", - "VK_NV_device_generated_commands_compute", - "VK_NV_extended_sparse_address_space", - "VK_NV_fill_rectangle", - "VK_NV_fragment_coverage_to_color", - "VK_NV_fragment_shader_barycentric", - "VK_NV_fragment_shading_rate_enums", - "VK_NV_framebuffer_mixed_samples", - "VK_NV_geometry_shader_passthrough", - "VK_NV_glsl_shader", - "VK_NV_inherited_viewport_scissor", - "VK_NV_linear_color_attachment", - "VK_NV_low_latency", - "VK_NV_low_latency2", - "VK_NV_memory_decompression", - "VK_NV_mesh_shader", - "VK_NV_optical_flow", - "VK_NV_partitioned_acceleration_structure", - "VK_NV_per_stage_descriptor_set", - "VK_NV_present_barrier", - "VK_NV_raw_access_chains", - "VK_NV_ray_tracing", - "VK_NV_ray_tracing_invocation_reorder", - "VK_NV_ray_tracing_linear_swept_spheres", - "VK_NV_ray_tracing_motion_blur", - "VK_NV_ray_tracing_validation", - "VK_NV_representative_fragment_test", - "VK_NV_sample_mask_override_coverage", - "VK_NV_scissor_exclusive", - "VK_NV_shader_atomic_float16_vector", - "VK_NV_shader_image_footprint", - "VK_NV_shader_sm_builtins", - "VK_NV_shader_subgroup_partitioned", - "VK_NV_shading_rate_image", - "VK_NV_viewport_array2", - "VK_NV_viewport_swizzle", - "VK_QCOM_filter_cubic_clamp", - "VK_QCOM_filter_cubic_weights", - "VK_QCOM_fragment_density_map_offset", - "VK_QCOM_image_processing", - "VK_QCOM_image_processing2", - "VK_QCOM_multiview_per_view_render_areas", - "VK_QCOM_multiview_per_view_viewports", - "VK_QCOM_render_pass_shader_resolve", - "VK_QCOM_render_pass_store_ops", - "VK_QCOM_render_pass_transform", - "VK_QCOM_rotated_copy_commands", - "VK_QCOM_tile_memory_heap", - "VK_QCOM_tile_properties", - "VK_QCOM_tile_shading", - "VK_QCOM_ycbcr_degamma", - "VK_SEC_pipeline_cache_incremental_mode", - "VK_VALVE_descriptor_set_host_mapping", - "VK_VALVE_fragment_density_map_layered", - "VK_VALVE_mutable_descriptor_type", - "VK_VALVE_video_encode_rgb_conversion", -}; - -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; -} - BOOL wine_vk_is_type_wrapped(VkObjectType type) { return FALSE || diff --git a/dlls/winewayland.drv/vulkan.c b/dlls/winewayland.drv/vulkan.c index 3b07ccb24ec..f8fd372757d 100644 --- a/dlls/winewayland.drv/vulkan.c +++ b/dlls/winewayland.drv/vulkan.c @@ -81,14 +81,6 @@ static VkBool32 wayland_get_physical_device_presentation_support(struct vulkan_p process_wayland.wl_display); }
-static const char *wayland_get_host_extension(const char *name) -{ - if (!strcmp( name, "VK_KHR_external_memory_win32" )) return "VK_KHR_external_memory_fd"; - if (!strcmp( name, "VK_KHR_external_semaphore_win32" )) return "VK_KHR_external_semaphore_fd"; - if (!strcmp( name, "VK_KHR_external_fence_win32" )) return "VK_KHR_external_fence_fd"; - return name; -} - static void wayland_map_instance_extensions(struct vulkan_instance_extensions *extensions) { if (extensions->has_VK_KHR_win32_surface) extensions->has_VK_KHR_wayland_surface = 1; @@ -109,7 +101,6 @@ static const struct vulkan_driver_funcs wayland_vulkan_driver_funcs = { .p_vulkan_surface_create = wayland_vulkan_surface_create, .p_get_physical_device_presentation_support = wayland_get_physical_device_presentation_support, - .p_get_host_extension = wayland_get_host_extension, .p_map_instance_extensions = wayland_map_instance_extensions, .p_map_device_extensions = wayland_map_device_extensions, }; diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 5d6c07b3863..421971178a7 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -78,14 +78,6 @@ static VkBool32 X11DRV_get_physical_device_presentation_support( struct vulkan_p default_visual.visual->visualid ); }
-static const char *X11DRV_get_host_extension( const char *name ) -{ - if (!strcmp( name, "VK_KHR_external_memory_win32" )) return "VK_KHR_external_memory_fd"; - if (!strcmp( name, "VK_KHR_external_semaphore_win32" )) return "VK_KHR_external_semaphore_fd"; - if (!strcmp( name, "VK_KHR_external_fence_win32" )) return "VK_KHR_external_fence_fd"; - return name; -} - static void X11DRV_map_instance_extensions( struct vulkan_instance_extensions *extensions ) { if (extensions->has_VK_KHR_win32_surface) extensions->has_VK_KHR_xlib_surface = 1; @@ -106,7 +98,6 @@ static const struct vulkan_driver_funcs x11drv_vulkan_driver_funcs = { .p_vulkan_surface_create = X11DRV_vulkan_surface_create, .p_get_physical_device_presentation_support = X11DRV_get_physical_device_presentation_support, - .p_get_host_extension = X11DRV_get_host_extension, .p_map_instance_extensions = X11DRV_map_instance_extensions, .p_map_device_extensions = X11DRV_map_device_extensions, }; diff --git a/include/wine/vulkan_driver.h b/include/wine/vulkan_driver.h index 8c475ef77a9..fd1d0ec64c4 100644 --- a/include/wine/vulkan_driver.h +++ b/include/wine/vulkan_driver.h @@ -71,6 +71,18 @@ struct VkInstance_T struct VkPhysicalDevice_T phys_devs[1]; };
+struct VkQueue_T +{ + struct vulkan_client_object obj; +}; + +struct VkDevice_T +{ + struct vulkan_client_object obj; + struct vulkan_device_extensions extensions; + struct VkQueue_T queues[1]; +}; + #ifdef WINE_UNIX_LIB
#include "wine/rbtree.h" @@ -142,7 +154,7 @@ struct vulkan_device { VULKAN_OBJECT_HEADER( VkDevice, device ); struct vulkan_physical_device *physical_device; - bool has_win32_keyed_mutex; + struct vulkan_device_extensions extensions; #define USE_VK_FUNC(x) PFN_ ## x p_ ## x; ALL_VK_DEVICE_FUNCS #undef USE_VK_FUNC @@ -286,7 +298,6 @@ struct vulkan_funcs PFN_vkUnmapMemory2KHR p_vkUnmapMemory2KHR;
/* winevulkan specific functions */ - const char *(*p_get_host_extension)( const char *name ); void (*p_map_instance_extensions)( struct vulkan_instance_extensions *extensions ); void (*p_map_device_extensions)( struct vulkan_device_extensions *extensions ); }; @@ -297,7 +308,6 @@ struct vulkan_driver_funcs { VkResult (*p_vulkan_surface_create)(HWND, const struct vulkan_instance *, VkSurfaceKHR *, struct client_surface **); VkBool32 (*p_get_physical_device_presentation_support)(struct vulkan_physical_device *, uint32_t); - const char *(*p_get_host_extension)( const char *name ); void (*p_map_instance_extensions)( struct vulkan_instance_extensions *extensions ); void (*p_map_device_extensions)( struct vulkan_device_extensions *extensions ); };