Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
VulkanFramebuffer.hpp
1#pragma once
2
3#include <string>
4#include <vector>
5#include <stdint.h>
6
7#include <Common/Graphics/Framebuffer.hpp>
8#include <Common/Graphics/Formats.hpp>
9#include <vulkan/vulkan.h>
10
11namespace Grindstone::GraphicsAPI::Vulkan {
12 class RenderPass;
13
14 class Framebuffer : public Grindstone::GraphicsAPI::Framebuffer {
15 public:
16 Framebuffer(
17 RenderPass* renderPass,
18 VkFramebuffer framebuffer,
19 uint32_t width,
20 uint32_t height,
21 const char* debugName
22 );
23 Framebuffer(const CreateInfo& createInfo);
24 virtual ~Framebuffer() override;
25 void UpdateNativeFramebuffer(
26 RenderPass* renderPass,
27 VkFramebuffer framebuffer,
28 uint32_t width,
29 uint32_t height
30 );
31 public:
32 VkFramebuffer GetFramebuffer() const;
33 public:
34 virtual Grindstone::GraphicsAPI::RenderPass* GetRenderPass() const override;
35 virtual void Resize(uint32_t width, uint32_t height) override;
36 virtual void Clear(ClearMode mask) override;
37 virtual void BindTextures(int i) override;
38 virtual void Bind() override;
39 virtual void BindWrite() override;
40 virtual void BindRead() override;
41 virtual void Unbind() override;
42 virtual uint32_t GetWidth() const override;
43 virtual uint32_t GetHeight() const override;
44 virtual uint32_t GetRenderTargetCount() const override;
45 virtual Grindstone::GraphicsAPI::Image* GetRenderTarget(uint32_t index) const override;
46 virtual Grindstone::GraphicsAPI::Image* GetDepthStencilTarget() const override;
47 private:
48 void Create();
49 void Cleanup();
50
51 std::string debugName;
52 std::vector<Image*> colorAttachments;
53 Image* depthAttachment = nullptr;
54
55 VkFramebuffer framebuffer = nullptr;
56 GraphicsAPI::RenderPass* renderPass = nullptr;
57 bool isCubemap = false;
58
59 uint32_t width = 0;
60 uint32_t height = 0;
61 };
62}
Definition Framebuffer.hpp:16
Definition Image.hpp:48
Definition RenderPass.hpp:27
Definition VulkanImage.hpp:7
Definition VulkanRenderPass.hpp:10