BsVulkanTimerQuery.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsVulkanPrerequisites.h"
  5. #include "RenderAPI/BsTimerQuery.h"
  6. namespace bs { namespace ct
  7. {
  8. /** @addtogroup Vulkan
  9. * @{
  10. */
  11. /** @copydoc TimerQuery */
  12. class VulkanTimerQuery : public TimerQuery
  13. {
  14. public:
  15. VulkanTimerQuery(VulkanDevice& device);
  16. ~VulkanTimerQuery();
  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. /** Returns true if the query begin() was called, but not end(). */
  26. bool _isInProgress() const;
  27. /**
  28. * Interrupts an in-progress query, allowing the command buffer to submitted. Interrupted queries must be resumed
  29. * using _resume().
  30. */
  31. void _interrupt(VulkanCmdBuffer& cb);
  32. /** Resumes an interrupted query, restoring it back to its original in-progress state. */
  33. void _resume(VulkanCmdBuffer& cb);
  34. private:
  35. VulkanDevice& mDevice;
  36. Vector < std::pair<VulkanQuery*, VulkanQuery*>> mQueries;
  37. float mTimeDelta;
  38. bool mQueryEndCalled : 1;
  39. bool mQueryFinalized : 1;
  40. bool mQueryInterrupted : 1;
  41. };
  42. /** @} */
  43. }}