2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKDevice.h>
|
2021-09-22 16:28:39 +08:00
|
|
|
|
#include<hgl/graph/VKDeviceAttribute.h>
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKPhysicalDevice.h>
|
2021-09-22 16:28:39 +08:00
|
|
|
|
#include<hgl/graph/VKDeviceRenderPassManage.h>
|
2019-06-19 16:57:42 +08:00
|
|
|
|
|
|
|
|
|
VK_NAMESPACE_BEGIN
|
2021-09-22 16:28:39 +08:00
|
|
|
|
void GPUDevice::InitRenderPassManage()
|
2021-09-16 20:34:12 +08:00
|
|
|
|
{
|
2024-11-09 00:13:21 +08:00
|
|
|
|
render_pass_manage=new RenderPassManager(attr->device,attr->pipeline_cache);
|
2021-09-22 15:32:20 +08:00
|
|
|
|
|
2021-09-23 15:19:09 +08:00
|
|
|
|
SwapchainRenderbufferInfo rbi(attr->surface_format.format,attr->physical_device->GetDepthFormat());
|
2021-09-16 20:34:12 +08:00
|
|
|
|
|
2021-09-22 16:31:35 +08:00
|
|
|
|
device_render_pass=render_pass_manage->AcquireRenderPass(&rbi);
|
2023-10-13 01:48:07 +08:00
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
if(attr->debug_utils)
|
2023-10-13 02:01:57 +08:00
|
|
|
|
attr->debug_utils->SetRenderPass(device_render_pass->GetVkRenderPass(),"MainDeviceRenderPass");
|
2023-10-13 01:48:07 +08:00
|
|
|
|
#endif//_DEBUG
|
2021-09-22 16:31:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GPUDevice::ClearRenderPassManage()
|
|
|
|
|
{
|
|
|
|
|
SAFE_CLEAR(render_pass_manage);
|
2019-06-19 16:57:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-11-22 16:12:01 +08:00
|
|
|
|
RenderPass *GPUDevice::AcquireRenderPass(const RenderbufferInfo *rbi,const uint subpass_count)
|
2019-06-19 16:57:42 +08:00
|
|
|
|
{
|
2020-10-27 22:43:24 +08:00
|
|
|
|
for(const VkFormat &fmt:rbi->GetColorFormatList())
|
2020-10-16 19:25:27 +08:00
|
|
|
|
if(!attr->physical_device->IsColorAttachmentOptimal(fmt))
|
|
|
|
|
return(nullptr);
|
2021-09-22 16:28:39 +08:00
|
|
|
|
|
2020-10-27 22:43:24 +08:00
|
|
|
|
if(rbi->HasDepthOrStencil())
|
2021-09-22 16:28:39 +08:00
|
|
|
|
if(!attr->physical_device->IsDepthAttachmentOptimal(rbi->GetDepthFormat()))
|
2020-10-16 19:44:00 +08:00
|
|
|
|
return(nullptr);
|
2021-09-22 15:32:20 +08:00
|
|
|
|
|
2021-11-22 16:12:01 +08:00
|
|
|
|
return render_pass_manage->AcquireRenderPass(rbi,subpass_count);
|
2019-06-19 16:57:42 +08:00
|
|
|
|
}
|
|
|
|
|
VK_NAMESPACE_END
|