vulkan: expose various flags to string methods

This commit is contained in:
Matthew Waters 2019-09-16 11:24:13 +10:00
parent 407dab607f
commit 863e785770
4 changed files with 33 additions and 25 deletions

View file

@ -27,11 +27,6 @@
G_BEGIN_DECLS
gchar * gst_vulkan_memory_property_flags_to_string (VkMemoryPropertyFlags prop_bits);
gchar * gst_vulkan_memory_heap_flags_to_string (VkMemoryHeapFlags prop_bits);
gchar * gst_vulkan_queue_flags_to_string (VkQueueFlags queue_bits);
gchar * gst_vulkan_sample_count_flags_to_string (VkSampleCountFlags sample_count_bits);
G_END_DECLS
#endif /* __GST_VULKAN_DEBUG_PRIVATE_H__ */

View file

@ -25,6 +25,7 @@
#include <glib/gprintf.h>
#include "gstvkerror.h"
#include "gstvkdebug.h"
#include "gstvkdebug-private.h"
#define FLAGS_TO_STRING(under_name, VkType) \
@ -108,3 +109,22 @@ static const struct
};
FLAGS_TO_STRING(sample_count, VkSampleCountFlags);
/* *INDENT-ON* */
const gchar *
gst_vulkan_device_type_to_string (VkPhysicalDeviceType type)
{
switch (type) {
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
return "other";
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
return "integrated";
case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
return "discrete";
case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
return "virtual";
case VK_PHYSICAL_DEVICE_TYPE_CPU:
return "CPU";
default:
return "unknown";
}
}

View file

@ -30,6 +30,18 @@ G_BEGIN_DECLS
#define GST_VULKAN_EXTENT3D_FORMAT G_GUINT32_FORMAT ", %" G_GUINT32_FORMAT ", %" G_GUINT32_FORMAT
#define GST_VULKAN_EXTENT3D_ARGS(var) (var).width, (var).height, (var).depth
GST_VULKAN_API
const gchar * gst_vulkan_device_type_to_string (VkPhysicalDeviceType type);
GST_VULKAN_API
gchar * gst_vulkan_memory_property_flags_to_string (VkMemoryPropertyFlags prop_bits);
GST_VULKAN_API
gchar * gst_vulkan_memory_heap_flags_to_string (VkMemoryHeapFlags prop_bits);
GST_VULKAN_API
gchar * gst_vulkan_queue_flags_to_string (VkQueueFlags queue_bits);
GST_VULKAN_API
gchar * gst_vulkan_sample_count_flags_to_string (VkSampleCountFlags sample_count_bits);
G_END_DECLS
#endif /* __GST_VULKAN_DEBUG_H__ */

View file

@ -511,25 +511,6 @@ dump_sparse_properties (GstVulkanDevice * device, GError ** error)
return TRUE;
}
static const gchar *
_device_type_to_string (VkPhysicalDeviceType type)
{
switch (type) {
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
return "other";
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
return "integrated";
case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
return "discrete";
case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
return "virtual";
case VK_PHYSICAL_DEVICE_TYPE_CPU:
return "CPU";
default:
return "unknown";
}
}
static gboolean
_physical_device_info (GstVulkanDevice * device, GError ** error)
{
@ -548,7 +529,7 @@ _physical_device_info (GstVulkanDevice * device, GError ** error)
GST_INFO_OBJECT (device, "pyhsical device %i name \'%s\' type \'%s\' "
"api version %u.%u.%u, driver version %u.%u.%u vendor ID 0x%x, "
"device ID 0x%x", device->device_index, props.deviceName,
_device_type_to_string (props.deviceType),
gst_vulkan_device_type_to_string (props.deviceType),
VK_VERSION_MAJOR (props.apiVersion), VK_VERSION_MINOR (props.apiVersion),
VK_VERSION_PATCH (props.apiVersion),
VK_VERSION_MAJOR (props.driverVersion),