]> git.tdb.fi Git - libs/gl.git/blob - source/core/query.h
Store query pool size separately, in the common part of the class
[libs/gl.git] / source / core / query.h
1 #ifndef MSP_GL_QUERY_H_
2 #define MSP_GL_QUERY_H_
3
4 #include <msp/core/noncopyable.h>
5 #include "query_backend.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Renderer;
11
12 enum QueryType
13 {
14         OCCLUSION_QUERY
15 };
16
17 class QueryPool: public QueryPoolBackend, public Msp::NonCopyable
18 {
19         friend QueryPoolBackend;
20
21 public:
22         class Activate
23         {
24         private:
25                 Renderer &renderer;
26                 const QueryPool &pool;
27                 unsigned index;
28
29         public:
30                 Activate(Renderer &, const QueryPool &, unsigned);
31                 ~Activate();
32         };
33
34 private:
35         QueryType type;
36         unsigned size;
37
38 public:
39         QueryPool(QueryType type, unsigned);
40
41         void resize(unsigned);
42         unsigned get_size() const { return size; }
43
44         using QueryPoolBackend::get_result;
45 };
46
47 } // namespace Msp
48 } // namespace GL
49
50 #endif