diff --git a/src/SceneGraph/Vulkan/Texture/BufferImageCopy2D.h b/src/SceneGraph/Vulkan/Texture/BufferImageCopy2D.h index 17ab2d5f..5c02e077 100644 --- a/src/SceneGraph/Vulkan/Texture/BufferImageCopy2D.h +++ b/src/SceneGraph/Vulkan/Texture/BufferImageCopy2D.h @@ -1,5 +1,6 @@ #pragma once #include +#include 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 + BufferImageCopy(const Texture2D *tex,const RectScope2 &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 + void SetRectScope(const RectScope2 &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