-
Notifications
You must be signed in to change notification settings - Fork 192
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
extensions/khr: Take the remaining p_next
-containing structs as &mut
#744
Conversation
Searching for
that are (On a side-note |
SGTM. |
3366992
to
564a417
Compare
pNext
-initialized struct to get_physical_device_surface_capabilities2
p_next
-containing structs as &mut
Version 2 of `get_physical_device_surface_capabilities` and the matching `vk::SurfaceCapabilitiesKHR` struct exist solely to provide an `sType` and `pNext` field to allow extending the original query with additional data via extension structs. However, this API when introduced in #530 only returns the `default()`-initialized struct making it just as constrained as `get_physical_device_surface_capabilities()`. Solve this by taking `vk::SurfaceCapabilities2KHR` as `&mut` just like any similar API. And just like this, do the same for the remaining: - `AccelerationStructure::get_acceleration_structure_build_sizes()` - `ExternalMemoryFd::get_memory_fd_properties()` - `ExternalMemoryWin32::get_memory_win32_handle_properties()` In case these structs get extended somewhere down the line, which the Vulkan API allows for.
…f `vk::AccelerationStructureCompatibilityKHR::default()`
564a417
to
0a90b47
Compare
…`pNext` We've often discussed `pNext` chains in output arrays (i.e. #465, #588, #744), and I always wondered why `read_into_defaulted_vector()` still existed: turns out this helper function was only hiding a few more remaining cases where the caller was previously _not_ able to manually extend the `pNext` chain to request arbitrary more structures to be filled with information. Replace these remaining cases with a separate `_len()` getter, and have the main function take a caller-allocated `&mut [T]` slice where they can initialize the target struct including `pNext` pointer chains.
…`pNext` We've often discussed `pNext` chains in output arrays (i.e. #465, #588, #744), and I always wondered why `read_into_defaulted_vector()` still existed: turns out this helper function was only hiding a few more remaining cases where the caller was previously _not_ able to manually extend the `pNext` chain to request arbitrary more structures to be filled with information. Replace these remaining cases with a separate `_len()` getter, and have the main function take a caller-allocated `&mut [T]` slice where they can initialize the target struct including `pNext` pointer chains.
…`pNext` We've often discussed `pNext` chains in output arrays (i.e. #465, #588, #744), and I always wondered why `read_into_defaulted_vector()` still existed: turns out this helper function was only hiding a few more remaining cases where the caller was previously _not_ able to manually extend the `pNext` chain to request arbitrary more structures to be filled with information. Replace these remaining cases with a separate `_len()` getter, and have the main function take a caller-allocated `&mut [T]` slice where they can initialize the target struct including `pNext` pointer chains.
…`pNext` (#966) We've often discussed `pNext` chains in output arrays (i.e. #465, #588, #744), and I always wondered why `read_into_defaulted_vector()` still existed: turns out this helper function was only hiding a few more remaining cases where the caller was previously _not_ able to manually extend the `pNext` chain to request arbitrary more structures to be filled with information. Replace these remaining cases with a separate `_len()` getter, and have the main function take a caller-allocated `&mut [T]` slice where they can initialize the target struct including `pNext` pointer chains.
Fixes #740
Version 2 of
get_physical_device_surface_capabilities
and the matchingvk::SurfaceCapabilitiesKHR
struct exist solely to provide ansType
andpNext
field to allow extending the original query with additional data via extension structs. However, this API when introduced in #530 only returns thedefault()
-initialized struct making it just as constrained asget_physical_device_surface_capabilities()
. Solve this by takingvk::SurfaceCapabilities2KHR
as&mut
just like any similar API.And just like this, do the same for the remaining:
AccelerationStructure::get_acceleration_structure_build_sizes()
ExternalMemoryFd::get_memory_fd_properties()
ExternalMemoryWin32::get_memory_win32_handle_properties()
In case these structs get extended somewhere down the line, which the Vulkan API allows for.