53 lines
2.0 KiB
C++
53 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "XCEngine/RHI/RHIFramebuffer.h"
|
|
#include "XCEngine/RHI/Vulkan/VulkanCommon.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace XCEngine {
|
|
namespace RHI {
|
|
|
|
class VulkanRenderPass;
|
|
class VulkanResourceView;
|
|
class VulkanTexture;
|
|
|
|
class VulkanFramebuffer : public RHIFramebuffer {
|
|
public:
|
|
VulkanFramebuffer() = default;
|
|
~VulkanFramebuffer() override;
|
|
|
|
bool Initialize(VkDevice device, RHIRenderPass* renderPass, uint32_t width, uint32_t height,
|
|
uint32_t colorAttachmentCount, RHIResourceView** colorAttachments,
|
|
RHIResourceView* depthStencilAttachment);
|
|
bool Initialize(RHIRenderPass* renderPass, uint32_t width, uint32_t height,
|
|
uint32_t colorAttachmentCount, RHIResourceView** colorAttachments,
|
|
RHIResourceView* depthStencilAttachment) override;
|
|
void Shutdown() override;
|
|
|
|
void* GetNativeHandle() override { return m_framebuffer; }
|
|
uint32_t GetWidth() const override { return m_width; }
|
|
uint32_t GetHeight() const override { return m_height; }
|
|
bool IsValid() const override { return m_framebuffer != VK_NULL_HANDLE; }
|
|
|
|
VkFramebuffer GetFramebuffer() const { return m_framebuffer; }
|
|
VulkanRenderPass* GetRenderPass() const { return m_renderPass; }
|
|
uint32_t GetColorAttachmentCount() const { return static_cast<uint32_t>(m_colorAttachmentViews.size()); }
|
|
VulkanResourceView* GetColorAttachmentView(uint32_t index) const;
|
|
VulkanResourceView* GetDepthStencilView() const { return m_depthStencilView; }
|
|
VulkanTexture* GetColorAttachmentTexture(uint32_t index) const;
|
|
VulkanTexture* GetDepthStencilTexture() const;
|
|
|
|
private:
|
|
VkDevice m_device = VK_NULL_HANDLE;
|
|
VkFramebuffer m_framebuffer = VK_NULL_HANDLE;
|
|
VulkanRenderPass* m_renderPass = nullptr;
|
|
uint32_t m_width = 0;
|
|
uint32_t m_height = 0;
|
|
std::vector<VulkanResourceView*> m_colorAttachmentViews;
|
|
VulkanResourceView* m_depthStencilView = nullptr;
|
|
};
|
|
|
|
} // namespace RHI
|
|
} // namespace XCEngine
|