moved Swapchain's codes to SwapchainModule

This commit is contained in:
2024-11-06 00:34:23 +08:00
parent 173d3e075a
commit c3a5518b38
6 changed files with 27 additions and 19 deletions

View File

@@ -51,10 +51,6 @@ private:
VkCommandBuffer CreateCommandBuffer(const AnsiString &);
bool CreateSwapchainFBO(Swapchain *);
Swapchain *CreateSwapchain(const VkExtent2D &acquire_extent);
private:
friend class VulkanDeviceCreater;

View File

@@ -11,6 +11,8 @@ public:
VkDevice device =VK_NULL_HANDLE;
VkExtent2D extent;
VkSwapchainKHR swap_chain =VK_NULL_HANDLE;
uint32_t color_count =0;

View File

@@ -1,6 +1,7 @@
#pragma once
#include<hgl/graph/VK.h>
#include<hgl/graph/VKDevice.h>
#include<hgl/type/IDName.h>
VK_NAMESPACE_BEGIN
@@ -19,7 +20,10 @@ public:
GraphModuleManager(GPUDevice *dev){device=dev;}
~GraphModuleManager();
GPUDevice *GetDevice()noexcept{return device;} ///<取得GPU设备
GPUDevice * GetDevice ()noexcept{return device;} ///<取得GPU设备
VkDevice GetVkDevice (){return device->GetDevice();}
const GPUPhysicalDevice * GetPhysicalDevice (){return device->GetPhysicalDevice();} ///<取得物理设备
const GPUDeviceAttribute *GetDeviceAttribute (){return device->GetDeviceAttribute();} ///<取得设备属性
/**
* 获取指定名称的模块
@@ -66,9 +70,11 @@ public:
virtual const bool IsRender(){return false;} ///<是否为渲染模块
GraphModuleManager *GetManager(){return module_manager;} ///<取得模块管理器
GPUDevice * GetDevice(){return module_manager->GetDevice();} ///<取得GPU设备
GPUDeviceAttribute *GetDeviceAttribute();
GraphModuleManager *GetManager (){return module_manager;} ///<取得模块管理器
GPUDevice * GetDevice (){return module_manager->GetDevice();} ///<取得GPU设备
VkDevice GetVkDevice (){return module_manager->GetVkDevice();} ///<取得VkDevice
const GPUPhysicalDevice * GetPhysicalDevice (){return module_manager->GetPhysicalDevice();} ///<取得物理设备
const GPUDeviceAttribute *GetDeviceAttribute (){return module_manager->GetDeviceAttribute();}///<取得设备属性
static const AnsiIDName *GetModuleName(){return nullptr;} ///<取得模块名称(标准通用的名称比如Upscale供通用模块使用)
virtual const AnsiIDName *GetName()const{return &module_name;} ///<取得名称(完整的私有名称比如FSR3Upscale,DLSS3Upscale)

View File

@@ -10,6 +10,12 @@ class SwapchainModule:public GraphModule
RTSwapchain *swapchain_rt=nullptr;
private:
bool CreateSwapchainFBO(Swapchain *);
Swapchain *CreateSwapchain(const VkExtent2D &acquire_extent);
public:
GRAPH_MODULE_CONSTRUCT(Swapchain)