aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/render/vulkan.h4
-rw-r--r--render/vulkan/vulkan.c21
2 files changed, 6 insertions, 19 deletions
diff --git a/include/render/vulkan.h b/include/render/vulkan.h
index 8e9b6460..dbfe750f 100644
--- a/include/render/vulkan.h
+++ b/include/render/vulkan.h
@@ -48,10 +48,6 @@ struct wlr_vk_device {
int drm_fd;
- // enabled extensions
- size_t extension_count;
- const char **extensions;
-
// we only ever need one queue for rendering and transfer commands
uint32_t queue_family;
VkQueue queue;
diff --git a/render/vulkan/vulkan.c b/render/vulkan/vulkan.c
index 6ae3c6b9..d5ff5feb 100644
--- a/render/vulkan/vulkan.c
+++ b/render/vulkan/vulkan.c
@@ -426,35 +426,27 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
dev->phdev = phdev;
dev->instance = ini;
dev->drm_fd = -1;
- dev->extensions = calloc(16, sizeof(*ini->extensions));
- if (!dev->extensions) {
- wlr_log_errno(WLR_ERROR, "allocation failed");
- goto error;
- }
// For dmabuf import we require at least the external_memory_fd,
// external_memory_dma_buf, queue_family_foreign and
// image_drm_format_modifier extensions.
- const char *names[] = {
+ const char *extensions[] = {
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME,
VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME, // or vulkan 1.2
VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME,
VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME,
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME,
};
+ size_t extensions_len = sizeof(extensions) / sizeof(extensions[0]);
- unsigned nc = sizeof(names) / sizeof(names[0]);
- const char *not_found = find_extensions(avail_ext_props, avail_extc, names, nc);
+ const char *not_found =
+ find_extensions(avail_ext_props, avail_extc, extensions, extensions_len);
if (not_found) {
wlr_log(WLR_ERROR, "vulkan: required device extension %s not found",
not_found);
goto error;
}
- for (unsigned i = 0u; i < nc; ++i) {
- dev->extensions[dev->extension_count++] = names[i];
- }
-
// queue families
{
uint32_t qfam_count;
@@ -488,8 +480,8 @@ struct wlr_vk_device *vulkan_device_create(struct wlr_vk_instance *ini,
dev_info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
dev_info.queueCreateInfoCount = 1u;
dev_info.pQueueCreateInfos = &qinfo;
- dev_info.enabledExtensionCount = dev->extension_count;
- dev_info.ppEnabledExtensionNames = dev->extensions;
+ dev_info.enabledExtensionCount = extensions_len;
+ dev_info.ppEnabledExtensionNames = extensions;
res = vkCreateDevice(phdev, &dev_info, NULL, &dev->dev);
if (res != VK_SUCCESS) {
@@ -550,7 +542,6 @@ void vulkan_device_destroy(struct wlr_vk_device *dev) {
vulkan_format_props_finish(&dev->format_props[i]);
}
- free(dev->extensions);
free(dev->shm_formats);
free(dev->format_props);
free(dev);