Skip to content

Remove unnecessary Arc #2938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions wgpu/src/image/atlas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@ pub const SIZE: u32 = 2048;
use crate::core::Size;
use crate::graphics::color;

use std::sync::Arc;

#[derive(Debug)]
pub struct Atlas {
backend: wgpu::Backend,
texture: wgpu::Texture,
texture_view: wgpu::TextureView,
texture_bind_group: wgpu::BindGroup,
texture_layout: Arc<wgpu::BindGroupLayout>,
texture_layout: wgpu::BindGroupLayout,
layers: Vec<Layer>,
}

impl Atlas {
pub fn new(
device: &wgpu::Device,
backend: wgpu::Backend,
texture_layout: Arc<wgpu::BindGroupLayout>,
texture_layout: wgpu::BindGroupLayout,
) -> Self {
let layers = match backend {
// On the GL backend we start with 2 layers, to help wgpu figure
Expand Down
4 changes: 1 addition & 3 deletions wgpu/src/image/cache.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use crate::core::{self, Size};
use crate::image::atlas::{self, Atlas};

use std::sync::Arc;

#[derive(Debug)]
pub struct Cache {
atlas: Atlas,
Expand All @@ -16,7 +14,7 @@ impl Cache {
pub fn new(
device: &wgpu::Device,
backend: wgpu::Backend,
layout: Arc<wgpu::BindGroupLayout>,
layout: wgpu::BindGroupLayout,
) -> Self {
Self {
atlas: Atlas::new(device, backend, layout),
Expand Down
5 changes: 2 additions & 3 deletions wgpu/src/image/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use crate::core::{Rectangle, Size, Transformation};
use bytemuck::{Pod, Zeroable};

use std::mem;
use std::sync::Arc;

pub use crate::graphics::Image;

Expand All @@ -27,7 +26,7 @@ pub struct Pipeline {
backend: wgpu::Backend,
nearest_sampler: wgpu::Sampler,
linear_sampler: wgpu::Sampler,
texture_layout: Arc<wgpu::BindGroupLayout>,
texture_layout: wgpu::BindGroupLayout,
constant_layout: wgpu::BindGroupLayout,
}

Expand Down Expand Up @@ -196,7 +195,7 @@ impl Pipeline {
backend,
nearest_sampler,
linear_sampler,
texture_layout: Arc::new(texture_layout),
texture_layout,
constant_layout,
}
}
Expand Down