From: "Rémi Bernon" Subject: [PATCH vkd3d v2 1/2] vkd3d: Add support for KHR_timeline_semaphore extension. Message-Id: <20200108100755.20046-1-rbernon@codeweavers.com> Date: Wed, 8 Jan 2020 11:07:54 +0100 This also updates the Vulkan-Headers required version to 1.1.126, which is the first released SDK version that includes the extension. Signed-off-by: Rémi Bernon --- README | 2 +- configure.ac | 2 +- libs/vkd3d/device.c | 23 +++++++++++++++++++++++ libs/vkd3d/vkd3d_private.h | 3 +++ libs/vkd3d/vulkan_procs.h | 3 +++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/README b/README index 3c70ede8..16535f43 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ similar, but not identical, to Direct3D 12. Building vkd3d ============== -Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.113). +Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.1.126). Vkd3d generates some of its headers from IDL files. If you are using the release tarballs, then these headers are pre-generated and are included. If diff --git a/configure.ac b/configure.ac index 355aaabf..7ff32073 100644 --- a/configure.ac +++ b/configure.ac @@ -69,7 +69,7 @@ AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \ -a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"], [AC_MSG_ERROR([GLSL.std.450.h not found.])]) -VKD3D_CHECK_VULKAN_HEADER_VERSION([113], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.113 is required.])]) +VKD3D_CHECK_VULKAN_HEADER_VERSION([126], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.126 is required.])]) AC_CHECK_DECL([SpvCapabilityDemoteToHelperInvocationEXT],, [AC_MSG_ERROR([SPIR-V headers are too old.])], [ #ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 757d4ac8..28d4975a 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -127,6 +127,7 @@ static const struct vkd3d_optional_extension_info optional_device_extensions[] = VK_EXTENSION(KHR_IMAGE_FORMAT_LIST, KHR_image_format_list), VK_EXTENSION(KHR_MAINTENANCE3, KHR_maintenance3), VK_EXTENSION(KHR_PUSH_DESCRIPTOR, KHR_push_descriptor), + VK_EXTENSION(KHR_TIMELINE_SEMAPHORE, KHR_timeline_semaphore), /* EXT extensions */ VK_EXTENSION(EXT_CONDITIONAL_RENDERING, EXT_conditional_rendering), VK_EXTENSION(EXT_DEBUG_MARKER, EXT_debug_marker), @@ -664,6 +665,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT texel_buffer_alignment_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties; + VkPhysicalDeviceTimelineSemaphorePropertiesKHR timeline_semaphore_properties; VkPhysicalDeviceProperties2KHR properties2; @@ -675,6 +677,7 @@ struct vkd3d_physical_device_info VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT texel_buffer_alignment_features; VkPhysicalDeviceTransformFeedbackFeaturesEXT xfb_features; VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT vertex_divisor_features; + VkPhysicalDeviceTimelineSemaphoreFeaturesKHR timeline_semaphore_features; VkPhysicalDeviceFeatures2 features2; }; @@ -693,8 +696,10 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; VkPhysicalDeviceMaintenance3Properties *maintenance3_properties; VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb_properties; + VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore_properties; VkPhysicalDevice physical_device = device->vk_physical_device; VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb_features; + VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore_features; struct vkd3d_vulkan_info *vulkan_info = &device->vk_info; memset(info, 0, sizeof(*info)); @@ -710,6 +715,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vertex_divisor_properties = &info->vertex_divisor_properties; xfb_features = &info->xfb_features; xfb_properties = &info->xfb_properties; + timeline_semaphore_properties = &info->timeline_semaphore_properties; + timeline_semaphore_features = &info->timeline_semaphore_features; info->features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; @@ -727,6 +734,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->features2, xfb_features); vertex_divisor_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; vk_prepend_struct(&info->features2, vertex_divisor_features); + timeline_semaphore_features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR; + vk_prepend_struct(&info->features2, timeline_semaphore_features); if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceFeatures2KHR(physical_device, &info->features2)); @@ -745,6 +754,8 @@ static void vkd3d_physical_device_info_init(struct vkd3d_physical_device_info *i vk_prepend_struct(&info->properties2, xfb_properties); vertex_divisor_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; vk_prepend_struct(&info->properties2, vertex_divisor_properties); + timeline_semaphore_properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR; + vk_prepend_struct(&info->properties2, timeline_semaphore_properties); if (vulkan_info->KHR_get_physical_device_properties2) VK_CALL(vkGetPhysicalDeviceProperties2KHR(physical_device, &info->properties2)); @@ -817,6 +828,7 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic const VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT *buffer_alignment; const VkPhysicalDeviceMaintenance3Properties *maintenance3; const VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb; + const VkPhysicalDeviceTimelineSemaphorePropertiesKHR *timeline_semaphore; TRACE("Device limits:\n"); TRACE(" maxImageDimension1D: %u.\n", limits->maxImageDimension1D); @@ -1021,6 +1033,10 @@ static void vkd3d_trace_physical_device_limits(const struct vkd3d_physical_devic divisor_properties = &info->vertex_divisor_properties; TRACE(" VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT:\n"); TRACE(" maxVertexAttribDivisor: %u.\n", divisor_properties->maxVertexAttribDivisor); + + timeline_semaphore = &info->timeline_semaphore_properties; + TRACE(" VkPhysicalDeviceTimelineSemaphorePropertiesKHR:\n"); + TRACE(" maxTimelineSemaphoreValueDifference: %"PRIu64".\n", timeline_semaphore->maxTimelineSemaphoreValueDifference); } static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_device_info *info) @@ -1033,6 +1049,7 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev const VkPhysicalDeviceDepthClipEnableFeaturesEXT *depth_clip_features; const VkPhysicalDeviceFeatures *features = &info->features2.features; const VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb; + const VkPhysicalDeviceTimelineSemaphoreFeaturesKHR *timeline_semaphore; TRACE("Device features:\n"); TRACE(" robustBufferAccess: %#x.\n", features->robustBufferAccess); @@ -1165,6 +1182,10 @@ static void vkd3d_trace_physical_device_features(const struct vkd3d_physical_dev divisor_features->vertexAttributeInstanceRateDivisor); TRACE(" vertexAttributeInstanceRateZeroDivisor: %#x.\n", divisor_features->vertexAttributeInstanceRateZeroDivisor); + + timeline_semaphore = &info->timeline_semaphore_features; + TRACE(" VkPhysicalDeviceTimelineSemaphoreFeaturesKHR:\n"); + TRACE(" timelineSemaphore: %#x.\n", timeline_semaphore->timelineSemaphore); } static void vkd3d_init_feature_level(struct vkd3d_vulkan_info *vk_info, @@ -1294,6 +1315,8 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, vulkan_info->transform_feedback_queries = physical_device_info->xfb_properties.transformFeedbackQueries; vulkan_info->max_vertex_attrib_divisor = max(physical_device_info->vertex_divisor_properties.maxVertexAttribDivisor, 1); + vulkan_info->max_timeline_semaphore_value_difference = max(physical_device_info->timeline_semaphore_properties.maxTimelineSemaphoreValueDifference, 1); + device->feature_options.DoublePrecisionFloatShaderOps = features->shaderFloat64; device->feature_options.OutputMergerLogicOp = features->logicOp; /* SPV_KHR_16bit_storage */ diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 0c031d20..84abcb8d 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -100,6 +100,7 @@ struct vkd3d_vulkan_info bool KHR_image_format_list; bool KHR_maintenance3; bool KHR_push_descriptor; + bool KHR_timeline_semaphore; /* EXT device extensions */ bool EXT_conditional_rendering; bool EXT_debug_marker; @@ -116,6 +117,8 @@ struct vkd3d_vulkan_info bool vertex_attrib_zero_divisor; unsigned int max_vertex_attrib_divisor; + uint64_t max_timeline_semaphore_value_difference; + VkPhysicalDeviceLimits device_limits; VkPhysicalDeviceSparseProperties sparse_properties; diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h index ec29eb45..d080278a 100644 --- a/libs/vkd3d/vulkan_procs.h +++ b/libs/vkd3d/vulkan_procs.h @@ -206,6 +206,9 @@ VK_DEVICE_EXT_PFN(vkCmdBindTransformFeedbackBuffersEXT) VK_DEVICE_EXT_PFN(vkCmdEndQueryIndexedEXT) VK_DEVICE_EXT_PFN(vkCmdEndTransformFeedbackEXT) +/* VK_KHR_timeline_semaphore */ +VK_DEVICE_EXT_PFN(vkSignalSemaphoreKHR) + #undef VK_INSTANCE_PFN #undef VK_INSTANCE_EXT_PFN #undef VK_DEVICE_PFN -- 2.24.1