BsGLTimerQuery.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsGLPrerequisites.h"
  6. #include "BsTimerQuery.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief OpenGL implementation of a timer query.
  11. */
  12. class BS_RSGL_EXPORT GLTimerQuery : public TimerQuery
  13. {
  14. public:
  15. GLTimerQuery();
  16. ~GLTimerQuery();
  17. /**
  18. * @copydoc TimerQuery::begin
  19. */
  20. virtual void begin();
  21. /**
  22. * @copydoc TimerQuery::end
  23. */
  24. virtual void end();
  25. /**
  26. * @copydoc TimerQuery::isReady
  27. */
  28. virtual bool isReady() const;
  29. /**
  30. * @copydoc TimerQuery::getTimeMs
  31. */
  32. virtual float getTimeMs();
  33. private:
  34. friend class QueryManager;
  35. /**
  36. * @brief Processes query results and saves them for later use. To be called
  37. * when query has completed.
  38. */
  39. void finalize();
  40. private:
  41. GLuint mQueryStartObj;
  42. GLuint mQueryEndObj;
  43. bool mFinalized;
  44. bool mEndIssued;
  45. float mTimeDelta;
  46. };
  47. }