diff --git a/CMCore b/CMCore index 97422170..72fcbb18 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 97422170df154a9e3067c6e129b01d196e7fa265 +Subproject commit 72fcbb18ab3bbd8971777f62ee9fcb967ab25e9e diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index 05b6cbe0..d3aa9e5d 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -175,32 +175,9 @@ public: //Texture void Clear(TextureCreateInfo *); - bool ChangeTexture2D(Texture2D *,DeviceBuffer *buf, const List &, VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); - bool ChangeTexture2D(Texture2D *,DeviceBuffer *buf, uint32_t left,uint32_t top,uint32_t width,uint32_t height, VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); - bool ChangeTexture2D(Texture2D *,void *data, uint32_t left,uint32_t top,uint32_t width,uint32_t height,uint32_t size,VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); - - template - bool ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const RectScope2 &rs) - { - return ChangeTexture2D( tex, - buf, - rs.GetLeft(), - rs.GetTop(), - rs.GetWidth(), - rs.GetHeight()); - } - - template - bool ChangeTexture2D(Texture2D *tex,void *data,const RectScope2 &rs,uint32_t size) - { - return ChangeTexture2D( tex, - data, - rs.GetLeft(), - rs.GetTop(), - rs.GetWidth(), - rs.GetHeight(), - size); - } + bool ChangeTexture2D(Texture2D *,DeviceBuffer *buf, const List &,VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + bool ChangeTexture2D(Texture2D *,DeviceBuffer *buf, const RectScope2ui &, VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + bool ChangeTexture2D(Texture2D *,void *data,const uint32_t size,const RectScope2ui &, VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); public: // diff --git a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp index cbf3630c..915f48de 100644 --- a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp +++ b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp @@ -183,15 +183,16 @@ bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const Listtex->GetWidth() - ||top<0||top+height>tex->GetHeight() - ||width<=0||height<=0) + ||scope.GetWidth()<=0 + ||scope.GetHeight()<=0 + ||scope.GetRight()>tex->GetWidth() + ||scope.GetBottom()>tex->GetHeight()) return(false); - BufferImageCopy buffer_image_copy(tex); + BufferImageCopy buffer_image_copy(tex,scope); texture_cmd_buf->Begin(); bool result=CommitTexture(tex,buf,&buffer_image_copy,1,1,destinationStage); @@ -200,18 +201,19 @@ bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,uint32_t left,u return result; } -bool GPUDevice::ChangeTexture2D(Texture2D *tex,void *data,uint32_t left,uint32_t top,uint32_t width,uint32_t height,uint32_t size,VkPipelineStageFlags destinationStage) +bool GPUDevice::ChangeTexture2D(Texture2D *tex,void *data,const uint32_t size,const RectScope2ui &scope,VkPipelineStageFlags destinationStage) { if(!tex||!data - ||left<0||left+width>tex->GetWidth() - ||top<0||top+height>tex->GetHeight() - ||width<=0||height<=0 - ||size<=0) + ||size<=0 + ||scope.GetWidth()<=0 + ||scope.GetHeight()<=0 + ||scope.GetRight()>tex->GetWidth() + ||scope.GetBottom()>tex->GetHeight()) return(false); DeviceBuffer *buf=CreateBuffer(VK_BUFFER_USAGE_TRANSFER_SRC_BIT,size,data); - bool result=ChangeTexture2D(tex,buf,left,top,width,height,destinationStage); + bool result=ChangeTexture2D(tex,buf,scope,destinationStage); delete buf; return(result);