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>
using namespace hgl;
using namespace hgl::graph;
int os_main(int,os_char **)
{
RenderFramework rf;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
#include<hgl/graph/RenderFramework.h>
#include<hgl/graph/manager/RenderPassManager.h>
#include<hgl/graph/module/SwapchainModule.h>
#include<hgl/graph/VKDeviceCreater.h>
#include<hgl/Time.h>
#include<hgl/log/LogInfo.h>
VK_NAMESPACE_BEGIN
@ -11,12 +13,25 @@ void CloseShaderCompiler();
GraphModuleManager *InitGraphModuleManager(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()
{
graph_module_manager=InitGraphModuleManager(device);
render_pass_manager=graph_module_manager->GetModule<RenderPassManager>(true);
swapchain_module=graph_module_manager->GetModule<SwapchainModule>(true);
}
RenderFramework::~RenderFramework()
@ -77,11 +92,48 @@ void RenderFramework::MainLoop()
EndFrame();
}
bool RenderFramework::Init()
bool RenderFramework::Init(uint w,uint h,const OSString &app_name)
{
logger::InitLogger(app_name);
if(!InitShaderCompiler())
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);
}