Small improvements to cache (#130)

* Remove `Arc` around `RenderPipeline`

It is not necessary anymore in last `wgpu` version.

* Replace `RwLock` with `Mutex`

It was only used for writing.
This commit is contained in:
Alphyr 2025-02-05 03:04:11 +01:00 committed by Héctor Ramón Jiménez
parent 114cfa3e02
commit 505f12f6ce
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 13 additions and 14 deletions

View file

@ -4,7 +4,7 @@ use crate::{
use etagere::{size2, Allocation, BucketedAtlasAllocator};
use lru::LruCache;
use rustc_hash::FxHasher;
use std::{collections::HashSet, hash::BuildHasherDefault, sync::Arc};
use std::{collections::HashSet, hash::BuildHasherDefault};
use wgpu::{
BindGroup, DepthStencilState, Device, Extent3d, MultisampleState, Origin3d, Queue,
RenderPipeline, TexelCopyBufferLayout, TexelCopyTextureInfo, Texture, TextureAspect,
@ -329,7 +329,7 @@ impl TextAtlas {
device: &Device,
multisample: MultisampleState,
depth_stencil: Option<DepthStencilState>,
) -> Arc<RenderPipeline> {
) -> RenderPipeline {
self.cache
.get_or_create_pipeline(device, self.format, multisample, depth_stencil)
}