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
|
|
|
|
{
|
2021-09-22 16:28:39 +08:00
|
|
|
|
render_pass_manage=new DeviceRenderPassManage(attr->device);
|
2021-09-22 15:32:20 +08:00
|
|
|
|
|
|
|
|
|
{
|
2021-09-22 16:28:39 +08:00
|
|
|
|
SwapchainRenderbufferInfo rbi(attr->format,attr->physical_device->GetDepthFormat());
|
2021-09-16 20:34:12 +08:00
|
|
|
|
|
2021-09-22 16:28:39 +08:00
|
|
|
|
device_render_pass=render_pass_manage->AcquireRenderPass(&rbi);
|
2021-09-22 15:32:20 +08:00
|
|
|
|
}
|
2019-06-19 16:57:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 16:28:39 +08:00
|
|
|
|
RenderPass *GPUDevice::AcquireRenderPass(const RenderbufferInfo *rbi)
|
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-09-22 16:28:39 +08:00
|
|
|
|
return render_pass_manage->AcquireRenderPass(rbi);
|
2019-06-19 16:57:42 +08:00
|
|
|
|
}
|
|
|
|
|
VK_NAMESPACE_END
|