Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
gl
recently_used_cache.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2013-2014 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Daniel van Vugt <daniel.van.vugt@canonical.com>
17
* Kevin DuBois <kevin.dubois@canonical.com>
18
*/
19
20
#ifndef MIR_GL_RECENTLY_USED_CACHE_H_
21
#define MIR_GL_RECENTLY_USED_CACHE_H_
22
23
#include "
mir/gl/texture_cache.h
"
24
#include "
mir/gl/texture.h
"
25
#include "
mir/graphics/buffer_id.h
"
26
#include "
mir/graphics/renderable.h
"
27
#include <unordered_map>
28
29
namespace
mir
30
{
31
namespace
graphics {
class
Buffer
; }
32
namespace
gl
33
{
34
class
RecentlyUsedCache
:
public
TextureCache
35
{
36
public
:
37
std::shared_ptr<Texture> load(
graphics::Renderable
const
& renderable)
override
;
38
void
invalidate()
override
;
39
void
drop_unused()
override
;
40
41
private
:
42
struct
Entry
43
{
44
Entry()
45
: texture(std::make_shared<Texture>())
46
{}
47
std::shared_ptr<Texture> texture;
48
graphics::BufferID
last_bound_buffer;
49
bool
used{
true
};
50
bool
valid_binding{
false
};
51
std::shared_ptr<graphics::Buffer> resource;
52
};
53
54
std::unordered_map<graphics::Renderable::ID, Entry> textures;
55
};
56
}
57
}
58
59
#endif
/* MIR_GL_RECENTLY_USED_CACHE_H_ */
buffer_id.h
mir
All things Mir.
Definition:
atomic_callback.h:25
texture_cache.h
mir::gl::TextureCache
Definition:
texture_cache.h:31
texture.h
mir::gl::RecentlyUsedCache
Definition:
recently_used_cache.h:34
mir::graphics::Renderable
Definition:
renderable.h:33
mir::IntWrapper< BufferIdTag, uint32_t >
mir::graphics::Buffer
Definition:
buffer.h:44
renderable.h
Copyright © 2012-2015 Canonical Ltd.
Generated on Wed Mar 30 00:29:56 UTC 2016