-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrameBufferFactory.h
More file actions
68 lines (47 loc) · 1.17 KB
/
FrameBufferFactory.h
File metadata and controls
68 lines (47 loc) · 1.17 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
60
61
62
63
64
65
66
67
68
#pragma once
#include"FrameBufferBuilder.h"
struct FrameBuffer;
class FrameBufferFactory : public std::enable_shared_from_this<FrameBufferFactory>
{
private:
uint32_t frameIndex;
VkDevice device;
std::shared_ptr<FrameBufferBuilder> builder;
std::array<std::list<VkFramebuffer>, 2> destructList;
public:
FrameBufferFactory(VkDevice d, std::shared_ptr<FrameBufferBuilder> b);
~FrameBufferFactory()
{
for (int i = 0; i < 2; i++)
{
resourceDestruct();
}
#ifdef _DEBUG
std::cout << "FrameBufferFactory :: デストラクタ" << std::endl;
#endif
}
//フレームバッファビルダーを取得
std::shared_ptr<FrameBufferBuilder> getBuilder()
{
return builder;
}
std::shared_ptr<FrameBuffer> Create(const FrameBufferProperty& property);
void addDefferedDestruct(VkFramebuffer& frameBuffer);
void resourceDestruct();
};
struct FrameBuffer
{
VkFramebuffer frameBuffer;
std::shared_ptr<RenderPass> renderPass;
std::vector<std::shared_ptr<Texture>> texture;
std::shared_ptr<FrameBufferFactory> factory;
FrameBuffer(std::shared_ptr<FrameBufferFactory> f)
{
frameBuffer = nullptr;
factory = f;
}
~FrameBuffer()
{
factory->addDefferedDestruct(frameBuffer);
}
};