-
Notifications
You must be signed in to change notification settings - Fork 190
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: Always return pipeline
/shaders
, even on error
#828
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tempting to push for (Vec<T>, Result<()>)
here, but it does make it a lot easier to forget to check the error condition.
Yeah it's unfortunate that there's no lint to catch an unused |
16b5e9b
to
358521c
Compare
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/chap10.html#pipelines-multiple Turns out there's actually documentation for this, and the references+language are being updated upstream. I'd still like to think of a better way to represent the validity of the return values (and necessity to clean up non-NULL handles) before merging this in. |
We could do |
I've been contemplating that but it sets the false precedent that every pipeline individually has an error code. It seems better than the status-quo, though! |
|
Also considered, but that might be ambiguous with |
We're gonna write high-level bindings at this point, but how about an It wouldn't have access to the |
Anything like RAII ownership of Vulkan objects starts feeling out of scope for ash. We could panic rather than destroy, but I'm not sure that'll do much good compared to a static mechanism. I feel like the original proposal here ( |
It'd also start implying that similar mechanisms are available or supposed to be available on other types, which wouldn't be the case by for |
358521c
to
8e5c5b9
Compare
Upstream documentation improvements have been merged, command pages now contain this:
I'll adopt and update the relevant portions of that doc here in |
8e5c5b9
to
a668edb
Compare
Perhaps that doc is a bit excessive. I pruned it down somewhat, but we could also boil it down to just the link, or perhaps at the very least (because of the return signature) state that valid references may always be returned - corresponding to |
Yeah, I think something a lot more terse will suffice. No need to duplicate upstream docs at length. Maybe something like:
|
In `ash::Device` `create_compute_pipeline()` and `create_graphics_pipeline()` already return the list of pipelines regardless of the error code, as [documented in the Multiple Pipeline Creation chapter]. Callers are expected to scan the returned array for valid pipeline handles and either use or destroy them (when handling an error). Furthermore, the caller is guaranteed that all handles will be NULL after the first returned NULL handle when `VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT` is set. An upstream Khronos/Vulkan request which has since been merged to the documentation makes all pipeline creation functions across the core and extensions point to this `Multiple Pipeline Creation` chapter which has also been improved, clarifying that they too return impartial results. This documentation reference has been embedded in `ash`. `VK_EXT_shader_object` is similar in nature, but has its own documentation to account for the difference in naming. [documented in the Multiple Pipeline Creation chapter]: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/chap10.html#pipelines-multiple
a668edb
to
a907be8
Compare
In
ash::Device
create_compute_pipeline()
andcreate_graphics_pipeline()
already return the list of pipelines regardless of the error code, as documented in the Multiple Pipeline Creation chapter. Callers are expected to scan the returned array for valid pipeline handles and either use or destroy them (when handling an error). Furthermore, the caller is guaranteed that all handles will be NULL after the first returned NULL handle whenVK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT
is set.An upstream Khronos/Vulkan request which has since been merged to the documentation makes all pipeline creation functions across the core and extensions point to this
Multiple Pipeline Creation
chapter which has also been improved, clarifying that they too return impartial results. This documentation reference has been embedded inash
.VK_EXT_shader_object
is similar in nature, but has its own documentation to account for the difference in naming.