增加RenderTarget设计(仅定义)
This commit is contained in:
parent
101dc3b820
commit
819e806cbf
0
example/Vulkan/RenderToColor.cpp
Normal file
0
example/Vulkan/RenderToColor.cpp
Normal file
49
inc/hgl/graph/vulkan/VKRenderTarget.h
Normal file
49
inc/hgl/graph/vulkan/VKRenderTarget.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef HGL_GRAPH_VULKAN_RENDER_TARGET_INCLUDE
|
||||||
|
#define HGL_GRAPH_VULKAN_RENDER_TARGET_INCLUDE
|
||||||
|
|
||||||
|
#include<hgl/graph/vulkan/VK.h>
|
||||||
|
#include<hgl/graph/vulkan/VKRenderPass.h>
|
||||||
|
#include<hgl/graph/vulkan/VKFramebuffer.h>
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
class RenderTarget
|
||||||
|
{
|
||||||
|
Device *device;
|
||||||
|
|
||||||
|
RenderPass *rp;
|
||||||
|
Framebuffer *fb;
|
||||||
|
|
||||||
|
VkExtent2D extent;
|
||||||
|
|
||||||
|
List<ImageView *> colors;
|
||||||
|
ImageView *depth;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class Device;
|
||||||
|
|
||||||
|
RenderTarget(Device *dev,RenderPass *_rp,Framebuffer *_fb)
|
||||||
|
{
|
||||||
|
device=dev;
|
||||||
|
rp=_rp;
|
||||||
|
fb=_fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~RenderTarget()
|
||||||
|
{
|
||||||
|
if(fb)delete fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
operator RenderPass * (){return rp;}
|
||||||
|
operator Framebuffer * (){return fb;}
|
||||||
|
operator VkRenderPass (){return rp?rp->operator VkRenderPass():nullptr;}
|
||||||
|
operator VkFramebuffer (){return fb?fb->operator VkFramebuffer():nullptr;}
|
||||||
|
|
||||||
|
const VkExtent2D & GetExtent ()const{return extent;} ///<取得画面尺寸
|
||||||
|
|
||||||
|
const uint GetColorCount ()const{colors.GetCount();} ///<取得颜色成份数量
|
||||||
|
const bool IsExistDepth ()const{return depth;} ///<是否存在深度成份
|
||||||
|
};//class RenderTarget
|
||||||
|
VK_NAMESPACE_END
|
||||||
|
#endif//HGL_GRAPH_VULKAN_RENDER_TARGET_INCLUDE
|
@ -27,7 +27,7 @@ RenderPass *Device::CreateRenderPass(List<VkFormat> color_format,VkFormat depth_
|
|||||||
attachments[i].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
attachments[i].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkFormat *cf=color_format.GetData();
|
const VkFormat *cf=color_format.GetData();
|
||||||
for(int i=0;i<color_format.GetCount();i++)
|
for(int i=0;i<color_format.GetCount();i++)
|
||||||
{
|
{
|
||||||
attachments[i].finalLayout = color_final_layout;
|
attachments[i].finalLayout = color_final_layout;
|
||||||
|
9
src/RenderDevice/Vulkan/VKRenderTarget.cpp
Normal file
9
src/RenderDevice/Vulkan/VKRenderTarget.cpp
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include<hgl/graph/vulkan/VKRenderTarget.h>
|
||||||
|
|
||||||
|
VK_NAMESPACE_BEGIN
|
||||||
|
RenderTarget::~RenderTarget()
|
||||||
|
{
|
||||||
|
if(fb)
|
||||||
|
delete fb;
|
||||||
|
}
|
||||||
|
VK_NAMESPACE_END
|
Loading…
x
Reference in New Issue
Block a user