Use RenderPass * instead of VkRenderPass in Framebuffer
This commit is contained in:
parent
768ebde879
commit
ffaa038f99
@ -1,13 +1,13 @@
|
|||||||
#ifndef HGL_GRAPH_VULKAN_FRAMEBUFFER_INCLUDE
|
#ifndef HGL_GRAPH_VULKAN_FRAMEBUFFER_INCLUDE
|
||||||
#define HGL_GRAPH_VULKAN_FRAMEBUFFER_INCLUDE
|
#define HGL_GRAPH_VULKAN_FRAMEBUFFER_INCLUDE
|
||||||
|
|
||||||
#include<hgl/graph/VK.h>
|
#include<hgl/graph/VKRenderPass.h>
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
class Framebuffer
|
class Framebuffer
|
||||||
{
|
{
|
||||||
VkDevice device;
|
VkDevice device;
|
||||||
VkFramebuffer frame_buffer;
|
VkFramebuffer frame_buffer;
|
||||||
VkRenderPass render_pass;
|
RenderPass *render_pass;
|
||||||
|
|
||||||
VkExtent2D extent;
|
VkExtent2D extent;
|
||||||
uint32_t attachment_count;
|
uint32_t attachment_count;
|
||||||
@ -18,7 +18,7 @@ private:
|
|||||||
|
|
||||||
friend class RenderTargetManager;
|
friend class RenderTargetManager;
|
||||||
|
|
||||||
Framebuffer(VkDevice,VkFramebuffer,const VkExtent2D &,VkRenderPass,uint32_t color_count,bool depth);
|
Framebuffer(VkDevice,VkFramebuffer,const VkExtent2D &,RenderPass *,uint32_t color_count,bool depth);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public:
|
|||||||
operator VkFramebuffer(){return frame_buffer;}
|
operator VkFramebuffer(){return frame_buffer;}
|
||||||
|
|
||||||
const VkFramebuffer GetFramebuffer ()const{return frame_buffer;}
|
const VkFramebuffer GetFramebuffer ()const{return frame_buffer;}
|
||||||
const VkRenderPass GetRenderPass ()const{return render_pass;}
|
RenderPass * GetRenderPass ()const{return render_pass;}
|
||||||
|
|
||||||
const VkExtent2D & GetExtent ()const{return extent;}
|
const VkExtent2D & GetExtent ()const{return extent;}
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@ public:
|
|||||||
|
|
||||||
DeviceQueue * GetQueue () {return queue;}
|
DeviceQueue * GetQueue () {return queue;}
|
||||||
const VkExtent2D & GetExtent ()const {return extent;}
|
const VkExtent2D & GetExtent ()const {return extent;}
|
||||||
virtual const VkRenderPass GetVkRenderPass ()const {return fbo->GetRenderPass();}
|
virtual RenderPass * GetRenderPass () {return GetFramebuffer()->GetRenderPass();}
|
||||||
virtual uint32_t GetColorCount ()const {return fbo->GetColorCount();}
|
virtual uint32_t GetColorCount () {return GetFramebuffer()->GetColorCount();}
|
||||||
virtual Framebuffer * GetFramebuffer () {return fbo;}
|
|
||||||
|
|
||||||
|
virtual Framebuffer * GetFramebuffer () {return fbo;}
|
||||||
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
|
virtual Texture2D * GetColorTexture (const int index=0){return color_textures[index];}
|
||||||
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
virtual Texture2D * GetDepthTexture (){return depth_texture;}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ public:
|
|||||||
RTSwapchain(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp);
|
RTSwapchain(VkDevice dev,Swapchain *sc,DeviceQueue *q,Semaphore *rcs,Semaphore *pcs,RenderPass *rp);
|
||||||
~RTSwapchain();
|
~RTSwapchain();
|
||||||
|
|
||||||
uint32_t GetColorCount ()const override {return 1;}
|
uint32_t GetColorCount () override {return 1;}
|
||||||
uint32_t GetImageCount ()const {return swapchain->image_count;}
|
uint32_t GetImageCount ()const {return swapchain->image_count;}
|
||||||
uint32_t GetCurrentFrameIndices ()const {return current_frame;}
|
uint32_t GetCurrentFrameIndices ()const {return current_frame;}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ bool RenderCmdBuffer::BindFramebuffer(Framebuffer *fbo)
|
|||||||
render_area.offset.y=0;
|
render_area.offset.y=0;
|
||||||
render_area.extent=fbo->GetExtent();
|
render_area.extent=fbo->GetExtent();
|
||||||
|
|
||||||
rp_begin.renderPass = fbo->GetRenderPass();
|
rp_begin.renderPass = *fbo->GetRenderPass();
|
||||||
rp_begin.framebuffer = *fbo;
|
rp_begin.framebuffer = *fbo;
|
||||||
rp_begin.renderArea = render_area;
|
rp_begin.renderArea = render_area;
|
||||||
rp_begin.clearValueCount = cv_count;
|
rp_begin.clearValueCount = cv_count;
|
||||||
|
@ -75,7 +75,7 @@ Framebuffer *RenderTargetManager::CreateFBO(RenderPass *rp,ImageView **color_lis
|
|||||||
if(!fbo)
|
if(!fbo)
|
||||||
return(nullptr);
|
return(nullptr);
|
||||||
|
|
||||||
return(new Framebuffer(GetVkDevice(),fbo,extent,rp->GetVkRenderPass(),color_count,depth));
|
return(new Framebuffer(GetVkDevice(),fbo,extent,rp,color_count,depth));
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//Framebuffer *RenderTargetManager::CreateFBO(RenderPass *rp,List<ImageView *> &color,ImageView *depth)
|
//Framebuffer *RenderTargetManager::CreateFBO(RenderPass *rp,List<ImageView *> &color,ImageView *depth)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
|
|
||||||
Framebuffer::Framebuffer(VkDevice dev,VkFramebuffer fb,const VkExtent2D &ext,VkRenderPass rp,uint32_t cc,bool depth)
|
Framebuffer::Framebuffer(VkDevice dev,VkFramebuffer fb,const VkExtent2D &ext,RenderPass *rp,uint32_t cc,bool depth)
|
||||||
{
|
{
|
||||||
device=dev;
|
device=dev;
|
||||||
frame_buffer=fb;
|
frame_buffer=fb;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user