vkphysicaldevice: silence validation for features
With merge request !9438 the validation layer started to complain with VUID-VkDeviceCreateInfo-pNext-02829 This patch fixes this ill-usage of Vulkan API, by removing the feature enabling of sampler ycbcr conversion, since it was promoted since Vulkan 1.1, and in GStreamer is only used in Vulkan Video operations, which are only enabled in Vulkan 1.3+. Also, these features detection and enabling were moved to a function called when filling the physical device data, in order to check the API version of the device driver before adding the enabling of the feature. Finally, the getters were adapted to use the version feature structure if the device driver version matches. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9544>
This commit is contained in:
parent
75590bfeac
commit
9be96a7a88
@ -75,9 +75,6 @@ struct _GstVulkanPhysicalDevicePrivate
|
||||
VkPhysicalDeviceVulkan14Features features14;
|
||||
VkPhysicalDeviceVulkan14Properties properties14;
|
||||
#endif
|
||||
#if defined (VK_KHR_sampler_ycbcr_conversion)
|
||||
VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR sampler_ycbcr_conversion;
|
||||
#endif
|
||||
#if defined (VK_KHR_synchronization2)
|
||||
VkPhysicalDeviceSynchronization2FeaturesKHR synchronization2;
|
||||
#endif
|
||||
@ -227,26 +224,6 @@ gst_vulkan_physical_device_init (GstVulkanPhysicalDevice * device)
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES;
|
||||
priv->features13.pNext = &priv->features14;
|
||||
#endif
|
||||
#if defined (VK_KHR_sampler_ycbcr_conversion)
|
||||
priv->sampler_ycbcr_conversion.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->sampler_ycbcr_conversion);
|
||||
#endif
|
||||
#if defined (VK_KHR_synchronization2)
|
||||
priv->synchronization2.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->synchronization2);
|
||||
#endif
|
||||
#if defined (VK_KHR_timeline_semaphore)
|
||||
priv->timeline_semaphore.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->timeline_semaphore);
|
||||
#endif
|
||||
#if defined (VK_KHR_video_maintenance1)
|
||||
priv->videomaintenance1.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->videomaintenance1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -558,17 +535,11 @@ dump_features14 (GstVulkanPhysicalDevice * device,
|
||||
#endif /* defined (VK_API_VERSION_1_4) */
|
||||
|
||||
static void
|
||||
dump_extras (GstVulkanPhysicalDevice * device, VkBaseOutStructure * chain)
|
||||
dump_features_extras (GstVulkanPhysicalDevice * device,
|
||||
VkBaseOutStructure * chain)
|
||||
{
|
||||
GstVulkanPhysicalDevicePrivate *priv = GET_PRIV (device);
|
||||
|
||||
#if defined (VK_KHR_sampler_ycbcr_conversion)
|
||||
if (chain->sType ==
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR) {
|
||||
DEBUG_BOOL_STRUCT ("support for", &priv->sampler_ycbcr_conversion,
|
||||
samplerYcbcrConversion);
|
||||
}
|
||||
#endif
|
||||
#if defined (VK_KHR_synchronization2)
|
||||
if (chain->sType ==
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR) {
|
||||
@ -624,7 +595,7 @@ dump_features (GstVulkanPhysicalDevice * device, GError ** error)
|
||||
dump_features14 (device, (VkPhysicalDeviceVulkan14Features *) iter);
|
||||
#endif
|
||||
else
|
||||
dump_extras (device, iter);
|
||||
dump_features_extras (device, iter);
|
||||
}
|
||||
} else
|
||||
#endif /* VK_API_VERSION_1_2 */
|
||||
@ -1068,6 +1039,36 @@ physical_device_info (GstVulkanPhysicalDevice * device, GError ** error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* it's required to add this extra features when the properties are filled and
|
||||
* the instances assigned */
|
||||
#if defined (VK_API_VERSION_1_2)
|
||||
static void
|
||||
add_extra_features (GstVulkanPhysicalDevice * device)
|
||||
{
|
||||
GstVulkanPhysicalDevicePrivate *priv = GET_PRIV (device);
|
||||
|
||||
#if defined (VK_KHR_timeline_semaphore)
|
||||
if (!gst_vulkan_physical_device_check_api_version (device, 1, 2, 0)) {
|
||||
priv->timeline_semaphore.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->timeline_semaphore);
|
||||
}
|
||||
#endif
|
||||
#if defined (VK_KHR_synchronization2)
|
||||
if (!gst_vulkan_physical_device_check_api_version (device, 1, 3, 0)) {
|
||||
priv->synchronization2.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features12, &priv->synchronization2);
|
||||
}
|
||||
#endif
|
||||
#if defined (VK_KHR_video_maintenance1)
|
||||
priv->videomaintenance1.sType =
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR;
|
||||
vk_link_struct (&priv->features13, &priv->videomaintenance1);
|
||||
#endif
|
||||
}
|
||||
#endif /* VK_API_VERSION_1_2 */
|
||||
|
||||
static gboolean
|
||||
gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device,
|
||||
GError ** error)
|
||||
@ -1155,6 +1156,7 @@ gst_vulkan_physical_device_fill_info (GstVulkanPhysicalDevice * device,
|
||||
memcpy (&device->memory_properties, &mem_properties10.memoryProperties,
|
||||
sizeof (device->memory_properties));
|
||||
|
||||
add_extra_features (device);
|
||||
get_features2 = (PFN_vkGetPhysicalDeviceFeatures2)
|
||||
gst_vulkan_instance_get_proc_address (device->instance,
|
||||
"vkGetPhysicalDeviceFeatures2");
|
||||
@ -1408,13 +1410,14 @@ gst_vulkan_physical_device_get_features (GstVulkanPhysicalDevice * device)
|
||||
gboolean
|
||||
gst_vulkan_physical_device_has_feature_sampler_ycbrc_conversion
|
||||
(GstVulkanPhysicalDevice * device) {
|
||||
#if defined (VK_KHR_sampler_ycbcr_conversion)
|
||||
#if defined (VK_API_VERSION_1_2)
|
||||
GstVulkanPhysicalDevicePrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GST_IS_VULKAN_PHYSICAL_DEVICE (device), FALSE);
|
||||
|
||||
priv = GET_PRIV (device);
|
||||
return priv->sampler_ycbcr_conversion.samplerYcbcrConversion;
|
||||
if (gst_vulkan_physical_device_check_api_version (device, 1, 1, 0))
|
||||
return priv->features11.samplerYcbcrConversion;
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
@ -1429,6 +1432,10 @@ gst_vulkan_physical_device_has_feature_synchronization2 (GstVulkanPhysicalDevice
|
||||
g_return_val_if_fail (GST_IS_VULKAN_PHYSICAL_DEVICE (device), FALSE);
|
||||
|
||||
priv = GET_PRIV (device);
|
||||
# if defined (VK_API_VERSION_1_3)
|
||||
if (gst_vulkan_physical_device_check_api_version (device, 1, 3, 0))
|
||||
return priv->features13.synchronization2;
|
||||
# endif
|
||||
return priv->synchronization2.synchronization2;
|
||||
#endif
|
||||
return FALSE;
|
||||
@ -1443,6 +1450,10 @@ gboolean
|
||||
g_return_val_if_fail (GST_IS_VULKAN_PHYSICAL_DEVICE (device), FALSE);
|
||||
|
||||
priv = GET_PRIV (device);
|
||||
# if defined (VK_API_VERSION_1_2)
|
||||
if (gst_vulkan_physical_device_check_api_version (device, 1, 2, 0))
|
||||
return priv->features12.timelineSemaphore;
|
||||
# endif
|
||||
return priv->timeline_semaphore.timelineSemaphore;
|
||||
#endif
|
||||
return FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user