BsGLTimerQuery.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "RenderAPI/BsTimerQuery.h"
  6. namespace bs { namespace ct
  7. {
  8. /** @addtogroup GL
  9. * @{
  10. */
  11. /** OpenGL implementation of a timer query. */
  12. class GLTimerQuery : public TimerQuery
  13. {
  14. public:
  15. GLTimerQuery(UINT32 deviceIdx);
  16. ~GLTimerQuery();
  17. /** @copydoc TimerQuery::begin */
  18. void begin(const SPtr<CommandBuffer>& cb = nullptr) override;
  19. /** @copydoc TimerQuery::end */
  20. void end(const SPtr<CommandBuffer>& cb = nullptr) override;
  21. /** @copydoc TimerQuery::isReady */
  22. bool isReady() const override;
  23. /** @copydoc TimerQuery::getTimeMs */
  24. float getTimeMs() override;
  25. private:
  26. friend class QueryManager;
  27. /** Processes query results and saves them for later use. To be called when query has completed. */
  28. void finalize();
  29. private:
  30. GLuint mQueryStartObj;
  31. GLuint mQueryEndObj;
  32. bool mFinalized;
  33. bool mEndIssued;
  34. float mTimeDelta;
  35. };
  36. /** @} */
  37. }}