1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
use std::hash::Hash;
use std::hash::Hasher;
use buffer::BufferAccess;
use descriptor::descriptor::DescriptorDesc;
use device::DeviceOwned;
use image::ImageViewAccess;
use SafeDeref;
use VulkanObject;
pub use self::collection::DescriptorSetsCollection;
pub use self::fixed_size_pool::FixedSizeDescriptorSet;
pub use self::fixed_size_pool::FixedSizeDescriptorSetBuilder;
pub use self::fixed_size_pool::FixedSizeDescriptorSetBuilderArray;
pub use self::fixed_size_pool::FixedSizeDescriptorSetsPool;
pub use self::persistent::PersistentDescriptorSet;
pub use self::persistent::PersistentDescriptorSetBuf;
pub use self::persistent::PersistentDescriptorSetBufView;
pub use self::persistent::PersistentDescriptorSetBuildError;
pub use self::persistent::PersistentDescriptorSetBuilder;
pub use self::persistent::PersistentDescriptorSetBuilderArray;
pub use self::persistent::PersistentDescriptorSetError;
pub use self::persistent::PersistentDescriptorSetImg;
pub use self::persistent::PersistentDescriptorSetSampler;
pub use self::std_pool::StdDescriptorPool;
pub use self::std_pool::StdDescriptorPoolAlloc;
pub use self::sys::DescriptorPool;
pub use self::sys::DescriptorPoolAlloc;
pub use self::sys::DescriptorPoolAllocError;
pub use self::sys::DescriptorWrite;
pub use self::sys::DescriptorsCount;
pub use self::sys::UnsafeDescriptorPool;
pub use self::sys::UnsafeDescriptorPoolAllocIter;
pub use self::sys::UnsafeDescriptorSet;
pub use self::unsafe_layout::UnsafeDescriptorSetLayout;
pub mod collection;
mod fixed_size_pool;
mod persistent;
mod std_pool;
mod sys;
mod unsafe_layout;
pub unsafe trait DescriptorSet: DescriptorSetDesc + DeviceOwned {
fn inner(&self) -> &UnsafeDescriptorSet;
fn num_buffers(&self) -> usize;
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)>;
fn num_images(&self) -> usize;
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)>;
}
unsafe impl<T> DescriptorSet for T
where
T: SafeDeref,
T::Target: DescriptorSet,
{
#[inline]
fn inner(&self) -> &UnsafeDescriptorSet {
(**self).inner()
}
#[inline]
fn num_buffers(&self) -> usize {
(**self).num_buffers()
}
#[inline]
fn buffer(&self, index: usize) -> Option<(&dyn BufferAccess, u32)> {
(**self).buffer(index)
}
#[inline]
fn num_images(&self) -> usize {
(**self).num_images()
}
#[inline]
fn image(&self, index: usize) -> Option<(&dyn ImageViewAccess, u32)> {
(**self).image(index)
}
}
impl PartialEq for dyn DescriptorSet + Send + Sync {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.inner().internal_object() == other.inner().internal_object()
&& self.device() == other.device()
}
}
impl Eq for dyn DescriptorSet + Send + Sync {}
impl Hash for dyn DescriptorSet + Send + Sync {
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.inner().internal_object().hash(state);
self.device().hash(state);
}
}
pub unsafe trait DescriptorSetDesc {
fn num_bindings(&self) -> usize;
fn descriptor(&self, binding: usize) -> Option<DescriptorDesc>;
}
unsafe impl<T> DescriptorSetDesc for T
where
T: SafeDeref,
T::Target: DescriptorSetDesc,
{
#[inline]
fn num_bindings(&self) -> usize {
(**self).num_bindings()
}
#[inline]
fn descriptor(&self, binding: usize) -> Option<DescriptorDesc> {
(**self).descriptor(binding)
}
}