CmEventQuery.h 1007 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. namespace CamelotFramework
  4. {
  5. /**
  6. * @brief Represents a GPU query that gets triggered when GPU starts processing the query.
  7. *
  8. * @note Normally GPU will have many commands in its command buffer. When EventQuery::begin is called it is placed
  9. * in that command buffer. Once the buffer empties and GPU reaches the EventQuery command, the query
  10. * callback is triggered.
  11. *
  12. * Core thread only.
  13. */
  14. class CM_EXPORT EventQuery
  15. {
  16. public:
  17. virtual ~EventQuery() {}
  18. /**
  19. * @brief Starts the query.
  20. *
  21. * @note Once the query is started you may poll "isReady" method to check when query has finished,
  22. * or you may hook up an "onTriggered" callback and be notified that way.
  23. */
  24. virtual void begin() = 0;
  25. /**
  26. * @brief Check if GPU has processed the query.
  27. */
  28. virtual bool isReady() const = 0;
  29. boost::signal<void()> onTriggered;
  30. static EventQueryPtr create();
  31. };
  32. }