BufferImageCopy supported RectScope2<>

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-06-07 20:23:13 +08:00
parent de2926a6d5
commit 18850b0e27

View File

@ -1,5 +1,6 @@
#pragma once
#include<hgl/graph/VKTexture.h>
#include<hgl/type/RectScope.h>
VK_NAMESPACE_BEGIN
struct BufferImageCopy:public VkBufferImageCopy
{
@ -19,14 +20,21 @@ public:
BufferImageCopy(const Texture2D *tex):BufferImageCopy()
{
imageSubresource.aspectMask=tex->GetAspect();
SetRectScope(0,0,tex->GetWidth(),tex->GetHeight());
SetRectScope(tex->GetWidth(),tex->GetHeight());
}
template<typename T>
BufferImageCopy(const Texture2D *tex,const RectScope2<T> &rs):BufferImageCopy()
{
imageSubresource.aspectMask=tex->GetAspect();
SetRectScope(rs);
}
BufferImageCopy(const TextureCube *tex):BufferImageCopy()
{
imageSubresource.aspectMask=tex->GetAspect();
imageSubresource.layerCount=6;
SetRectScope(0,0,tex->GetWidth(),tex->GetHeight());
SetRectScope(tex->GetWidth(),tex->GetHeight());
}
void Set(const VkImageAspectFlags aspect_mask,const uint32_t layer_count)
@ -37,20 +45,33 @@ public:
void Set(Image2DRegion *ir)
{
imageOffset.x=ir->left;
imageOffset.y=ir->top;
imageExtent.width=ir->width;
imageExtent.height=ir->height;
imageExtent.depth=1;
imageOffset.x =ir->left;
imageOffset.y =ir->top;
imageOffset.z =0;
imageExtent.width =ir->width;
imageExtent.height =ir->height;
imageExtent.depth =1;
}
void SetRectScope(int32_t left,int32_t top,uint32_t width,uint32_t height)
void SetRectScope(uint32_t width,uint32_t height)
{
imageOffset.x=left;
imageOffset.y=top;
imageExtent.width=width;
imageExtent.height=height;
imageExtent.depth=1;
imageOffset.x =0;
imageOffset.y =0;
imageOffset.z =0;
imageExtent.width =width;
imageExtent.height =height;
imageExtent.depth =1;
}
template<typename T>
void SetRectScope(const RectScope2<T> &rs)
{
imageOffset.x =rs.Left;
imageOffset.y =rs.Top;
imageOffset.z =0;
imageExtent.width =rs.Width;
imageExtent.height =rs.Height;
imageExtent.depth =1;
}
};//
VK_NAMESPACE_END