From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/device.c | 24 ++++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 1 + libs/vkd3d/vulkan_procs.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 419b9042b178..fca446160db8 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -64,6 +64,8 @@ static const char * const required_device_extensions[] = static const struct vkd3d_optional_extension_info optional_device_extensions[] = { {VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, KHR_push_descriptor)}, + {VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, + offsetof(struct vkd3d_vulkan_info, EXT_vertex_attribute_divisor)}, };
static bool is_extension_disabled(const char *extension_name) @@ -993,9 +995,11 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, { unsigned int direct_queue_family_index, copy_queue_family_index, compute_queue_family_index; const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs; + VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features; + struct vkd3d_vulkan_info *vulkan_info = &device->vk_info; VkQueueFamilyProperties *queue_properties = NULL; VkDeviceQueueCreateInfo *queue_info = NULL; - VkPhysicalDeviceFeatures device_features; + VkPhysicalDeviceFeatures2 features2; VkPhysicalDevice physical_device; VkDeviceCreateInfo device_info; uint32_t queue_family_count; @@ -1082,11 +1086,19 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,
VK_CALL(vkGetPhysicalDeviceMemoryProperties(physical_device, &device->memory_properties));
- VK_CALL(vkGetPhysicalDeviceFeatures(physical_device, &device_features)); - if (FAILED(hr = vkd3d_init_device_caps(device, create_info, &device_features, &extension_count))) + memset(&vertex_divisor_features, 0, sizeof(vertex_divisor_features)); + vertex_divisor_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; + features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + features2.pNext = &vertex_divisor_features; + if (vulkan_info->KHR_get_physical_device_properties2) + VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &features2)); + else + VK_CALL(vkGetPhysicalDeviceFeatures(physical_device, &features2.features)); + + if (FAILED(hr = vkd3d_init_device_caps(device, create_info, &features2.features, &extension_count))) goto done;
- device_features.shaderTessellationAndGeometryPointSize = VK_FALSE; + features2.features.shaderTessellationAndGeometryPointSize = VK_FALSE;
if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions)))) { @@ -1096,7 +1108,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device,
/* Create device */ device_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; - device_info.pNext = NULL; + device_info.pNext = &vertex_divisor_features; device_info.flags = 0; device_info.queueCreateInfoCount = queue_family_count; device_info.pQueueCreateInfos = queue_info; @@ -1108,7 +1120,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, create_info->device_extensions, create_info->device_extension_count, NULL, 0, NULL, &device->vk_info); device_info.ppEnabledExtensionNames = extensions; - device_info.pEnabledFeatures = &device_features; + device_info.pEnabledFeatures = &features2.features;
vr = VK_CALL(vkCreateDevice(physical_device, &device_info, NULL, &vk_device)); vkd3d_free(extensions); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4be160b89b9c..e4e1e118cc0a 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -83,6 +83,7 @@ struct vkd3d_vulkan_info bool EXT_debug_report; /* device extensions */ bool KHR_push_descriptor; + bool EXT_vertex_attribute_divisor;
VkPhysicalDeviceLimits device_limits; VkPhysicalDeviceSparseProperties sparse_properties; diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h index 690a1a2b5acf..e14121c1a76b 100644 --- a/libs/vkd3d/vulkan_procs.h +++ b/libs/vkd3d/vulkan_procs.h @@ -46,6 +46,8 @@ VK_INSTANCE_PFN(vkGetPhysicalDeviceMemoryProperties) VK_INSTANCE_PFN(vkGetPhysicalDeviceProperties) VK_INSTANCE_PFN(vkGetPhysicalDeviceQueueFamilyProperties) VK_INSTANCE_PFN(vkGetPhysicalDeviceSparseImageFormatProperties) +/* VK_KHR_get_physical_device_properties2 */ +VK_INSTANCE_EXT_PFN(vkGetPhysicalDeviceFeatures2KHR) /* VK_EXT_debug_report */ VK_INSTANCE_EXT_PFN(vkCreateDebugReportCallbackEXT) VK_INSTANCE_EXT_PFN(vkDestroyDebugReportCallbackEXT)
Józef Kucia joseph.kucia@gmail.com writes:
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com
libs/vkd3d/device.c | 24 ++++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 1 + libs/vkd3d/vulkan_procs.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-)
This doesn't build on Debian, since it still has vulkan 1.1.73. Do we need to ship our own headers?
libs/vkd3d/device.c: In function ‘vkd3d_create_vk_device’: libs/vkd3d/device.c:998:5: error: unknown type name ‘VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT’; did you mean ‘VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT’? VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT libs/vkd3d/device.c:1090:28: error: request for member ‘sType’ in something not a structure or union vertex_divisor_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; ^ libs/vkd3d/device.c:1090:37: error: ‘VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT’ undeclared (first use in this function); did you mean ‘VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT’? vertex_divisor_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT libs/vkd3d/device.c:1090:37: note: each undeclared identifier is reported only once for each function it appears in
On Thu, 25 Oct 2018 at 15:45, Alexandre Julliard julliard@winehq.org wrote:
This doesn't build on Debian, since it still has vulkan 1.1.73. Do we need to ship our own headers?
I suppose we could without too much effort, but personally I build against the headers from https://github.com/KhronosGroup/Vulkan-Headers, which in practice you'll probably need when doing just about anything with Vulkan.
On Thu, Oct 25, 2018 at 2:15 PM Alexandre Julliard julliard@winehq.org wrote:
Józef Kucia joseph.kucia@gmail.com writes:
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com
libs/vkd3d/device.c | 24 ++++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 1 + libs/vkd3d/vulkan_procs.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-)
This doesn't build on Debian, since it still has vulkan 1.1.73. Do we need to ship our own headers?
It might be an option to import Vulkan headers. However, official Vulkan headers are licensed under Apache License 2.0, and when I tried to import SPIR-V headers it was decided to avoid importing headers. Other option is to build with Vulkan SDK before Vulkan is updated on Debian. We could also consider adding #ifdefs, but I personally don't like the idea of sprinkling code with #ifdefs for old Vulkan headers.
On 10/25/18 2:15 PM, Alexandre Julliard wrote:
Józef Kucia joseph.kucia@gmail.com writes:
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com
libs/vkd3d/device.c | 24 ++++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 1 + libs/vkd3d/vulkan_procs.h | 2 ++ 3 files changed, 21 insertions(+), 6 deletions(-)
This doesn't build on Debian, since it still has vulkan 1.1.73. Do we need to ship our own headers?
[ I'm not member of the respective Debian packaging team, haven't worked on current Wine versions since they use vulkan, and barely know what vulkan is all about. The following is only what I just found out: ]
It seems the old vulkan upstream repository[1] was split after the 1.1.73 release:
https://github.com/KhronosGroup/Vulkan-Headers https://github.com/KhronosGroup/Vulkan-Loader https://github.com/KhronosGroup/Vulkan-ValidationLayers https://github.com/KhronosGroup/Vulkan-Tools
Debian already has a new package "vulkan-headers"[1]. Is that all we need for building Wine?
vulkan-headers in Debian is at version 1.1.82.0-1 (packaged 3 weeks after the upstream release). The next and current upstream release 1.1.85 was 3 weeks ago. So I assume it might appear very soon in Debian, otherwise we can file a wishlist bug.
There will also be "vulkan-loader" (1.1.82.0-1). No idea if this is needed for Wine. But it's waiting in Debian's NEW-queue[3] since a month. Once it has been accepted it will be in the archive (the current upload targets only experimental). Future uploads will then go straight to the archive.
Hope that helps. I'm now doing a test build of 3.18 with vulkan-headers instead of vulkan, but that might take a while.
Greets jre
[1] https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers [2] https://tracker.debian.org/pkg/vulkan-headers [3] https://ftp-master.debian.org/new.html
On Thu, Oct 25, 2018 at 7:49 PM Jens Reyer jre.winesim@gmail.com wrote:
[ I'm not member of the respective Debian packaging team, haven't worked on current Wine versions since they use vulkan, and barely know what vulkan is all about. The following is only what I just found out: ]
It seems the old vulkan upstream repository[1] was split after the 1.1.73 release:
https://github.com/KhronosGroup/Vulkan-Headers https://github.com/KhronosGroup/Vulkan-Loader https://github.com/KhronosGroup/Vulkan-ValidationLayers https://github.com/KhronosGroup/Vulkan-Tools
Debian already has a new package "vulkan-headers"[1]. Is that all we need for building Wine?
vulkan-headers in Debian is at version 1.1.82.0-1 (packaged 3 weeks after the upstream release). The next and current upstream release 1.1.85 was 3 weeks ago. So I assume it might appear very soon in Debian, otherwise we can file a wishlist bug.
Unfortunately, 1.1.82 is not enough to build vkd3d, 1.1.84 is required.
For Wine, Vulkan Headers are not needed at all. Wine has its own Vulkan headers generated from vk.xml. Vulkan loader is required, but it should be possible to build and use Wine with any version of Vulkan loader.
On Fri, 26 Oct 2018 at 01:06, Józef Kucia joseph.kucia@gmail.com wrote:
Unfortunately, 1.1.82 is not enough to build vkd3d, 1.1.84 is required.
On a slight tangent, perhaps we should have configure check VK_HEADER_VERSION.