a part of RenderFramework::Init(..)

This commit is contained in:
hyzboy 2024-11-12 01:51:14 +08:00
parent 66b75aceb9
commit 2bb1056b2a
6 changed files with 64 additions and 16 deletions

View File

@ -1,8 +1,11 @@
#include<hgl/graph/RenderFramework.h> #include<hgl/graph/RenderFramework.h>
using namespace hgl; using namespace hgl;
using namespace hgl::graph;
int os_main(int,os_char **) int os_main(int,os_char **)
{ {
RenderFramework rf;
} }

View File

@ -13,7 +13,6 @@ class TileData;
class TileFont; class TileFont;
class FontSource; class FontSource;
class Window;
class VulkanInstance; class VulkanInstance;
class RenderPassManager; class RenderPassManager;
@ -88,7 +87,7 @@ public:
RenderFramework(); RenderFramework();
virtual ~RenderFramework(); virtual ~RenderFramework();
virtual bool Init(); ///<初始化 virtual bool Init(uint w,uint h,const OSString &app_name); ///<初始化
virtual void StartTime(); virtual void StartTime();

View File

@ -114,6 +114,8 @@ public:
fullDrawIndexUint32=SupportLevel::Want; fullDrawIndexUint32=SupportLevel::Want;
blendOperationAdvanced=SupportLevel::Want; blendOperationAdvanced=SupportLevel::Want;
wideLines=SupportLevel::Want;
} }
}; };

View File

@ -9,12 +9,6 @@
#include<hgl/graph/VKPipeline.h> #include<hgl/graph/VKPipeline.h>
VK_NAMESPACE_BEGIN VK_NAMESPACE_BEGIN
1.RT支持多FBO,
2.RT内包含CommandBuffer
/** /**
* *
*/ */

View File

@ -1,5 +1,4 @@
#ifndef HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE #pragma once
#define HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE
#include<hgl/graph/VK.h> #include<hgl/graph/VK.h>
#include<hgl/graph/VKTexture.h> #include<hgl/graph/VKTexture.h>
@ -31,4 +30,3 @@ public:
virtual ~Swapchain(); virtual ~Swapchain();
};//struct Swapchain };//struct Swapchain
VK_NAMESPACE_END VK_NAMESPACE_END
#endif//HGL_GRAPH_VULKAN_SWAP_CHAIN_INCLUDE

View File

@ -1,7 +1,9 @@
#include<hgl/graph/RenderFramework.h> #include<hgl/graph/RenderFramework.h>
#include<hgl/graph/manager/RenderPassManager.h> #include<hgl/graph/manager/RenderPassManager.h>
#include<hgl/graph/module/SwapchainModule.h> #include<hgl/graph/module/SwapchainModule.h>
#include<hgl/graph/VKDeviceCreater.h>
#include<hgl/Time.h> #include<hgl/Time.h>
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN VK_NAMESPACE_BEGIN
@ -11,12 +13,25 @@ void CloseShaderCompiler();
GraphModuleManager *InitGraphModuleManager(GPUDevice *dev); GraphModuleManager *InitGraphModuleManager(GPUDevice *dev);
bool ClearGraphModuleManager(GPUDevice *dev); bool ClearGraphModuleManager(GPUDevice *dev);
namespace
{
hgl::graph::VulkanInstance *CreateVulkanInstance(const AnsiString &app_name)
{
CreateInstanceLayerInfo cili;
hgl_zero(cili);
cili.lunarg.standard_validation = true;
cili.khronos.validation = true;
InitVulkanInstanceProperties();
return CreateInstance("VulkanTest",nullptr,&cili);
}
}//namespace
RenderFramework::RenderFramework() RenderFramework::RenderFramework()
{ {
graph_module_manager=InitGraphModuleManager(device);
render_pass_manager=graph_module_manager->GetModule<RenderPassManager>(true);
swapchain_module=graph_module_manager->GetModule<SwapchainModule>(true);
} }
RenderFramework::~RenderFramework() RenderFramework::~RenderFramework()
@ -77,11 +92,48 @@ void RenderFramework::MainLoop()
EndFrame(); EndFrame();
} }
bool RenderFramework::Init() bool RenderFramework::Init(uint w,uint h,const OSString &app_name)
{ {
logger::InitLogger(app_name);
if(!InitShaderCompiler()) if(!InitShaderCompiler())
return(false); return(false);
InitNativeWindowSystem();
win=CreateRenderWindow(app_name);
if(!win)
return(false);
if(!win->Create(w,h))
{
delete win;
win=nullptr;
return(false);
}
inst=CreateVulkanInstance(ToAnsiString(app_name));
if(!inst)
return(false);
{
VulkanHardwareRequirement vh_req;
device=CreateRenderDevice(inst,win,&vh_req);
if(!device)
return(false);
graph_module_manager=InitGraphModuleManager(device);
render_pass_manager=graph_module_manager->GetModule<RenderPassManager>(true);
swapchain_module=graph_module_manager->GetModule<SwapchainModule>(true);
}
win->Join(this);
return(true); return(true);
} }