diff --git a/pipelined/bevy_render2/src/render_phase/draw_state.rs b/pipelined/bevy_render2/src/render_phase/draw_state.rs index 4660d28ef50cc..a63260c846b74 100644 --- a/pipelined/bevy_render2/src/render_phase/draw_state.rs +++ b/pipelined/bevy_render2/src/render_phase/draw_state.rs @@ -127,7 +127,7 @@ impl<'a> TrackedRenderPass<'a> { ); } self.pass - .set_bind_group(index as u32, bind_group.value(), dynamic_uniform_indices); + .set_bind_group(index as u32, bind_group, dynamic_uniform_indices); self.state .set_bind_group(index as usize, bind_group.id(), dynamic_uniform_indices); } diff --git a/pipelined/bevy_render2/src/render_resource/bind_group.rs b/pipelined/bevy_render2/src/render_resource/bind_group.rs index c1d514da38dab..75e5262a855c6 100644 --- a/pipelined/bevy_render2/src/render_resource/bind_group.rs +++ b/pipelined/bevy_render2/src/render_resource/bind_group.rs @@ -1,5 +1,5 @@ use bevy_reflect::Uuid; -use std::sync::Arc; +use std::{ops::Deref, sync::Arc}; #[derive(Copy, Clone, Hash, Eq, PartialEq, Debug)] pub struct BindGroupId(Uuid); @@ -15,11 +15,6 @@ impl BindGroup { pub fn id(&self) -> BindGroupId { self.id } - - #[inline] - pub fn value(&self) -> &wgpu::BindGroup { - &self.value - } } impl From for BindGroup { @@ -30,3 +25,12 @@ impl From for BindGroup { } } } + +impl Deref for BindGroup { + type Target = wgpu::BindGroup; + + #[inline] + fn deref(&self) -> &Self::Target { + &self.value + } +} diff --git a/pipelined/bevy_render2/src/render_resource/mod.rs b/pipelined/bevy_render2/src/render_resource/mod.rs index 9de9715f7035d..858052e3b9125 100644 --- a/pipelined/bevy_render2/src/render_resource/mod.rs +++ b/pipelined/bevy_render2/src/render_resource/mod.rs @@ -2,7 +2,6 @@ mod bind_group; mod buffer; mod buffer_vec; mod pipeline; -mod render_resource_id; mod texture; mod uniform_vec; @@ -10,7 +9,6 @@ pub use bind_group::*; pub use buffer::*; pub use buffer_vec::*; pub use pipeline::*; -pub use render_resource_id::*; pub use texture::*; pub use uniform_vec::*; diff --git a/pipelined/bevy_render2/src/render_resource/render_resource_id.rs b/pipelined/bevy_render2/src/render_resource/render_resource_id.rs deleted file mode 100644 index a008ba75ada1d..0000000000000 --- a/pipelined/bevy_render2/src/render_resource/render_resource_id.rs +++ /dev/null @@ -1,34 +0,0 @@ -use crate::render_resource::{BufferId, SamplerId, TextureViewId}; - -#[derive(Debug, Clone, Hash, Eq, PartialEq)] -pub enum RenderResourceId { - Buffer(BufferId), - TextureView(TextureViewId), - Sampler(SamplerId), -} - -impl RenderResourceId { - pub fn get_texture_view(&self) -> Option { - if let RenderResourceId::TextureView(id) = self { - Some(*id) - } else { - None - } - } - - pub fn get_buffer(&self) -> Option { - if let RenderResourceId::Buffer(id) = self { - Some(*id) - } else { - None - } - } - - pub fn get_sampler(&self) -> Option { - if let RenderResourceId::Sampler(id) = self { - Some(*id) - } else { - None - } - } -} diff --git a/pipelined/bevy_render2/src/render_resource/texture.rs b/pipelined/bevy_render2/src/render_resource/texture.rs index 8c778598cffd7..39d290bb2ce3c 100644 --- a/pipelined/bevy_render2/src/render_resource/texture.rs +++ b/pipelined/bevy_render2/src/render_resource/texture.rs @@ -124,34 +124,3 @@ impl Deref for Sampler { &self.value } } - -#[derive(Clone, Debug)] -pub struct SwapChainFrame { - id: TextureViewId, - value: Arc, -} - -impl SwapChainFrame { - #[inline] - pub fn id(&self) -> TextureViewId { - self.id - } -} - -impl From for SwapChainFrame { - fn from(value: wgpu::SwapChainFrame) -> Self { - Self { - id: TextureViewId(Uuid::new_v4()), - value: Arc::new(value), - } - } -} - -impl Deref for SwapChainFrame { - type Target = wgpu::SwapChainFrame; - - #[inline] - fn deref(&self) -> &Self::Target { - &self.value - } -}