]> git.tdb.fi Git - libs/gl.git/blob - source/core/query.h
Move swizzling modes to pixelformat.h
[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         /** Query result indicates if any fragments passed the depth and stencil
15         tests. */
16         OCCLUSION_QUERY
17 };
18
19 /**
20 A collection of query objects, which can be used to gather feedback from the
21 GPU.  Semantics of the queries depend on the query type.
22 */
23 class QueryPool: public QueryPoolBackend, public Msp::NonCopyable
24 {
25         friend QueryPoolBackend;
26
27 public:
28         class Activate
29         {
30         private:
31                 Renderer &renderer;
32                 const QueryPool &pool;
33                 unsigned index;
34
35         public:
36                 Activate(Renderer &, const QueryPool &, unsigned);
37                 ~Activate();
38         };
39
40 private:
41         QueryType type;
42         unsigned size;
43
44 public:
45         QueryPool(QueryType type, unsigned);
46
47         void resize(unsigned);
48         unsigned get_size() const { return size; }
49
50         using QueryPoolBackend::get_result;
51 };
52
53 } // namespace Msp
54 } // namespace GL
55
56 #endif