Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go-like handling of pNext in Vulkanize() #3

Open
bbredesen opened this issue Mar 2, 2023 · 0 comments
Open

Go-like handling of pNext in Vulkanize() #3

bbredesen opened this issue Mar 2, 2023 · 0 comments
Labels
enhancement New feature or request priority:mid Issues with a workaround; needs to be fixed, but not an emergency

Comments

@bbredesen
Copy link
Owner

Extending structures through pNext is very awkward right now, requiring the developer to set up the structure, call Vulkanize() on it, and then cast the result to unsafe.Pointer before assigning to the base structure.

The XML spec includes a "structextends" property, showing what other structs can be extended with this one. (Note that there could be multiple types, separated by commas.)

For example, VkPhysicalDeviceFeatures2 is extended by many feature extensions like VkPhysicalDevicePrivateDataFeatures, VkPhysicalDeviceVariablePointersFeatures, VkPhysicalDeviceMultiviewFeatures, etc. Each of those public-facing structs could implement a guard interface called PhysicalDeviceFeaturres2Extender (or similar), and then vk.PhysicalDeviceFeatures2.PNext would have its type set to that interface. The Vulkanize function would then handle the recursive Vulkanization and casting to unsafe.Pointer behind the scenes.

Note that there are also 70+ "returnedonly" structs that extend other structs. The fix above does NOT address structs returned from Vulkan.

@bbredesen bbredesen added enhancement New feature or request priority:mid Issues with a workaround; needs to be fixed, but not an emergency labels Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:mid Issues with a workaround; needs to be fixed, but not an emergency
Projects
None yet
Development

No branches or pull requests

1 participant