BsVulkanSwapChain.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "BsEventQuery.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup Vulkan
  9. * @{
  10. */
  11. /** Vulkan swap chain containing two or more buffers for rendering and presenting onto the screen. */
  12. class VulkanSwapChain
  13. {
  14. public:
  15. ~VulkanSwapChain();
  16. /** Rebuilds the swap chain with the provided properties. Destroys any previously existing swap chain. */
  17. void rebuild(const SPtr<VulkanDevice>& device, VkSurfaceKHR surface, UINT32 width, UINT32 height, bool vsync,
  18. VkFormat colorFormat, VkColorSpaceKHR colorSpace);
  19. // TODO - swapBuffers(), getBackBuffer()
  20. /**
  21. * Returns the actual width of the swap chain, in pixels. This might differ from the requested size in case it
  22. * wasn't supported.
  23. */
  24. UINT32 getWidth() const { return mWidth; }
  25. /**
  26. * Returns the actual height of the swap chain, in pixels. This might differ from the requested size in case it
  27. * wasn't supported.
  28. */
  29. UINT32 getHeight() const { return mHeight; }
  30. private:
  31. /** Description of a single swap chain surface. */
  32. struct SwapChainSurface
  33. {
  34. VkImage image;
  35. VkImageView view;
  36. };
  37. SPtr<VulkanDevice> mDevice;
  38. VkSwapchainKHR mSwapChain = VK_NULL_HANDLE;
  39. UINT32 mWidth = 0;
  40. UINT32 mHeight = 0;
  41. Vector<SwapChainSurface> mSurfaces;
  42. };
  43. /** @} */
  44. }