How to enable fragment shader interlock

Hi! I’m tried to use GL_ARB_FRAGMENT_SHADER_INTERLOCK but I’ve errors when trying to enable it.

my code :

VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT physcialDeviceFragmentShaderInterlock{};
                physcialDeviceFragmentShaderInterlock.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT;
                physcialDeviceFragmentShaderInterlock.fragmentShaderPixelInterlock = VK_TRUE;

                VkPhysicalDeviceFeatures deviceFeatures{};
                deviceFeatures.samplerAnisotropy = VK_TRUE;
                deviceFeatures.fragmentStoresAndAtomics = VK_TRUE;
                VkPhysicalDeviceVulkan11Features features11 = {};
                features11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
                VkPhysicalDeviceVulkan12Features features12 = {};
                features12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;


                VkPhysicalDeviceFeatures2 physical_features21;
                physical_features21.sType =  VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
                physical_features21.pNext = &features11;
                physical_features21.features = deviceFeatures;
                vkGetPhysicalDeviceFeatures2(physicalDevice, &physical_features21);

                VkPhysicalDeviceFeatures2 physical_features22;
                physical_features22.sType =  VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
                physical_features22.pNext = &features12;
                vkGetPhysicalDeviceFeatures2(physicalDevice, &physical_features22);

                features11.pNext = &features12;

                features12.pNext = &physcialDeviceFragmentShaderInterlock;

                PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR = reinterpret_cast<PFN_vkGetPhysicalDeviceProperties2KHR>(vkGetInstanceProcAddr(vkSettup.getInstance(), "vkGetPhysicalDeviceProperties2KHR"));
                if (!vkGetPhysicalDeviceProperties2KHR) {
                    throw core::Erreur(0, "Could not get a valid function pointer for vkGetPhysicalDeviceProperties2KHR", 1);
                }
                VkPhysicalDeviceProperties2KHR devicePropsEXT2{};
                pushDescriptorProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR;
                devicePropsEXT2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
                devicePropsEXT2.pNext = &pushDescriptorProps;
                vkGetPhysicalDeviceProperties2KHR(physicalDevice, &devicePropsEXT2);

                VkPhysicalDeviceProperties2 deviceProps2{};
                fragmentShaderInterlockProps.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT;
                deviceProps2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
                deviceProps2.pNext = &fragmentShaderInterlockProps;
                vkGetPhysicalDeviceProperties2(physicalDevice, &deviceProps2);

                VkDeviceCreateInfo createInfo{};
                createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
                createInfo.pNext = &physical_features21;

                createInfo.queueCreateInfoCount = static_cast<uint32_t>(queueCreateInfos.size());
                createInfo.pQueueCreateInfos = queueCreateInfos.data();

                createInfo.pEnabledFeatures = nullptr;

                createInfo.enabledExtensionCount = static_cast<uint32_t>(deviceExtensions.size());
                createInfo.ppEnabledExtensionNames = deviceExtensions.data();

                if (enableValidationLayers) {
                    createInfo.enabledLayerCount = static_cast<uint32_t>(validationLayers.size());
                    createInfo.ppEnabledLayerNames = validationLayers.data();
                } else {
                    createInfo.enabledLayerCount = 0;
                }

                if (vkCreateDevice(physicalDevice, &createInfo, nullptr, &device) != VK_SUCCESS) {
                    throw core::Erreur(0, "failed to create logical device!", 1);
                }
                vkGetDeviceQueue(device, indices.graphicsFamily.value(), 0, &graphicsQueue);
                if (surface != VK_NULL_HANDLE) {
                    vkGetDeviceQueue(device, indices.presentFamily.value(), 0, &presentQueue);
                }

The errors :

validation layer: vkGetPhysicalDeviceProperties2KHR(): pProperties->pNext chain includes a structure with unexpected VkStructureType VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT. This error is based on the Valid Usage documentation for version 309 of the Vulkan header.  It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pProperties->pNext is undefined and may not work correctly with validation enabled.
The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid struct for extending VkPhysicalDeviceProperties2 (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/devsandqueues.html#VUID-VkPhysicalDeviceProperties2-pNext-pNext)
destroy texture
component manager : 0x17d2dd56770
not read serialisation file
destroy texture
validation layer: vkCreateShaderModule(): SPIR-V Extension SPV_EXT_fragment_shader_interlock was declared, but one of the following requirements is required (VK_EXT_fragment_shader_interlock).
The Vulkan spec states: If pCode is a pointer to SPIR-V code, and pCode declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied (https://vulkan.lunarg.com/doc/view/1.4.309.0/windows/antora/spec/latest/chapters/shaders.html#VUID-VkShaderModuleCreateInfo-pCode-08742)
validation layer: vkCreateShaderModule(): SPIR-V Extension SPV_EXT_fragment_shader_interlock was declared, but one of the following requirements is required (VK_EXT_fragment_shader_interlock).

How to enable it correctly ?

Thanks.

It’s ok I’ve found how to make this errors message disapear…

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.