[Vulkan] features unsupported

Hi! I’m trying to port my game engine to Vulkan, I use SamplerArray and gl_DrawID with indirect rendering it works perfectly with openGL but with Vulkan it tells me that I need to enable some additionnal features but they are not supported this code returns false :

bool Device::isDeviceSuitable(VkPhysicalDevice device,  VkSurfaceKHR surface) {
            QueueFamilyIndices indices = findQueueFamilies(device, surface);
            if (surface != VK_NULL_HANDLE) {
                bool extensionsSupported = checkDeviceExtensionSupport(device);
                bool swapChainAdequate;
                if (extensionsSupported) {
                    SwapChainSupportDetails swapChainSupport = querySwapChainSupport(device, surface);
                    swapChainAdequate = !swapChainSupport.formats.empty() && !swapChainSupport.presentModes.empty();
                } else {
                    swapChainAdequate = true;
                }
                VkPhysicalDeviceFeatures supportedFeatures;
                vkGetPhysicalDeviceFeatures(device, &supportedFeatures);
                VkPhysicalDeviceFeatures2 physical_features2 = {};
                physical_features2.sType =  VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;

                VkPhysicalDeviceVulkan11Features features11 = {};
                physical_features2.pNext = &features11;
                vkGetPhysicalDeviceFeatures2(device, &physical_features2);

                VkPhysicalDeviceVulkan12Features features12 = {};
                physical_features2.pNext = &features12;
                vkGetPhysicalDeviceFeatures2(device, &physical_features2);
                if (features11.shaderDrawParameters == VK_TRUE) {
                    std::cout<<"shader draw parameterrs ok"<<std::endl;
                }
                if (features12.runtimeDescriptorArray == VK_TRUE) {
                    std::cout<<"shader draw parameterrs ok"<<std::endl;
                }
                return indices.isComplete() && extensionsSupported && swapChainAdequate && supportedFeatures.samplerAnisotropy && features11.shaderDrawParameters == VK_TRUE && features12.runtimeDescriptorArray == VK_TRUE;
            } else {
                QueueFamilyIndices  indices = findQueueFamilies(device, surface);
                VkPhysicalDeviceFeatures supportedFeatures;
                vkGetPhysicalDeviceFeatures(device, &supportedFeatures);
                VkPhysicalDeviceFeatures2 physical_features2 = {};

                VkPhysicalDeviceVulkan11Features features11 = {};
                physical_features2.pNext = &features11;
                vkGetPhysicalDeviceFeatures2(device, &physical_features2);

                VkPhysicalDeviceVulkan12Features features12 = {};
                physical_features2.pNext = &features12;
                vkGetPhysicalDeviceFeatures2(device, &physical_features2);
                return indices.isGraphicComplete() && supportedFeatures.samplerAnisotropy && features11.shaderDrawParameters == VK_TRUE && features12.runtimeDescriptorArray == VK_TRUE;
            }
        }

Is this normal that runtimeDescriptorArray and shaderDrawArrays are not supported ?

I’ve an nvidia gforce gtx 1660 super… but what is supported in opengl should be working with vulkan no ?
Otherwise I don’t see the interrest of using a new api…

Hi!
Ok solved, I just didin’t initialized the sType of the 11 and 12 features struct that was why.
Thanks.

1 Like