bevy/pipelined/bevy_render2/src/render_resource/bind_group.rs

33 lines
620 B
Rust
Raw Normal View History

2021-06-21 23:28:52 +00:00
use bevy_reflect::Uuid;
use std::sync::Arc;
2021-04-11 20:13:07 +00:00
2021-06-21 23:28:52 +00:00
#[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)]
pub struct BindGroupId(Uuid);
2021-04-11 20:13:07 +00:00
2021-06-21 23:28:52 +00:00
#[derive(Clone, Debug)]
2021-04-11 20:13:07 +00:00
pub struct BindGroup {
2021-06-21 23:28:52 +00:00
id: BindGroupId,
value: Arc<wgpu::BindGroup>,
2021-04-11 20:13:07 +00:00
}
impl BindGroup {
2021-06-21 23:28:52 +00:00
#[inline]
pub fn id(&self) -> BindGroupId {
self.id
2021-04-11 20:13:07 +00:00
}
2021-06-21 23:28:52 +00:00
#[inline]
pub fn value(&self) -> &wgpu::BindGroup {
&self.value
2021-04-11 20:13:07 +00:00
}
2021-06-21 23:28:52 +00:00
}
2021-04-11 20:13:07 +00:00
2021-06-21 23:28:52 +00:00
impl From<wgpu::BindGroup> for BindGroup {
fn from(value: wgpu::BindGroup) -> Self {
2021-04-11 20:13:07 +00:00
BindGroup {
2021-06-21 23:28:52 +00:00
id: BindGroupId(Uuid::new_v4()),
value: Arc::new(value),
2021-04-11 20:13:07 +00:00
}
}
}