Hi,
I have few Vulkan games run well on numbers of Android devices. However, when I test them on HUAWEI P30 (not P30 Pro) with Mali-G76 MP10 GPU and Android 9.0, function vkCreateDevice() returns error VK_ERROR_FEATURE_NOT_PRESENT (VkResult:-8).
My app should have successfully loaded Vulkan dynamic lib since vkInstance has been created before creating vkDevice.
So what is the reason that vkCreateDevice() return VK_ERROR_FEATURE_NOT_PRESENT? Here is my code snippet:
// Create Logical Device, ensure that this device is connecte to graphics queue// Step 1 - Retrive the queue family that supports graphics pipelineuint32_t graphicQueueFamilyIndex;int i = 0;for (const auto& family : _queueFamilyProps){ // Check if the family has queues and that are Graphical and not Computational queues. if (family.queueCount > 0 && family.queueFlags & VK_QUEUE_GRAPHICS_BIT) { graphicQueueFamilyIndex = i; //Found the family, record its index break; } i++;}// Step 2 - Get physical device featuresvkGetPhysicalDeviceFeatures(vkPhyDevice, &deviceFeatures); VkPhysicalDeviceFeatures enabledFeatures = {VK_FALSE};enabledFeatures.samplerAnisotropy = deviceFeatures.samplerAnisotropy;enabledFeatures.shaderSampledImageArrayDynamicIndexing = deviceFeatures.shaderSampledImageArrayDynamicIndexing;enabledFeatures.depthClamp = VK_TRUE;enabledFeatures.sampleRateShading = VK_TRUE;#if defined (NATIVE_LINEWIDTH_SUPPORT) enabledFeatures.wideLines = VK_TRUE; //MoltenVK (via Metal API) does not support line width#endif// Step 3 - Create the logical devicefloat queuePriorities[1] = { 0.0f };VkDeviceQueueCreateInfo queueCreateInfo { VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, //sType nullptr, //pNext 0, //flags graphicQueueFamilyIndex, //queueFamilyIndex 1, //queueCount queuePriorities //pQueuePriorities};std::vector<const char *> extensionNames { VK_KHR_SWAPCHAIN_EXTENSION_NAME };VkDeviceCreateInfo deviceInfo{ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType nullptr, //pNext 0, //flags 1, //queueCreateInfoCount &queueCreateInfo, //pQueueCreateInfos 0, //enabledLayerCount nullptr, //ppEnabledLayerNames (uint32_t)extensionNames.size(), //enabledExtensionCount extensionNames.data(), //ppEnabledExtensionNames &enabledFeatures //pEnabledFeatures };VK_ASSERT(vkCreateDevice(vkPhyDevice, &deviceInfo, nullptr, &vkDevice));
// Create Logical Device, ensure that this device is connecte to graphics queue// Step 1 - Retrive the queue family that supports graphics pipelineuint32_t graphicQueueFamilyIndex;int i = 0;for (const auto& family : _queueFamilyProps){ // Check if the family has queues and that are Graphical and not Computational queues. if (family.queueCount > 0 && family.queueFlags & VK_QUEUE_GRAPHICS_BIT) { graphicQueueFamilyIndex = i; //Found the family, record its index break; } i++;}// Step 2 - Get physical device featuresvkGetPhysicalDeviceFeatures(vkPhyDevice, &deviceFeatures); VkPhysicalDeviceFeatures enabledFeatures = {VK_FALSE};enabledFeatures.samplerAnisotropy = deviceFeatures.samplerAnisotropy;enabledFeatures.shaderSampledImageArrayDynamicIndexing = deviceFeatures.shaderSampledImageArrayDynamicIndexing;enabledFeatures.depthClamp = VK_TRUE;enabledFeatures.sampleRateShading = VK_TRUE;#if defined (NATIVE_LINEWIDTH_SUPPORT) enabledFeatures.wideLines = VK_TRUE; //MoltenVK (via Metal API) does not support line width#endif// Step 3 - Create the logical devicefloat queuePriorities[1] = { 0.0f };VkDeviceQueueCreateInfo queueCreateInfo { VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, //sType nullptr, //pNext 0, //flags graphicQueueFamilyIndex, //queueFamilyIndex 1, //queueCount queuePriorities //pQueuePriorities};std::vector<const char *> extensionNames { VK_KHR_SWAPCHAIN_EXTENSION_NAME };VkDeviceCreateInfo deviceInfo{ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType nullptr, //pNext 0, //flags 1, //queueCreateInfoCount &queueCreateInfo, //pQueueCreateInfos 0, //enabledLayerCount nullptr, //ppEnabledLayerNames (uint32_t)extensionNames.size(), //enabledExtensionCount extensionNames.data(), //ppEnabledExtensionNames &enabledFeatures //pEnabledFeatures };VK_ASSERT(vkCreateDevice(vkPhyDevice, &deviceInfo, nullptr, &vkDevice
));
Thanks for the feedback - I'll raise with the GPU product management team.
Cheers, Pete