renamed to CopyBufferToImage from CommitTexture

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-09-25 12:42:48 +08:00
parent a87a35b5f8
commit ac4c97d33a
4 changed files with 32 additions and 8 deletions

View File

@ -24,6 +24,30 @@ class TileFont;
class FontSource;
class GPUArrayBuffer;
struct Image2DSubresourceRange:public VkImageSubresourceRange
{
Image2DSubresourceRange(Texture2D *tex)
{
this->aspectMask =tex->GetAspect();
this->baseMipLevel =0;
this->levelCount =tex->GetMipLevel();
this->baseArrayLayer=0;
this->layerCount =1;
}
};//struct Image2DSubresourceRange:public VkImageSubresourceRange
struct ImageCubeSubresourceRange:public VkImageSubresourceRange
{
ImageCubeSubresourceRange(TextureCube *tex)
{
this->aspectMask =tex->GetAspect();
this->baseMipLevel =0;
this->levelCount =tex->GetMipLevel();
this->baseArrayLayer=0;
this->layerCount =6;
}
};//struct ImageCubeSubresourceRange:public VkImageSubresourceRange
class GPUDevice
{
GPUDeviceAttribute *attr;
@ -151,7 +175,7 @@ public: //Image
private: //texture
bool CommitTexture (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 CommitTexture2D (Texture2D *,DeviceBuffer *buf,VkPipelineStageFlags stage);
bool CommitTexture2DMipmaps (Texture2D *,DeviceBuffer *buf,const VkExtent3D &,uint32_t);

View File

@ -24,7 +24,7 @@ void GPUDevice::Clear(TextureCreateInfo *tci)
delete tci;
}
bool GPUDevice::CommitTexture(Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *buffer_image_copy,const int count,const uint32_t layer_count,VkPipelineStageFlags destinationStage)
bool GPUDevice::CopyBufferToImage(Texture *tex,DeviceBuffer *buf,const VkBufferImageCopy *buffer_image_copy,const int count,const uint32_t layer_count,VkPipelineStageFlags destinationStage)
{
if(!tex||!buf)
return(false);

View File

@ -94,7 +94,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,DeviceBuffer *buf,VkPipelineStage
BufferImageCopy buffer_image_copy(tex);
return CommitTexture(tex,buf,&buffer_image_copy,1,1,destinationStage);
return CopyBufferToImage(tex,buf,&buffer_image_copy,1,1,destinationStage);
}
bool GPUDevice::CommitTexture2DMipmaps(Texture2D *tex,DeviceBuffer *buf,const VkExtent3D &extent,uint32_t total_bytes)
@ -140,7 +140,7 @@ bool GPUDevice::CommitTexture2DMipmaps(Texture2D *tex,DeviceBuffer *buf,const Vk
if(height>1){height>>=1;total_bytes>>=1;}
}
return CommitTexture(tex,buf,buffer_image_copy,miplevel,1,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
return CopyBufferToImage(tex,buf,buffer_image_copy,miplevel,1,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
}
bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
@ -177,7 +177,7 @@ bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Imag
}
texture_cmd_buf->Begin();
bool result=CommitTexture(tex,buf,buffer_image_copy,ir_count,1,destinationStage);
bool result=CopyBufferToImage(tex,buf,buffer_image_copy,ir_count,1,destinationStage);
texture_cmd_buf->End();
SubmitTexture(*texture_cmd_buf);
return result;
@ -195,7 +195,7 @@ bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const RectScope
BufferImageCopy buffer_image_copy(tex,scope);
texture_cmd_buf->Begin();
bool result=CommitTexture(tex,buf,&buffer_image_copy,1,1,destinationStage);
bool result=CopyBufferToImage(tex,buf,&buffer_image_copy,1,1,destinationStage);
texture_cmd_buf->End();
SubmitTexture(*texture_cmd_buf);
return result;

View File

@ -90,7 +90,7 @@ bool GPUDevice::CommitTextureCube(TextureCube *tex,DeviceBuffer *buf,const uint3
BufferImageCopy buffer_image_copy(tex);
return CommitTexture(tex,buf,&buffer_image_copy,1,6,destinationStage);
return CopyBufferToImage(tex,buf,&buffer_image_copy,1,6,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 CommitTexture(tex,buf,buffer_image_copy,miplevel,6,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
return CopyBufferToImage(tex,buf,buffer_image_copy,miplevel,6,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
}
//bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)