BsVulkanFramebuffer.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. namespace BansheeEngine
  6. {
  7. /** @addtogroup Vulkan
  8. * @{
  9. */
  10. /** Represents a single attachment in a Vulkan frame-buffer. */
  11. struct VULKAN_ATTACHMENT_DESC
  12. {
  13. /** View of the image to attach or VK_NULL_HANDLE if none. */
  14. VkImageView view;
  15. /** Format of the attached image. */
  16. VkFormat format;
  17. };
  18. /** Contains parameters used for initializing VulkanFrameBuffer object. */
  19. struct VULKAN_FRAMEBUFFER_DESC
  20. {
  21. /** Images describing the color attachments. */
  22. VULKAN_ATTACHMENT_DESC color[BS_MAX_MULTIPLE_RENDER_TARGETS];
  23. /** Image describing the depth attachment. */
  24. VULKAN_ATTACHMENT_DESC depth;
  25. /** Width of the images, in pixels. All images must be the same size. */
  26. UINT32 width;
  27. /** Height of the images, in pixels. All images must be the same size. */
  28. UINT32 height;
  29. /** Number of image layers to render to. */
  30. UINT32 layers;
  31. /** Number of samples in the attached images. All attachments must have the same number of samples. */
  32. UINT32 numSamples;
  33. /** Set to true if framebuffer represents an offscreen surface that will not be presented. */
  34. bool offscreen;
  35. };
  36. /** Vulkan frame buffer containing one or multiple color surfaces, and an optional depth surface. */
  37. class VulkanFramebuffer : INonCopyable
  38. {
  39. public:
  40. /** Creates a new frame buffer with the specified image views attached.
  41. *
  42. * @param[in] device Device to create the frame buffer on. All attachment images provided in the @p desc
  43. * parameter must also belong to this device.
  44. * @param[in] desc Description of the frame buffer.
  45. */
  46. VulkanFramebuffer(const SPtr<VulkanDevice>& device, const VULKAN_FRAMEBUFFER_DESC& desc);
  47. ~VulkanFramebuffer();
  48. /** Gets internal Vulkan render pass object. */
  49. VkRenderPass getRenderPass() const { return mRenderPass; }
  50. /** Gets internal Vulkan framebuffer object. */
  51. VkFramebuffer getFramebuffer() const { return mFramebuffer; }
  52. private:
  53. VkRenderPass mRenderPass;
  54. VkFramebuffer mFramebuffer;
  55. VkDevice mDevice;
  56. };
  57. /** @} */
  58. }