FCT
载入中...
搜索中...
未找到
Swapcain.h
浏览该文件的文档.
1#ifndef FCT_SWAPCAIN_H
2#define FCT_SWAPCAIN_H
3#include "../Type/type.h"
4#include "Fence.h"
7#include "../RHI/Semaphore.h"
9#include "SwapchainEvent.h"
10namespace FCT
11{
12 namespace RHI
13 {
14 class Swapchain : public RefCount,public IEventSystem<EventSystemConfig::TriggerOnly>
15 {
16 public:
18 {
19 m_nativeHandle = nullptr;
20 m_width = 0;
21 m_height = 0;
23 }
24
29 virtual uint32_t getImageCount() const = 0;
35 virtual Samples getSampleCount() const = 0;
36 virtual ~Swapchain() = default;
43 void nativeHandle(void* handle)
44 {
45 m_nativeHandle = handle;
46 }
47
53 void size(int width,int height)
54 {
57 }
58
64 virtual FCT::Image* image() const = 0;
71 virtual void enableDepthBuffer(Format format) = 0;
72 virtual void create() = 0;
80 virtual void present() = 0;
81 virtual Format getFormat() const = 0;
87 virtual Samples getSamples() const = 0;
88 virtual bool acquireFirstImage() = 0;
95 virtual ImageRenderTarget* target() const = 0;
103 virtual void setPresentFinshSemaphore(RHI::Semaphore* semaphore) = 0;
111 virtual void needRecreate(int width,int height) = 0;
120 {
121 m_renderFinshFences.push_back(fence);
122 }
124 {
125 m_renderFinshFences.clear();
126 }
127
134 m_renderFinshSemaphores.push_back(semaphore);
135 }
139 virtual void sync() = 0;
147 {
149 }
150
156 uint32_t width() const
157 {
158 return m_width;
159 }
160
165 uint32_t height() const
166 {
167 return m_height;
168 }
169 protected:
170 std::vector<RHI::Fence*> m_renderFinshFences;
171 std::vector<RHI::Semaphore*> m_renderFinshSemaphores;
186 uint32_t m_width;
195 uint32_t m_height;
204 uint32_t m_dstWidth = 0;
213 uint32_t m_dstHeight = 0;
215 };
216 }
217}
218#endif //FCT_SWAPCAIN_H
virtual void setPresentFinshSemaphore(RHI::Semaphore *semaphore)=0
virtual ImageRenderTarget * target() const =0
获取交换链对应的target
virtual uint32_t getImageCount() const =0
uint32_t width() const
uint32_t m_width
创建交换链后得到的实际大小
uint32_t m_dstHeight
目标大小
virtual void create()=0
virtual void sync()=0
void nativeHandle(void *handle)
传递 surface
void * m_nativeHandle
交换链对应的surface
void addRenderFinshSemaphore(RHI::Semaphore *semaphore)
渲染完毕以后发出的 信号,是present命令所必须的
virtual RHI::Semaphore * getImageAvailableSemaphore()=0
用于渲染命令同步的,获取到 图像,gpu可以执行渲染命令
virtual void needRecreate(int width, int height)=0
用于窗口通知需要 recreate
uint32_t m_height
创建交换链后得到的实际大小
void size(int width, int height)
virtual void present()=0
提交present命令
void addRenderFinshFence(RHI::Fence *fence)
virtual FCT::Image * image() const =0
bool hasRecreatedInThisFrame() const
在syncGraph里 的判断是否要recreate节点是否进行了重建交换链, 可持续一帧
virtual Samples getSampleCount() const =0
uint32_t height() const
virtual void enableDepthBuffer(Format format)=0
启用深度模板 缓存
std::vector< RHI::Semaphore * > m_renderFinshSemaphores
uint32_t m_dstWidth
目标大小
virtual Format getFormat() const =0
std::vector< RHI::Fence * > m_renderFinshFences
virtual bool acquireFirstImage()=0
virtual ~Swapchain()=default
virtual Samples getSamples() const =0