Skip to content

Commit

Permalink
removed unused RenderResourceId and SwapChainFrame (#2890)
Browse files Browse the repository at this point in the history
# Objective

- removed unused RenderResourceId and SwapChainFrame (already unified with TextureView)
- added deref to BindGroup, this makes conversion to wgpu::BindGroup easier

## Solution

- cleans up the API
  • Loading branch information
Kurt Kühnert committed Oct 6, 2021
1 parent 0eb11df commit bf19ddf
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 74 deletions.
2 changes: 1 addition & 1 deletion pipelined/bevy_render2/src/render_phase/draw_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
16 changes: 10 additions & 6 deletions pipelined/bevy_render2/src/render_resource/bind_group.rs
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -15,11 +15,6 @@ impl BindGroup {
pub fn id(&self) -> BindGroupId {
self.id
}

#[inline]
pub fn value(&self) -> &wgpu::BindGroup {
&self.value
}
}

impl From<wgpu::BindGroup> for BindGroup {
Expand All @@ -30,3 +25,12 @@ impl From<wgpu::BindGroup> for BindGroup {
}
}
}

impl Deref for BindGroup {
type Target = wgpu::BindGroup;

#[inline]
fn deref(&self) -> &Self::Target {
&self.value
}
}
2 changes: 0 additions & 2 deletions pipelined/bevy_render2/src/render_resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ mod bind_group;
mod buffer;
mod buffer_vec;
mod pipeline;
mod render_resource_id;
mod texture;
mod uniform_vec;

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::*;

Expand Down
34 changes: 0 additions & 34 deletions pipelined/bevy_render2/src/render_resource/render_resource_id.rs

This file was deleted.

31 changes: 0 additions & 31 deletions pipelined/bevy_render2/src/render_resource/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,34 +124,3 @@ impl Deref for Sampler {
&self.value
}
}

#[derive(Clone, Debug)]
pub struct SwapChainFrame {
id: TextureViewId,
value: Arc<wgpu::SwapChainFrame>,
}

impl SwapChainFrame {
#[inline]
pub fn id(&self) -> TextureViewId {
self.id
}
}

impl From<wgpu::SwapChainFrame> 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
}
}

0 comments on commit bf19ddf

Please sign in to comment.