File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1414
1515[package ]
1616name = " gfx"
17- version = " 0.2.1 "
17+ version = " 0.2.2 "
1818description = " A high-performance, bindless graphics API"
1919homepage = " https://github.com/gfx-rs/gfx-rs"
2020repository = " https://github.com/gfx-rs/gfx-rs"
Original file line number Diff line number Diff line change @@ -177,6 +177,8 @@ pub trait Producer<R: Resources> {
177177 fn make_surface ( & mut self , R :: Surface , tex:: SurfaceInfo ) -> Surface < R > ;
178178 fn make_texture ( & mut self , R :: Texture , tex:: TextureInfo ) -> Texture < R > ;
179179 fn make_sampler ( & mut self , R :: Sampler , tex:: SamplerInfo ) -> Sampler < R > ;
180+ /// Walk through all the handles, keep ones that are reference elsewhere
181+ /// and call the provided delete function (resource-specific) for others
180182 fn clean_with < T ,
181183 F1 : Fn ( & mut T , & R :: Buffer ) ,
182184 F2 : Fn ( & mut T , & R :: ArrayBuffer ) ,
@@ -298,6 +300,17 @@ impl<R: Resources> Manager<R> {
298300 self . textures . extend ( other. textures . iter ( ) . map ( |h| h. clone ( ) ) ) ;
299301 self . samplers . extend ( other. samplers . iter ( ) . map ( |h| h. clone ( ) ) ) ;
300302 }
303+ /// Count the total number of referenced resources
304+ pub fn count ( & self ) -> usize {
305+ self . buffers . len ( ) +
306+ self . array_buffers . len ( ) +
307+ self . shaders . len ( ) +
308+ self . programs . len ( ) +
309+ self . frame_buffers . len ( ) +
310+ self . surfaces . len ( ) +
311+ self . textures . len ( ) +
312+ self . samplers . len ( )
313+ }
301314 /// Reference a buffer
302315 pub fn ref_buffer ( & mut self , handle : & RawBuffer < R > ) -> R :: Buffer {
303316 self . buffers . push ( handle. 0 . clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments