diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index ef786b8c..0a4f63c8 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -155,7 +155,13 @@ private: //texture bool CopyBufferToImage (const CopyBufferToImageInfo *info,VkPipelineStageFlags destinationStage); - bool CopyBufferToImage (Texture *,DeviceBuffer *buf,const VkBufferImageCopy *,const int count,const uint32_t layer_count,VkPipelineStageFlags);//=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + bool CopyBufferToImage (Texture *,DeviceBuffer *buf,const VkBufferImageCopy *,const int count,const uint32_t layer_count,VkPipelineStageFlags);//=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + + bool CopyBufferToImage (Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *bic_list,const int bic_count, VkPipelineStageFlags dstStage){return CopyBufferToImage(tex,buf,bic_list, bic_count, 1,dstStage);} + bool CopyBufferToImage (Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *bic, VkPipelineStageFlags dstStage){return CopyBufferToImage(tex,buf,bic, 1, 1,dstStage);} + + bool CopyBufferToImageCube (Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *bic_list,const int bic_count, VkPipelineStageFlags dstStage){return CopyBufferToImage(tex,buf,bic_list, bic_count, 6,dstStage);} + bool CopyBufferToImageCube (Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *bic, VkPipelineStageFlags dstStage){return CopyBufferToImage(tex,buf,bic, 1, 6,dstStage);} bool CommitTexture2D (Texture2D *,DeviceBuffer *buf,VkPipelineStageFlags stage); bool CommitTexture2DMipmaps (Texture2D *,DeviceBuffer *buf,const VkExtent3D &,uint32_t); diff --git a/src/SceneGraph/Vulkan/Texture/CopyBufferToImage.h b/src/SceneGraph/Vulkan/Texture/CopyBufferToImage.h index 7fba8cbc..6c369d11 100644 --- a/src/SceneGraph/Vulkan/Texture/CopyBufferToImage.h +++ b/src/SceneGraph/Vulkan/Texture/CopyBufferToImage.h @@ -11,50 +11,5 @@ struct CopyBufferToImageInfo const VkBufferImageCopy * bic_list; uint32_t bic_count; - -public: - - CopyBufferToImageInfo() - { - hgl_zero(*this); - } - - CopyBufferToImageInfo(Texture *tex,VkBuffer buf,const VkBufferImageCopy *bic) - { - image =tex->GetImage(); - buffer =buf; - - isr.aspectMask =tex->GetAspect(); - - isr.baseMipLevel =0; - isr.levelCount =tex->GetMipLevel(); - - isr.baseArrayLayer =0; - isr.layerCount =1; - - bic_list =bic; - bic_count =1; - } }; - -struct CopyBufferToImageMipmapsInfo:public CopyBufferToImageInfo -{ - CopyBufferToImageMipmapsInfo(Texture2D *tex,VkBuffer buf,const VkBufferImageCopy *bic,const uint32_t miplevel) - { - image =tex->GetImage(); - buffer =buf; - - isr.aspectMask =tex->GetAspect(); - - isr.baseMipLevel =0; - isr.levelCount =tex->GetMipLevel(); - - isr.baseArrayLayer =0; - isr.layerCount =1; - - bic_list =bic; - bic_count =miplevel; - } -}; - VK_NAMESPACE_END diff --git a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp index 219ee91c..6e8929cb 100644 --- a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp +++ b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp @@ -95,9 +95,9 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,DeviceBuffer *buf,VkPipelineStage BufferImageCopy buffer_image_copy(tex); - CopyBufferToImageInfo info(tex,buf->GetBuffer(),&buffer_image_copy); + //CopyBufferToImageInfo info(tex,buf->GetBuffer(),&buffer_image_copy); - return CopyBufferToImage(&info,destinationStage); + return CopyBufferToImage(tex,buf,&buffer_image_copy,destinationStage); } bool GPUDevice::CommitTexture2DMipmaps(Texture2D *tex,DeviceBuffer *buf,const VkExtent3D &extent,uint32_t total_bytes) @@ -143,9 +143,7 @@ bool GPUDevice::CommitTexture2DMipmaps(Texture2D *tex,DeviceBuffer *buf,const Vk if(height>1){height>>=1;total_bytes>>=1;} } - CopyBufferToImageMipmapsInfo info(tex,buf->GetBuffer(),buffer_image_copy,miplevel); - - return CopyBufferToImage(&info,VK_PIPELINE_STAGE_TRANSFER_BIT); + return CopyBufferToImage(tex,buf,buffer_image_copy,miplevel,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); } bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List &ir_list,VkPipelineStageFlags destinationStage) diff --git a/src/SceneGraph/Vulkan/Texture/VKDeviceTextureCube.cpp b/src/SceneGraph/Vulkan/Texture/VKDeviceTextureCube.cpp index fcb86405..614a85b0 100644 --- a/src/SceneGraph/Vulkan/Texture/VKDeviceTextureCube.cpp +++ b/src/SceneGraph/Vulkan/Texture/VKDeviceTextureCube.cpp @@ -90,7 +90,7 @@ bool GPUDevice::CommitTextureCube(TextureCube *tex,DeviceBuffer *buf,const uint3 BufferImageCopy buffer_image_copy(tex); - return CopyBufferToImage(tex,buf,&buffer_image_copy,1,6,destinationStage); + return CopyBufferToImageCube(tex,buf,&buffer_image_copy,destinationStage); } bool GPUDevice::CommitTextureCubeMipmaps(TextureCube *tex,DeviceBuffer *buf,const VkExtent3D &extent,uint32_t total_bytes) @@ -140,7 +140,7 @@ bool GPUDevice::CommitTextureCubeMipmaps(TextureCube *tex,DeviceBuffer *buf,cons if(height>1){height>>=1;total_bytes>>=1;} } - return CopyBufferToImage(tex,buf,buffer_image_copy,miplevel,6,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); + return CopyBufferToImageCube(tex,buf,buffer_image_copy,miplevel,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); } //bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List &ir_list,VkPipelineStageFlags destinationStage)