use image_count instead of color_count in Swapchain

This commit is contained in:
2024-11-11 01:18:28 +08:00
parent adc3c5bd81
commit 9f37373631
18 changed files with 106 additions and 89 deletions

View File

@@ -4,6 +4,7 @@
#include<hgl/type/List.h>
#include<hgl/graph/ViewportInfo.h>
#include<hgl/graph/module/GraphModule.h>
#include<hgl/io/event/WindowEvent.h>
VK_NAMESPACE_BEGIN
@@ -12,35 +13,6 @@ class TileData;
class TileFont;
class FontSource;
//
///**
// * 渲染模块工作配置
// */
//class GraphModuleWorkConfig
//{
// /**
// * 渲染模块名称
// * 在render_module为nullptr时用于创建或加载RenderModule。
// * 它和RenderModule返回的名称有可能一样但也有可能不一样。
// */
// AnsiString render_module_name;
// GraphModule *render_module=nullptr;
//
// BlendMode blend_mode;
// RenderOrder render_order;
//
//public:
//
// const AnsiString &GetModuleName()const{return render_module_name;} ///<取得渲染模块名称
//
// GraphModule *GetModule(){return render_module;} ///<取得渲染模块
//
//public:
//
// GraphModuleWorkConfig();
// virtual ~GraphModuleWorkConfig()=default;
//};//class GraphModuleWorkConfig
class Window;
class VulkanInstance;
@@ -49,15 +21,10 @@ class TextureManager;
class SwapchainModule;
struct RenderFrameworkInitConfig
{
};//struct RenderFrameworkInitConfig
/**
* 渲染框架
*/
class RenderFramework
class RenderFramework:public io::WindowEvent
{
protected:
@@ -72,6 +39,8 @@ protected:
ObjectList<GraphModule> module_list;
protected:
SwapchainModule * swapchain_module =nullptr;
protected:
@@ -103,8 +72,14 @@ public: //module
public: //manager
RenderPassManager *GetRenderPassManager(){return render_pass_manager;} ///<取得渲染通道管理器
TextureManager *GetTextureManager(){return texture_manager;} ///<取得纹理管理器
RenderPassManager * GetRenderPassManager(){return render_pass_manager;} ///<取得渲染通道管理器
TextureManager * GetTextureManager (){return texture_manager;} ///<取得纹理管理器
public: //event
virtual void OnResize(uint,uint)override;
virtual void OnActive(bool)override;
virtual void OnClose ()override;
public:

View File

@@ -11,14 +11,14 @@ class Framebuffer
VkExtent2D extent;
uint32_t attachment_count;
uint32_t color_count;
uint32_t image_count;
bool has_depth;
private:
friend class TextureManager;
Framebuffer(VkDevice,VkFramebuffer,const VkExtent2D &,VkRenderPass,uint32_t color_count,bool depth);
Framebuffer(VkDevice,VkFramebuffer,const VkExtent2D &,VkRenderPass,uint32_t image_count,bool depth);
public:
@@ -32,7 +32,7 @@ public:
const VkExtent2D & GetExtent ()const{return extent;}
const uint32_t GetAttachmentCount ()const{return attachment_count;} ///<获取渲染目标成分数量
const uint32_t GetColorCount ()const{return color_count;} ///<取得颜色成分数量
const uint32_t GetColorCount ()const{return image_count;} ///<取得颜色成分数量
const bool HasDepth ()const{return has_depth;} ///<是否包含深度成分
};//class Framebuffer

View File

@@ -82,7 +82,7 @@ public:
Framebuffer * GetFramebuffer (const uint32_t index) {return swapchain->sc_fbo[index];}
const uint32_t GetColorCount ()const override {return 1;}
const uint32_t GetImageCount ()const {return swapchain->color_count;}
const uint32_t GetImageCount ()const {return swapchain->image_count;}
virtual Texture2D * GetColorTexture (const int index=0) override{return swapchain->sc_color[index];}
virtual Texture2D * GetDepthTexture () override{return swapchain->sc_depth;}

View File

@@ -19,7 +19,7 @@ public:
VkSurfaceFormatKHR surface_format;
VkFormat depth_format;
uint32_t color_count =0;
uint32_t image_count =0;
Texture2D ** sc_color =nullptr;
Texture2D * sc_depth =nullptr;

View File

@@ -125,7 +125,7 @@ public: // Load
public: //FrameBuffer相关
Framebuffer *CreateFBO(RenderPass *rp,ImageView **color_list,const uint color_count,ImageView *depth);
Framebuffer *CreateFBO(RenderPass *rp,ImageView **color_list,const uint image_count,ImageView *depth);
// Framebuffer *CreateFBO(RenderPass *,List<ImageView *> &color,ImageView *depth);
Framebuffer *CreateFBO(RenderPass *,ImageView *color,ImageView *depth);
Framebuffer *CreateFBO(RenderPass *,ImageView *);

View File

@@ -101,7 +101,6 @@ public:
template<typename T>
T * GetModule(bool create=false){return module_manager->GetModule<T>(create);} ///<获取指定类型的模块
public: //回调事件

View File

@@ -21,6 +21,8 @@ protected:
public:
virtual void OnResize(const VkExtent2D &)override; ///<窗口大小改变
virtual void OnExecute(const double,RenderCmdBuffer *);
public:
@@ -28,12 +30,16 @@ public:
virtual ~SwapchainModule();
bool Init() override;
void Swap();
public:
RenderPass * GetRenderPass () {return swapchain_rp;}
RTSwapchain * GetRenderTarget () {return swapchain_rt;}
const VkExtent2D & GetSwapchainSize()const {return swapchain_rt->GetExtent();}
};//class SwapchainModule:public GraphModule
VK_NAMESPACE_END