LWJGL Forum

Programming => Vulkan => Topic started by: sgold on August 23, 2023, 08:42:30

Title: following the pNext chain
Post by: sgold on August 23, 2023, 08:42:30
I want to check whether a Vulkan physical device supports triangle-fan topologies.
Triangle fans are in the Vulkan 1.0 spec, but apparently Molten is a "portability subset" that doesn't support them.
I use VK10.vkEnumerateDeviceExtensionProperties() to check whether the "VK_KHR_portability_subset" extension is available.
If it is, I use KHRGetPhysicalDeviceProperties2.vkGetPhysicalDeviceFeatures2KHR() to query device features.
I expect that somewhere in the pNext chain of the VkPhysicalDeviceFeatures2 there will be a Struct with stype=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR.
How do I find it?
pNext() returns a handle to a Struct, but I don't know how to determine the type of the Struct.
Or am I going about this backward? Do I fill in the pNext() field myself, with the handle of the Struct I want vkGetPhysicalDeviceFeatures2KHR() to populate?
Title: Re: following the pNext chain
Post by: spasi on August 23, 2023, 18:23:22
Hey sgold,

Quote from: sgold on August 23, 2023, 08:42:30Or am I going about this backward? Do I fill in the pNext() field myself, with the handle of the Struct I want vkGetPhysicalDeviceFeatures2KHR() to populate?

That's correct. You need to allocate and initialize (the sType and pNext fields) the struct chain, then pass the first struct to the vkGetPhysicalDeviceFeatures2KHR function. The VkBool32 fields in all structs in the chain should be populated accordingly after that.
Title: Re: following the pNext chain
Post by: sgold on August 23, 2023, 20:27:17
Thanks for that advice. I'm trying to follow it, but when I invoke vkGetPhysicalDeviceFeatures2KHR, I get a NullPointerException in Checks.
I captured screenshots of the source code and stack trace, but when I try to post them I get a 500 Error from the forum's webserver. My browser is Firefox.
Any suggestions?
Title: Re: following the pNext chain
Post by: spasi on August 23, 2023, 22:05:18
A null exception there is possible if you haven't enabled the VK_KHR_get_physical_device_properties2 exception.
Title: Re: following the pNext chain
Post by: sgold on August 24, 2023, 00:57:02
Quote from: spasi on August 23, 2023, 22:05:18
A null exception there is possible if you haven't enabled the VK_KHR_get_physical_device_properties2 exception.

That did the trick. Thanks for the help.