pub fn free_entity(&mut self, render_entity: RenderEntity) {
        use self::RenderEntity::*;

        match render_entity {
            Missing                                 => { }
            Tessellating(_entity_id)                => { }
            VertexBuffer(_buffers, _)               => { }
            SetTransform(_)                         => { }
            SetBlendMode(_)                         => { }
            SetFlatColor                            => { }
            SetDashPattern(_)                       => { }
            RenderSprite(_, _)                      => { }
            DisableClipping                         => { }

            SetFillTexture(texture_id, _, _, _)     => { 
                self.used_textures.get_mut(&texture_id)
                    .map(|usage_count| *usage_count -= 1);
            }

            SetFillGradient(texture_id, _, _, _)    => { 
                self.used_textures.get_mut(&texture_id)
                    .map(|usage_count| *usage_count -= 1);
            }

            EnableClipping(render::VertexBufferId(vertex_id), render::IndexBufferId(index_id), _num_vertices)   |
            DrawIndexed(render::VertexBufferId(vertex_id), render::IndexBufferId(index_id), _num_vertices)      => {
                // Each buffer is only used by one drawing operation, so we can always free them here
                self.free_vertex_buffers.push(vertex_id);
                if index_id != vertex_id {
                    self.free_vertex_buffers.push(index_id);
                }
            }
        }
    }
///
/// Adds the resources used by a render entity to the free pool
///
Adds the resources used by a render entity to the free pool
Adds the resources used by a render entity to the free pool
pub fn free_entity(&mut self, render_entity: RenderEntity) {
        use self::RenderEntity::*;
        match render_entity {
            Missing                                 => { }
            Tessellating(_entity_id)                => { }
            VertexBuffer(_buffers, _)               => { }
            SetTransform(_)                         => { }
            SetBlendMode(_)                         => { }
            SetFlatColor                            => { }
            SetDashPattern(_)                       => { }
            RenderSprite(_, _)                      => { }
            DisableClipping                         => { }
            SetFillTexture(texture_id, _, _, _)     => { 
                self.used_textures.get_mut(&texture_id)
                    .map(|usage_count| *usage_count -= 1);
            }
            SetFillGradient(texture_id, _, _, _)    => { 
                self.used_textures.get_mut(&texture_id)
                    .map(|usage_count| *usage_count -= 1);
            }
            EnableClipping(render::VertexBufferId(vertex_id), render::IndexBufferId(index_id), _num_vertices)   |
            DrawIndexed(render::VertexBufferId(vertex_id), render::IndexBufferId(index_id), _num_vertices)      => {
                // Each buffer is only used by one drawing operation, so we can always free them here
                self.free_vertex_buffers.push(vertex_id);
                if index_id != vertex_id {
                    self.free_vertex_buffers.push(index_id);
                }
            }
        }
    }
pub fn free_entity ( & mut self , render_entity : RenderEntity ) { use self :: RenderEntity :: * ; match render_entity { Missing => { } Tessellating ( _entity_id ) => { } VertexBuffer ( _buffers , _ ) => { } SetTransform ( _ ) => { } SetBlendMode ( _ ) => { } SetFlatColor => { } SetDashPattern ( _ ) => { } RenderSprite ( _ , _ ) => { } DisableClipping => { } SetFillTexture ( texture_id , _ , _ , _ ) => { self . used_textures . get_mut ( & texture_id ) . map ( | usage_count | * usage_count -= 1 ) ; } SetFillGradient ( texture_id , _ , _ , _ ) => { self . used_textures . get_mut ( & texture_id ) . map ( | usage_count | * usage_count -= 1 ) ; } EnableClipping ( render :: VertexBufferId ( vertex_id ) , render :: IndexBufferId ( index_id ) , _num_vertices ) | DrawIndexed ( render :: VertexBufferId ( vertex_id ) , render :: IndexBufferId ( index_id ) , _num_vertices ) => { // Each buffer is only used by one drawing operation, so we can always free them here self . free_vertex_buffers . push ( vertex_id ) ; if index_id != vertex_id { self . free_vertex_buffers . push ( index_id ) ; } } } }
Adds the resources used by a render entity to the free pool
Adds the resources used by a render entity to the free pool
&mut self
render_entity
RenderEntity