From 5759cb52e05960bedfc7ec24dbf14ffa4b4bb073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 14 Jan 2019 17:05:38 +0100 Subject: [PATCH] vkd3d: Enable VK_EXT_transform_feedback. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- configure.ac | 2 +- libs/vkd3d/device.c | 39 ++++++++++++++++++++++++++++++++++++++ libs/vkd3d/vkd3d_private.h | 1 + libs/vkd3d/vulkan_procs.h | 6 ++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8c82741a..6e552795 100644 --- a/configure.ac +++ b/configure.ac @@ -61,7 +61,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([84], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.84 is required.])]) +VKD3D_CHECK_VULKAN_HEADER_VERSION([88], [AC_MSG_ERROR([Vulkan headers are too old, 1.1.88 is required.])]) dnl Check for libraries m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], [m4_fatal([pkg-config autoconf macros not found.])]) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 9b09f66b..71666f96 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -84,6 +84,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_TRANSFORM_FEEDBACK_EXTENSION_NAME, + offsetof(struct vkd3d_vulkan_info, EXT_transform_feedback)}, {VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME, offsetof(struct vkd3d_vulkan_info, EXT_vertex_attribute_divisor)}, }; @@ -621,6 +623,7 @@ static void vkd3d_trace_physical_device_limits(const VkPhysicalDeviceProperties2 { const VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *divisor_properties; const VkPhysicalDeviceLimits *limits = &properties2->properties.limits; + const VkPhysicalDeviceTransformFeedbackPropertiesEXT *xfb; TRACE("Device limits:\n"); TRACE(" maxImageDimension1D: %u.\n", limits->maxImageDimension1D); @@ -739,6 +742,22 @@ static void vkd3d_trace_physical_device_limits(const VkPhysicalDeviceProperties2 TRACE(" optimalBufferCopyRowPitchAlignment: %#"PRIx64".\n", limits->optimalBufferCopyRowPitchAlignment); TRACE(" nonCoherentAtomSize: %#"PRIx64".\n", limits->nonCoherentAtomSize); + xfb = vk_find_struct(properties2->pNext, PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT); + if (xfb) + { + TRACE(" VkPhysicalDeviceTransformFeedbackPropertiesEXT:\n"); + TRACE(" maxTransformFeedbackStreams: %u.\n", xfb->maxTransformFeedbackStreams); + TRACE(" maxTransformFeedbackBuffers: %u.\n", xfb->maxTransformFeedbackBuffers); + TRACE(" maxTransformFeedbackBufferSize: %#"PRIx64".\n", xfb->maxTransformFeedbackBufferSize); + TRACE(" maxTransformFeedbackStreamDataSize: %u.\n", xfb->maxTransformFeedbackStreamDataSize); + TRACE(" maxTransformFeedbackBufferDataSize: %u.\n", xfb->maxTransformFeedbackBufferDataSize); + TRACE(" maxTransformFeedbackBufferDataStride: %u.\n", xfb->maxTransformFeedbackBufferDataStride); + TRACE(" transformFeedbackQueries: %#x.\n", xfb->transformFeedbackQueries); + TRACE(" transformFeedbackStreamsLinesTriangles: %#x.\n", xfb->transformFeedbackStreamsLinesTriangles); + TRACE(" transformFeedbackRasterizationStreamSelect: %#x.\n", xfb->transformFeedbackRasterizationStreamSelect); + TRACE(" transformFeedbackDraw: %x.\n", xfb->transformFeedbackDraw); + } + divisor_properties = vk_find_struct(properties2->pNext, PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT); if (divisor_properties) @@ -752,6 +771,7 @@ static void vkd3d_trace_physical_device_features(const VkPhysicalDeviceFeatures2 { const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *divisor_features; const VkPhysicalDeviceFeatures *features = &features2->features; + const VkPhysicalDeviceTransformFeedbackFeaturesEXT *xfb; TRACE("Device features:\n"); TRACE(" robustBufferAccess: %#x.\n", features->robustBufferAccess); @@ -810,6 +830,14 @@ static void vkd3d_trace_physical_device_features(const VkPhysicalDeviceFeatures2 TRACE(" variableMultisampleRate: %#x.\n", features->variableMultisampleRate); TRACE(" inheritedQueries: %#x.\n", features->inheritedQueries); + xfb = vk_find_struct(features2->pNext, PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT); + if (xfb) + { + TRACE(" VkPhysicalDeviceTransformFeedbackFeaturesEXT:\n"); + TRACE(" transformFeedback: %#x.\n", xfb->transformFeedback); + TRACE(" geometryStreams: %#x.\n", xfb->geometryStreams); + } + divisor_features = vk_find_struct(features2->pNext, PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT); if (divisor_features) { @@ -863,6 +891,9 @@ static void vkd3d_check_feature_level_11_requirements(const struct vkd3d_vulkan_ CHECK_FEATURE(shaderClipDistance); CHECK_FEATURE(shaderCullDistance); + if (!vk_info->EXT_transform_feedback) + WARN("Stream output is not supported.\n"); + if (!vk_info->EXT_vertex_attribute_divisor) WARN("Vertex attribute instance rate divisor is not supported.\n"); else if (!vk_info->vertex_attrib_zero_divisor) @@ -880,6 +911,7 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs; VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT vertex_divisor_properties; const VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *divisor_features; + VkPhysicalDeviceTransformFeedbackPropertiesEXT xfb_properties; VkPhysicalDevice physical_device = device->vk_physical_device; VkPhysicalDeviceFeatures *features = &features2->features; struct vkd3d_vulkan_info *vulkan_info = &device->vk_info; @@ -892,8 +924,11 @@ static HRESULT vkd3d_init_device_caps(struct d3d12_device *device, vkd3d_trace_physical_device_features(features2); + memset(&xfb_properties, 0, sizeof(xfb_properties)); + xfb_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT; memset(&vertex_divisor_properties, 0, sizeof(vertex_divisor_properties)); vertex_divisor_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT; + vertex_divisor_properties.pNext = &xfb_properties; device_properties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; device_properties2.pNext = &vertex_divisor_properties; if (vulkan_info->KHR_get_physical_device_properties2) @@ -1092,6 +1127,7 @@ 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; + VkPhysicalDeviceTransformFeedbackFeaturesEXT xfb_features; struct vkd3d_vulkan_info *vulkan_info = &device->vk_info; VkQueueFamilyProperties *queue_properties = NULL; VkDeviceQueueCreateInfo *queue_info = NULL; @@ -1182,8 +1218,11 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, VK_CALL(vkGetPhysicalDeviceMemoryProperties(physical_device, &device->memory_properties)); + memset(&xfb_features, 0, sizeof(xfb_features)); + xfb_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT; memset(&vertex_divisor_features, 0, sizeof(vertex_divisor_features)); vertex_divisor_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT; + vertex_divisor_features.pNext = &xfb_features; features2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; features2.pNext = &vertex_divisor_features; if (vulkan_info->KHR_get_physical_device_properties2) diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 9ffaa792..3b78a5e2 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -87,6 +87,7 @@ struct vkd3d_vulkan_info bool EXT_debug_report; /* device extensions */ bool KHR_push_descriptor; + bool EXT_transform_feedback; bool EXT_vertex_attribute_divisor; bool vertex_attrib_zero_divisor; diff --git a/libs/vkd3d/vulkan_procs.h b/libs/vkd3d/vulkan_procs.h index ac03b3f8..be983ec4 100644 --- a/libs/vkd3d/vulkan_procs.h +++ b/libs/vkd3d/vulkan_procs.h @@ -176,6 +176,12 @@ VK_DEVICE_PFN(vkUpdateDescriptorSets) VK_DEVICE_PFN(vkWaitForFences) /* VK_KHR_push_descriptor */ VK_DEVICE_EXT_PFN(vkCmdPushDescriptorSetKHR) +/* VK_EXT_transform_feedback */ +VK_DEVICE_EXT_PFN(vkCmdBeginQueryIndexedEXT) +VK_DEVICE_EXT_PFN(vkCmdBeginTransformFeedbackEXT) +VK_DEVICE_EXT_PFN(vkCmdBindTransformFeedbackBuffersEXT) +VK_DEVICE_EXT_PFN(vkCmdEndQueryIndexedEXT) +VK_DEVICE_EXT_PFN(vkCmdEndTransformFeedbackEXT) #undef VK_INSTANCE_PFN #undef VK_INSTANCE_EXT_PFN