From f92e45bb8c97287ced54e27e2a5ba66bcac66b19 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 4 Feb 2018 23:08:49 +0100 Subject: vo_gpu: vulkan: try enabling required features Instead of enabling every feature under the sun, make an effort to just whitelist the ones we actually might use. Turns out the extended storage format support is needed for some of the storage formats we use, in particular rgba16. --- video/out/vulkan/common.h | 1 + video/out/vulkan/utils.c | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'video/out/vulkan') diff --git a/video/out/vulkan/common.h b/video/out/vulkan/common.h index b849b6dc0b..1a4c3b842f 100644 --- a/video/out/vulkan/common.h +++ b/video/out/vulkan/common.h @@ -72,4 +72,5 @@ struct mpvk_ctx { // Cached capabilities VkPhysicalDeviceLimits limits; + VkPhysicalDeviceFeatures features; }; diff --git a/video/out/vulkan/utils.c b/video/out/vulkan/utils.c index 1fd674d28f..b32ae4968b 100644 --- a/video/out/vulkan/utils.c +++ b/video/out/vulkan/utils.c @@ -316,6 +316,7 @@ bool mpvk_find_phys_device(struct mpvk_ctx *vk, const char *name, bool sw) (int)VK_VERSION_PATCH(prop.apiVersion)); vk->physd = devices[i]; vk->limits = prop.limits; + vkGetPhysicalDeviceFeatures(vk->physd, &vk->features); talloc_free(devices); return true; } @@ -498,12 +499,20 @@ bool mpvk_device_init(struct mpvk_ctx *vk, struct mpvk_device_opts opts) if (vk->spirv->required_ext) MP_TARRAY_APPEND(tmp, exts, num_exts, vk->spirv->required_ext); + // Enable all features we optionally use +#define FEATURE(name) .name = vk->features.name + VkPhysicalDeviceFeatures feats = { + FEATURE(shaderStorageImageExtendedFormats), + }; +#undef FEATURE + VkDeviceCreateInfo dinfo = { .sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, .pQueueCreateInfos = qinfos, .queueCreateInfoCount = num_qinfos, .ppEnabledExtensionNames = exts, .enabledExtensionCount = num_exts, + .pEnabledFeatures = &feats, }; MP_VERBOSE(vk, "Creating vulkan device with extensions:\n"); -- cgit v1.2.3