Query.h 932 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef ANKI_GL_QUERY_H
  2. #define ANKI_GL_QUERY_H
  3. #include "anki/gl/GlObject.h"
  4. namespace anki {
  5. /// @addtogroup OpenGL
  6. /// @{
  7. /// Query object
  8. class Query: public GlObjectContextNonSharable
  9. {
  10. public:
  11. typedef GlObjectContextNonSharable Base;
  12. /// @name Constructors/Destructor
  13. /// @{
  14. /// @param q One of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED,
  15. /// GL_TIME_ELAPSED
  16. Query(GLenum q);
  17. /// Move
  18. Query(Query&& b)
  19. {
  20. *this = std::move(b);
  21. }
  22. ~Query();
  23. /// @}
  24. /// Move
  25. Query& operator=(Query&& b);
  26. /// Start
  27. void begin();
  28. /// End
  29. void end();
  30. /// Get results. Waits for operations to finish
  31. GLuint64 getResult();
  32. /// Get results. Doesn't Wait for operations to finish. If @a finished is
  33. /// false then the return value is irrelevant
  34. GLuint64 getResultNoWait(Bool& finished);
  35. private:
  36. GLenum question;
  37. void create(const GLenum q);
  38. void destroy();
  39. };
  40. /// @}
  41. } // end namespace anki
  42. #endif