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