mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
vulkan: remove unused layer enablement
This is possible now via the vulkan loader
This commit is contained in:
parent
69e06ced7d
commit
873add374a
4 changed files with 0 additions and 95 deletions
|
@ -27,17 +27,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const char *device_validation_layers[] = {
|
|
||||||
"VK_LAYER_GOOGLE_threading",
|
|
||||||
"VK_LAYER_LUNARG_mem_tracker",
|
|
||||||
"VK_LAYER_LUNARG_object_tracker",
|
|
||||||
"VK_LAYER_LUNARG_draw_state",
|
|
||||||
"VK_LAYER_LUNARG_param_checker",
|
|
||||||
"VK_LAYER_LUNARG_swapchain",
|
|
||||||
"VK_LAYER_LUNARG_device_limits",
|
|
||||||
"VK_LAYER_LUNARG_image",
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_vulkan_device_debug
|
#define GST_CAT_DEFAULT gst_vulkan_device_debug
|
||||||
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
||||||
|
@ -162,8 +151,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
uint32_t enabled_extension_count = 0;
|
uint32_t enabled_extension_count = 0;
|
||||||
uint32_t device_extension_count = 0;
|
uint32_t device_extension_count = 0;
|
||||||
VkExtensionProperties *device_extensions = NULL;
|
VkExtensionProperties *device_extensions = NULL;
|
||||||
uint32_t enabled_layer_count = 0;
|
|
||||||
gchar **enabled_layers;
|
|
||||||
uint32_t device_layer_count = 0;
|
uint32_t device_layer_count = 0;
|
||||||
VkLayerProperties *device_layers;
|
VkLayerProperties *device_layers;
|
||||||
gboolean have_swapchain_ext;
|
gboolean have_swapchain_ext;
|
||||||
|
@ -201,9 +188,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
_check_for_all_layers (G_N_ELEMENTS (device_validation_layers),
|
|
||||||
device_validation_layers, device_layer_count, device_layers,
|
|
||||||
&enabled_layer_count, &enabled_layers);
|
|
||||||
g_free (device_layers);
|
g_free (device_layers);
|
||||||
device_layers = NULL;
|
device_layers = NULL;
|
||||||
|
|
||||||
|
@ -212,7 +196,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
&device_extension_count, NULL);
|
&device_extension_count, NULL);
|
||||||
if (gst_vulkan_error_to_g_error (err, error,
|
if (gst_vulkan_error_to_g_error (err, error,
|
||||||
"vkEnumerateDeviceExtensionProperties") < 0) {
|
"vkEnumerateDeviceExtensionProperties") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (device, "Found %u extensions", device_extension_count);
|
GST_DEBUG_OBJECT (device, "Found %u extensions", device_extension_count);
|
||||||
|
@ -225,7 +208,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
&device_extension_count, device_extensions);
|
&device_extension_count, device_extensions);
|
||||||
if (gst_vulkan_error_to_g_error (err, error,
|
if (gst_vulkan_error_to_g_error (err, error,
|
||||||
"vkEnumerateDeviceExtensionProperties") < 0) {
|
"vkEnumerateDeviceExtensionProperties") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
g_free (device_extensions);
|
g_free (device_extensions);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +228,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
VK_ERROR_EXTENSION_NOT_PRESENT,
|
VK_ERROR_EXTENSION_NOT_PRESENT,
|
||||||
"Failed to find required extension, \"" VK_KHR_SWAPCHAIN_EXTENSION_NAME
|
"Failed to find required extension, \"" VK_KHR_SWAPCHAIN_EXTENSION_NAME
|
||||||
"\"");
|
"\"");
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
g_free (device_extensions);
|
g_free (device_extensions);
|
||||||
|
@ -272,7 +253,6 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
if (i >= device->n_queue_families) {
|
if (i >= device->n_queue_families) {
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"Failed to find a compatible queue family");
|
"Failed to find a compatible queue family");
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
device->queue_family_id = i;
|
device->queue_family_id = i;
|
||||||
|
@ -293,24 +273,17 @@ gst_vulkan_device_open (GstVulkanDevice * device, GError ** error)
|
||||||
device_info.pNext = NULL;
|
device_info.pNext = NULL;
|
||||||
device_info.queueCreateInfoCount = 1;
|
device_info.queueCreateInfoCount = 1;
|
||||||
device_info.pQueueCreateInfos = &queue_info;
|
device_info.pQueueCreateInfos = &queue_info;
|
||||||
#if 0
|
|
||||||
device_info.enabledLayerCount = enabled_layer_count;
|
|
||||||
device_info.ppEnabledLayerNames = (const char *const *) enabled_layers;
|
|
||||||
#else
|
|
||||||
device_info.enabledLayerCount = 0;
|
device_info.enabledLayerCount = 0;
|
||||||
device_info.ppEnabledLayerNames = NULL;
|
device_info.ppEnabledLayerNames = NULL;
|
||||||
#endif
|
|
||||||
device_info.enabledExtensionCount = enabled_extension_count;
|
device_info.enabledExtensionCount = enabled_extension_count;
|
||||||
device_info.ppEnabledExtensionNames = (const char *const *) extension_names;
|
device_info.ppEnabledExtensionNames = (const char *const *) extension_names;
|
||||||
device_info.pEnabledFeatures = NULL;
|
device_info.pEnabledFeatures = NULL;
|
||||||
|
|
||||||
err = vkCreateDevice (gpu, &device_info, NULL, &device->device);
|
err = vkCreateDevice (gpu, &device_info, NULL, &device->device);
|
||||||
if (gst_vulkan_error_to_g_error (err, error, "vkCreateDevice") < 0) {
|
if (gst_vulkan_error_to_g_error (err, error, "vkCreateDevice") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
VkCommandPoolCreateInfo cmd_pool_info = { 0, };
|
VkCommandPoolCreateInfo cmd_pool_info = { 0, };
|
||||||
|
|
|
@ -29,17 +29,6 @@
|
||||||
|
|
||||||
#define APP_SHORT_NAME "GStreamer"
|
#define APP_SHORT_NAME "GStreamer"
|
||||||
|
|
||||||
static const char *instance_validation_layers[] = {
|
|
||||||
"VK_LAYER_GOOGLE_threading",
|
|
||||||
"VK_LAYER_LUNARG_mem_tracker",
|
|
||||||
"VK_LAYER_LUNARG_object_tracker",
|
|
||||||
"VK_LAYER_LUNARG_draw_state",
|
|
||||||
"VK_LAYER_LUNARG_param_checker",
|
|
||||||
"VK_LAYER_LUNARG_swapchain",
|
|
||||||
"VK_LAYER_LUNARG_device_limits",
|
|
||||||
"VK_LAYER_LUNARG_image",
|
|
||||||
};
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_vulkan_instance_debug
|
#define GST_CAT_DEFAULT gst_vulkan_instance_debug
|
||||||
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
|
||||||
GST_DEBUG_CATEGORY (GST_VULKAN_DEBUG_CAT);
|
GST_DEBUG_CATEGORY (GST_VULKAN_DEBUG_CAT);
|
||||||
|
@ -176,8 +165,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
uint32_t instance_extension_count = 0;
|
uint32_t instance_extension_count = 0;
|
||||||
uint32_t enabled_extension_count = 0;
|
uint32_t enabled_extension_count = 0;
|
||||||
uint32_t instance_layer_count = 0;
|
uint32_t instance_layer_count = 0;
|
||||||
uint32_t enabled_layer_count = 0;
|
|
||||||
gchar **enabled_layers;
|
|
||||||
gboolean have_debug_extension = FALSE;
|
gboolean have_debug_extension = FALSE;
|
||||||
VkResult err;
|
VkResult err;
|
||||||
|
|
||||||
|
@ -205,11 +192,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: allow outside selection */
|
|
||||||
_check_for_all_layers (G_N_ELEMENTS (instance_validation_layers),
|
|
||||||
instance_validation_layers, instance_layer_count, instance_layers,
|
|
||||||
&enabled_layer_count, &enabled_layers);
|
|
||||||
|
|
||||||
g_free (instance_layers);
|
g_free (instance_layers);
|
||||||
|
|
||||||
err =
|
err =
|
||||||
|
@ -217,7 +199,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
NULL);
|
NULL);
|
||||||
if (gst_vulkan_error_to_g_error (err, error,
|
if (gst_vulkan_error_to_g_error (err, error,
|
||||||
"vkEnumerateInstanceExtensionProperties") < 0) {
|
"vkEnumerateInstanceExtensionProperties") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (instance, "Found %u extensions", instance_extension_count);
|
GST_DEBUG_OBJECT (instance, "Found %u extensions", instance_extension_count);
|
||||||
|
@ -230,7 +211,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
instance_extensions);
|
instance_extensions);
|
||||||
if (gst_vulkan_error_to_g_error (err, error,
|
if (gst_vulkan_error_to_g_error (err, error,
|
||||||
"vkEnumerateInstanceExtensionProperties") < 0) {
|
"vkEnumerateInstanceExtensionProperties") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
g_free (instance_extensions);
|
g_free (instance_extensions);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +258,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"vkEnumerateInstanceExtensionProperties failed to find the required "
|
"vkEnumerateInstanceExtensionProperties failed to find the required "
|
||||||
"\"" VK_KHR_SURFACE_EXTENSION_NAME "\" extension");
|
"\"" VK_KHR_SURFACE_EXTENSION_NAME "\" extension");
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
g_free (instance_extensions);
|
g_free (instance_extensions);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +265,6 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
g_set_error (error, GST_VULKAN_ERROR, VK_ERROR_INITIALIZATION_FAILED,
|
||||||
"vkEnumerateInstanceExtensionProperties failed to find the required "
|
"vkEnumerateInstanceExtensionProperties failed to find the required "
|
||||||
"\"%s\" window system extension", winsys_ext_name);
|
"\"%s\" window system extension", winsys_ext_name);
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
g_free (instance_extensions);
|
g_free (instance_extensions);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -307,26 +285,19 @@ gst_vulkan_instance_open (GstVulkanInstance * instance, GError ** error)
|
||||||
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
inst_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
inst_info.pNext = NULL;
|
inst_info.pNext = NULL;
|
||||||
inst_info.pApplicationInfo = &app;
|
inst_info.pApplicationInfo = &app;
|
||||||
#if 0
|
|
||||||
inst_info.enabledLayerCount = enabled_layer_count;
|
|
||||||
inst_info.ppEnabledLayerNames = (const char *const *) enabled_layers;
|
|
||||||
#else
|
|
||||||
inst_info.enabledLayerCount = 0;
|
inst_info.enabledLayerCount = 0;
|
||||||
inst_info.ppEnabledLayerNames = NULL;
|
inst_info.ppEnabledLayerNames = NULL;
|
||||||
#endif
|
|
||||||
inst_info.enabledExtensionCount = enabled_extension_count;
|
inst_info.enabledExtensionCount = enabled_extension_count;
|
||||||
inst_info.ppEnabledExtensionNames = (const char *const *) extension_names;
|
inst_info.ppEnabledExtensionNames = (const char *const *) extension_names;
|
||||||
|
|
||||||
err = vkCreateInstance (&inst_info, NULL, &instance->instance);
|
err = vkCreateInstance (&inst_info, NULL, &instance->instance);
|
||||||
if (gst_vulkan_error_to_g_error (err, error, "vkCreateInstance") < 0) {
|
if (gst_vulkan_error_to_g_error (err, error, "vkCreateInstance") < 0) {
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
g_free (instance_extensions);
|
g_free (instance_extensions);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (instance_extensions);
|
g_free (instance_extensions);
|
||||||
g_strfreev (enabled_layers);
|
|
||||||
|
|
||||||
err =
|
err =
|
||||||
vkEnumeratePhysicalDevices (instance->instance,
|
vkEnumeratePhysicalDevices (instance->instance,
|
||||||
|
|
|
@ -27,41 +27,6 @@
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
|
||||||
|
|
||||||
gboolean
|
|
||||||
_check_for_all_layers (uint32_t check_count, const char **check_names,
|
|
||||||
uint32_t layer_count, VkLayerProperties * layers,
|
|
||||||
guint32 * supported_layers_count, gchar *** supported_layers)
|
|
||||||
{
|
|
||||||
uint32_t i, j, k;
|
|
||||||
|
|
||||||
if (check_count <= 0 || layer_count <= 0) {
|
|
||||||
GST_WARNING ("no layers requested or supported");
|
|
||||||
*supported_layers = NULL;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
*supported_layers = g_new0 (gchar *, check_count + 1);
|
|
||||||
k = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < check_count; i++) {
|
|
||||||
gboolean found = FALSE;
|
|
||||||
for (j = 0; j < layer_count; j++) {
|
|
||||||
if (g_strcmp0 (check_names[i], layers[j].layerName) == 0) {
|
|
||||||
GST_TRACE ("found layer: %s", check_names[i]);
|
|
||||||
found = TRUE;
|
|
||||||
(*supported_layers)[k++] = g_strdup (check_names[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!found)
|
|
||||||
GST_WARNING ("Cannot find layer: %s", check_names[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
(*supported_layers)[k] = NULL;
|
|
||||||
*supported_layers_count = g_strv_length (*supported_layers);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_init_context_debug (void)
|
_init_context_debug (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,10 +25,6 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
gboolean _check_for_all_layers (uint32_t check_count, const char ** check_names,
|
|
||||||
uint32_t layer_count, VkLayerProperties * layers, guint32 * enabled_layer_count,
|
|
||||||
gchar *** enabled_layers);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /*_VK_UTILS_H_ */
|
#endif /*_VK_UTILS_H_ */
|
||||||
|
|
Loading…
Reference in a new issue