BsVulkanEventQuery.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "BsVulkanResource.h"
  6. #include "RenderAPI/BsEventQuery.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup Vulkan
  10. * @{
  11. */
  12. /** Wrapper around a Vulkan event object that manages its usage and lifetime. */
  13. class VulkanEvent : public VulkanResource
  14. {
  15. public:
  16. VulkanEvent(VulkanResourceManager* owner);
  17. ~VulkanEvent();
  18. /** Returns the internal handle to the Vulkan object. */
  19. VkEvent getHandle() const { return mEvent; }
  20. /** Checks if the event has been signaled on the device. */
  21. bool isSignaled() const;
  22. /** Resets an event back to unsignaled state, making it re-usable. */
  23. void reset();
  24. private:
  25. VkEvent mEvent;
  26. };
  27. /** @copydoc EventQuery */
  28. class VulkanEventQuery : public EventQuery
  29. {
  30. public:
  31. VulkanEventQuery(VulkanDevice& device);
  32. ~VulkanEventQuery();
  33. /** @copydoc EventQuery::begin */
  34. void begin(const SPtr<CommandBuffer>& cb = nullptr) override;
  35. /** @copydoc EventQuery::isReady */
  36. bool isReady() const override;
  37. private:
  38. VulkanDevice& mDevice;
  39. VulkanEvent* mEvent;
  40. };
  41. /** @} */
  42. }}