forked from Shell4026/ShellEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVulkanFramebuffer.h
More file actions
59 lines (45 loc) · 1.78 KB
/
Copy pathVulkanFramebuffer.h
File metadata and controls
59 lines (45 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "Export.h"
#include "VulkanConfig.h"
#include "VulkanImageBuffer.h"
#include "Render/Framebuffer.h"
#include "Core/NonCopyable.h"
#include <vector>
#include <memory>
namespace sh::render::vk
{
class VulkanFramebuffer : public Framebuffer
{
private:
VkDevice device;
VkPhysicalDevice gpu;
VmaAllocator alloc;
VkFramebuffer framebuffer;
VkImageView img;
VkRenderPass renderPass;
std::unique_ptr<VulkanImageBuffer> colorImg; //Only Offscreen
std::unique_ptr<VulkanImageBuffer> depthImg;
uint32_t width, height;
VkFormat format;
bool bTransferSrc = false;
private:
void CreateRenderPass();
auto FindSupportedDepthFormat() -> VkFormat;
void CreateDepthBuffer();
public:
SH_RENDER_API VulkanFramebuffer(VkDevice device, VkPhysicalDevice gpu, VmaAllocator alloc);
SH_RENDER_API VulkanFramebuffer(VulkanFramebuffer&& other) noexcept;
SH_RENDER_API ~VulkanFramebuffer();
SH_RENDER_API auto operator=(VulkanFramebuffer&& other) noexcept -> VulkanFramebuffer&;
SH_RENDER_API auto Create(uint32_t width, uint32_t height, VkImageView img, VkFormat format) -> VkResult;
SH_RENDER_API auto CreateOffScreen(uint32_t width, uint32_t height, VkFormat format = VkFormat::VK_FORMAT_R8G8B8A8_SRGB, bool bTransferSrc = false) -> VkResult;
SH_RENDER_API void Clean();
SH_RENDER_API void TransferImageToBuffer(VulkanCommandBuffer* cmd, VkQueue queue, VkBuffer buffer, int x, int y);
SH_RENDER_API auto GetRenderPass() const -> VkRenderPass;
SH_RENDER_API auto GetVkFramebuffer() const -> VkFramebuffer;
SH_RENDER_API auto GetColorImg() const -> VulkanImageBuffer*;
SH_RENDER_API auto GetDepthImg() const -> VulkanImageBuffer*;
SH_RENDER_API auto GetWidth() const -> uint32_t override;
SH_RENDER_API auto GetHeight() const->uint32_t override;
};
}