bevy_render/render_resource/
bind_group_layout.rs1use crate::define_atomic_id;
2use crate::renderer::WgpuWrapper;
3use core::ops::Deref;
4
5define_atomic_id!(BindGroupLayoutId);
6
7#[derive(Clone, Debug)]
16pub struct BindGroupLayout {
17 id: BindGroupLayoutId,
18 value: WgpuWrapper<wgpu::BindGroupLayout>,
19}
20
21impl PartialEq for BindGroupLayout {
22 fn eq(&self, other: &Self) -> bool {
23 self.id == other.id
24 }
25}
26
27impl Eq for BindGroupLayout {}
28
29impl core::hash::Hash for BindGroupLayout {
30 fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
31 self.id.0.hash(state);
32 }
33}
34
35impl BindGroupLayout {
36 #[inline]
38 pub fn id(&self) -> BindGroupLayoutId {
39 self.id
40 }
41
42 #[inline]
43 pub fn value(&self) -> &wgpu::BindGroupLayout {
44 &self.value
45 }
46}
47
48impl From<wgpu::BindGroupLayout> for BindGroupLayout {
49 fn from(value: wgpu::BindGroupLayout) -> Self {
50 BindGroupLayout {
51 id: BindGroupLayoutId::new(),
52 value: WgpuWrapper::new(value),
53 }
54 }
55}
56
57impl Deref for BindGroupLayout {
58 type Target = wgpu::BindGroupLayout;
59
60 #[inline]
61 fn deref(&self) -> &Self::Target {
62 &self.value
63 }
64}