Trait wgpu_core::hub::Access

source ·
pub trait Access<A> { }
Expand description

Type system for enforcing the lock order on Hub fields.

If type A implements Access<B>, that means we are allowed to proceed with locking resource B after we lock A.

The implementations of Access basically describe the edges in an acyclic directed graph of lock transitions. As long as it doesn’t have cycles, any number of threads can acquire locks along paths through the graph without deadlock. That is, if you look at each thread’s lock acquisitions as steps along a path in the graph, then because there are no cycles in the graph, there must always be some thread that is able to acquire its next lock, or that is about to release a lock. (Assume that no thread just sits on its locks forever.)

Locks must be acquired in the following order:

That is, you may only acquire a new lock on a Hub field if it appears in the list after all the other fields you’re already holding locks for. When you are holding no locks, you can start anywhere.

It’s fine to add more Access implementations as needed, as long as you do not introduce a cycle. In other words, as long as there is some ordering you can put the resource types in that respects the extant Access implementations, that’s fine.

See the documentation for Hub for more details.

Implementors§

source§

impl Access<Instance> for Root

source§

impl Access<Surface> for Root

source§

impl Access<Surface> for Instance

source§

impl<A: HalApi> Access<BindGroup<A>> for Root

source§

impl<A: HalApi> Access<BindGroup<A>> for BindGroupLayout<A>

source§

impl<A: HalApi> Access<BindGroup<A>> for PipelineLayout<A>

source§

impl<A: HalApi> Access<BindGroup<A>> for CommandBuffer<A>

source§

impl<A: HalApi> Access<BindGroup<A>> for Device<A>

source§

impl<A: HalApi> Access<BindGroupLayout<A>> for Root

source§

impl<A: HalApi> Access<BindGroupLayout<A>> for PipelineLayout<A>

source§

impl<A: HalApi> Access<BindGroupLayout<A>> for Device<A>

source§

impl<A: HalApi> Access<PipelineLayout<A>> for Root

source§

impl<A: HalApi> Access<PipelineLayout<A>> for RenderBundle<A>

source§

impl<A: HalApi> Access<PipelineLayout<A>> for Device<A>

source§

impl<A: HalApi> Access<CommandBuffer<A>> for Root

source§

impl<A: HalApi> Access<CommandBuffer<A>> for Device<A>

source§

impl<A: HalApi> Access<RenderBundle<A>> for CommandBuffer<A>

source§

impl<A: HalApi> Access<RenderBundle<A>> for Device<A>

source§

impl<A: HalApi> Access<Device<A>> for Root

source§

impl<A: HalApi> Access<Device<A>> for Adapter<A>

source§

impl<A: HalApi> Access<Device<A>> for Surface

source§

impl<A: HalApi> Access<Adapter<A>> for Root

source§

impl<A: HalApi> Access<Adapter<A>> for Surface

source§

impl<A: HalApi> Access<ComputePipeline<A>> for BindGroup<A>

source§

impl<A: HalApi> Access<ComputePipeline<A>> for Device<A>

source§

impl<A: HalApi> Access<RenderPipeline<A>> for BindGroup<A>

source§

impl<A: HalApi> Access<RenderPipeline<A>> for Device<A>

source§

impl<A: HalApi> Access<RenderPipeline<A>> for ComputePipeline<A>

source§

impl<A: HalApi> Access<ShaderModule<A>> for BindGroupLayout<A>

source§

impl<A: HalApi> Access<ShaderModule<A>> for Device<A>

source§

impl<A: HalApi> Access<Buffer<A>> for Root

source§

impl<A: HalApi> Access<Buffer<A>> for BindGroup<A>

source§

impl<A: HalApi> Access<Buffer<A>> for BindGroupLayout<A>

source§

impl<A: HalApi> Access<Buffer<A>> for CommandBuffer<A>

source§

impl<A: HalApi> Access<Buffer<A>> for Device<A>

source§

impl<A: HalApi> Access<Buffer<A>> for ComputePipeline<A>

source§

impl<A: HalApi> Access<Buffer<A>> for RenderPipeline<A>

source§

impl<A: HalApi> Access<Buffer<A>> for QuerySet<A>

source§

impl<A: HalApi> Access<QuerySet<A>> for Root

source§

impl<A: HalApi> Access<QuerySet<A>> for CommandBuffer<A>

source§

impl<A: HalApi> Access<QuerySet<A>> for Device<A>

source§

impl<A: HalApi> Access<QuerySet<A>> for ComputePipeline<A>

source§

impl<A: HalApi> Access<QuerySet<A>> for RenderPipeline<A>

source§

impl<A: HalApi> Access<QuerySet<A>> for Sampler<A>

source§

impl<A: HalApi> Access<Sampler<A>> for Root

source§

impl<A: HalApi> Access<Sampler<A>> for Device<A>

source§

impl<A: HalApi> Access<Sampler<A>> for TextureView<A>

source§

impl<A: HalApi> Access<StagingBuffer<A>> for Device<A>

source§

impl<A: HalApi> Access<Texture<A>> for Root

source§

impl<A: HalApi> Access<Texture<A>> for Device<A>

source§

impl<A: HalApi> Access<Texture<A>> for Buffer<A>

source§

impl<A: HalApi> Access<TextureView<A>> for Root

source§

impl<A: HalApi> Access<TextureView<A>> for Device<A>

source§

impl<A: HalApi> Access<TextureView<A>> for Texture<A>