2025-01-26 23:22:25 +08:00
|
|
|
|
#pragma once
|
2019-06-19 21:12:39 +08:00
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
|
|
|
|
#include<hgl/graph/VKRenderPass.h>
|
|
|
|
|
#include<hgl/graph/VKFramebuffer.h>
|
|
|
|
|
#include<hgl/graph/VKSwapchain.h>
|
2020-10-21 12:39:22 +08:00
|
|
|
|
#include<hgl/graph/VKQueue.h>
|
2020-10-27 18:11:39 +08:00
|
|
|
|
#include<hgl/graph/VKPipeline.h>
|
2025-01-26 23:22:25 +08:00
|
|
|
|
#include<hgl/graph/VKCommandBuffer.h>
|
2025-03-05 01:01:48 +08:00
|
|
|
|
#include<hgl/graph/VKDescriptorBindingManage.h>
|
2025-01-28 20:03:44 +08:00
|
|
|
|
//#include<iostream>
|
2025-01-25 15:25:29 +08:00
|
|
|
|
|
2025-01-26 23:22:25 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2025-02-01 16:32:08 +08:00
|
|
|
|
|
|
|
|
|
class RenderFramework;
|
|
|
|
|
|
2025-03-06 01:22:35 +08:00
|
|
|
|
using UBOViewportInfo=DeviceBufferMap<graph::ViewportInfo>;
|
|
|
|
|
|
2025-01-25 15:25:29 +08:00
|
|
|
|
class IRenderTarget
|
|
|
|
|
{
|
2025-02-01 16:32:08 +08:00
|
|
|
|
RenderFramework *render_framework;
|
|
|
|
|
|
2025-01-26 23:22:25 +08:00
|
|
|
|
VkExtent2D extent;
|
2025-03-06 01:22:35 +08:00
|
|
|
|
|
|
|
|
|
UBOViewportInfo *ubo_vp_info;
|
2025-03-05 01:01:48 +08:00
|
|
|
|
|
|
|
|
|
DescriptorBinding desc_binding;
|
|
|
|
|
|
2025-01-25 15:25:29 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2025-02-01 16:32:08 +08:00
|
|
|
|
RenderFramework * GetRenderFramework ()const{return render_framework;}
|
2025-06-06 00:24:06 +08:00
|
|
|
|
VulkanDevice * GetDevice ()const;
|
2025-02-05 22:44:58 +08:00
|
|
|
|
VkDevice GetVkDevice ()const;
|
2025-03-05 01:01:48 +08:00
|
|
|
|
DescriptorBinding * GetDescriptorBinding(){return &desc_binding;}
|
2025-02-01 16:32:08 +08:00
|
|
|
|
|
2025-01-26 23:22:25 +08:00
|
|
|
|
const VkExtent2D &GetExtent ()const{return extent;}
|
|
|
|
|
|
|
|
|
|
virtual uint32_t GetColorCount ()=0;
|
|
|
|
|
virtual bool hasDepth ()=0;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2025-02-01 16:32:08 +08:00
|
|
|
|
void OnResize(const VkExtent2D &ext);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
IRenderTarget(RenderFramework *,const VkExtent2D &);
|
|
|
|
|
virtual ~IRenderTarget();
|
2025-01-26 23:22:25 +08:00
|
|
|
|
|
|
|
|
|
virtual Framebuffer * GetFramebuffer ()=0;
|
|
|
|
|
virtual RenderPass * GetRenderPass ()=0;
|
2025-01-25 15:25:29 +08:00
|
|
|
|
|
2025-01-26 23:22:25 +08:00
|
|
|
|
virtual Texture2D * GetColorTexture (const int index=0)=0;
|
|
|
|
|
virtual Texture2D * GetDepthTexture ()=0;
|
|
|
|
|
|
|
|
|
|
public: // Command Buffer
|
|
|
|
|
|
|
|
|
|
virtual DeviceQueue * GetQueue ()=0;
|
|
|
|
|
virtual Semaphore * GetRenderCompleteSemaphore()=0;
|
|
|
|
|
|
|
|
|
|
virtual RenderCmdBuffer * GetRenderCmdBuffer ()=0;
|
|
|
|
|
|
|
|
|
|
virtual bool Submit (Semaphore *wait_sem)=0;
|
|
|
|
|
|
|
|
|
|
virtual bool Submit (){return Submit(nullptr);}
|
|
|
|
|
|
|
|
|
|
virtual bool WaitQueue ()=0;
|
|
|
|
|
virtual bool WaitFence ()=0;
|
2025-01-28 20:03:44 +08:00
|
|
|
|
|
|
|
|
|
virtual RenderCmdBuffer * BeginRender ()=0;
|
|
|
|
|
virtual void EndRender ()=0;
|
2025-03-05 01:01:48 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void Bind (Material *mtl)
|
|
|
|
|
{
|
|
|
|
|
if(mtl)
|
|
|
|
|
desc_binding.Bind(mtl);
|
|
|
|
|
}
|
2025-01-25 15:25:29 +08:00
|
|
|
|
};//class IRenderTarget
|
|
|
|
|
|
2019-06-19 21:12:39 +08:00
|
|
|
|
VK_NAMESPACE_END
|