-
Notifications
You must be signed in to change notification settings - Fork 195
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
"Safety issue" with (some?) handle types implementing Sync + Send #665
Comments
Vulkan objects generally have nontrivial concurrency properties that, as with all of Vulkan's other myriad soundness rules, are your responsibility to enforce. It's not obvious to me that this even merits a special callout, since it goes without saying that you must refer to the spec to determine correct usage of any nontrivial Vulkan interface. |
And there are exception to the general concurrency rules. For example,
So enforcing such rules in ash would break things. This is where the Vulkan Validation Layer comes in. It does all the soundness checks so you don't have to. |
The validation layers are like a sanitizer; they find some issues, but will never be able to check literally everything. |
Agreed. That said VVL does a great good job and I can't imagine not using it. |
Do validation layers do a good job of catching threading errors? Just curious. Anyway... The issue is that most Rust libraries work with the type system so that if it compiles you can be fairly confident that there are no threading or memory errors. Now that I think about it, my original suggestion to document in Probably most Vulkan programmers will "intuitively" sense that |
The consensus is that, because Vulkan defines concurrency on a per-command rather than per-object basis, removing To answer your request for extra documentation, this is already mentioned in the README:
Which includes concurrency, even if not mentioned explicitly. |
I noticed that the handle types generated by the
define_handle!
macro addSync + Send
to the type in a way that is technically unsafe. For example, it is illegal in Vulkan to concurrently add commands to a CommandBuffer from multiple threads. Yet, since a CommandBuffer handle is bothClone
andSend
, it is possible for applications to perform this illegal action.I'm not sure what the right action here is. I know that ash doesn't have the goal of enforcing complete safety via the type system (there's Vulkano for that). I haven't thought deeply about the DX implications of trying to remove
Sync
and/orSend
from (some) handle types, but it doesn't seem like it could happen without significant repercussions.Perhaps it would be desirable/sufficient to document this "gotcha" somewhere like
macros.rs
?The text was updated successfully, but these errors were encountered: