HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_OGLQuery.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RE_OGLQuery.h ( RE Library, C++)
7  *
8  * COMMENTS:
9  * Base class for GL queries (timer, occlusion, transform feedback prims)
10  */
11 #ifndef RE_OGLQuery_h
12 #define RE_OGLQuery_h
13 
15 
17 {
18 public:
19  ~RE_OGLQuery() override;
20 
21  /// Create the query. A query cannot be created if another query is active.
22  bool init(RE_Render *r) override;
23 
24  /// Bracket the draw calls to measure with begin and end.
25  /// @{
26  virtual bool begin(RE_Render *r);
27  virtual void end(RE_Render *r);
28  /// @}
29 
30  /// Returns true if the query result is available from the GL server.
31  bool isResultAvailable(RE_Render *r) const;
32 
33  /// returns true if a query block has been executed in the past.
34  bool isQueryBlockDone() const { return myQueryPerformed; }
35 
36  /// Get Raw GL ID of the query object
37  int getID() const { return myID; }
38 
39  /// resets the query object so that isQueryBlockDone() returns false, as if
40  /// a query had never been performed.
41  void reset();
42 
43  /// Deletes the query ID. init() must be called again.
44  void destroy();
45 
46 protected:
47 
48  RE_OGLQuery(RE_Extension extension_type,
49  int gl_query_type,
50  int stream_num,
51  RE_Extension alternate_extension = RE_EXT_INVALID,
52  int alt_gl_query_type = 0);
53 
54  int getIntResult(RE_Render *r);
55  int64 getLongResult(RE_Render *r);
56 
57  bool queryCounter(RE_Render *r);
58 
59 private:
60  RE_Extension myExtension;
61  RE_Extension myAltExtension;
62  bool myActiveQuery;
63  bool myQueryPerformed;
64  bool myHasResult;
65  unsigned int myID;
66  int myQueryType;
67  int myAltQueryType;
68  int myStreamNum;
69 
70  union {
71  int myInt;
73  } myResult;
74 };
75 
77 {
78 public:
80 
81  /// Fetch the number of primitives generated by the GPU
83 };
84 
85 // No RE_API - used by RE_Render only.
87 {
88 public:
90 
91  /// Fetch the number of primitives captured by transform feedback
93 };
94 
95 #endif
GLuint GLuint stream
Definition: glcorearb.h:1832
#define RE_API
Definition: RE_API.h:10
virtual bool init(RE_Render *r)=0
GLboolean reset
Definition: glad.h:5138
GLuint GLuint end
Definition: glcorearb.h:475
int64 myInt64
Definition: RE_OGLQuery.h:72
bool isQueryBlockDone() const
returns true if a query block has been executed in the past.
Definition: RE_OGLQuery.h:34
long long int64
Definition: SYS_Types.h:116
int getIntResult(RE_Render *r)
int getNumPrimitives(RE_Render *r)
Fetch the number of primitives generated by the GPU.
Definition: RE_OGLQuery.h:82
int getID() const
Get Raw GL ID of the query object.
Definition: RE_OGLQuery.h:37
GLboolean r
Definition: glcorearb.h:1222
RE_FeedbackPrimitivesWrittenQuery(int stream=0)
int getNumPrimitives(RE_Render *r)
Fetch the number of primitives captured by transform feedback.
Definition: RE_OGLQuery.h:92
RE_Extension
Definition: RE_Extension.h:4
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
Definition: node.h:483