improved codes.
This commit is contained in:
parent
2487cb1f36
commit
f901708b6c
@ -155,7 +155,13 @@ private: //texture
|
|||||||
|
|
||||||
bool CopyBufferToImage (const CopyBufferToImageInfo *info,VkPipelineStageFlags destinationStage);
|
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 CommitTexture2D (Texture2D *,DeviceBuffer *buf,VkPipelineStageFlags stage);
|
||||||
bool CommitTexture2DMipmaps (Texture2D *,DeviceBuffer *buf,const VkExtent3D &,uint32_t);
|
bool CommitTexture2DMipmaps (Texture2D *,DeviceBuffer *buf,const VkExtent3D &,uint32_t);
|
||||||
|
@ -11,50 +11,5 @@ struct CopyBufferToImageInfo
|
|||||||
|
|
||||||
const VkBufferImageCopy * bic_list;
|
const VkBufferImageCopy * bic_list;
|
||||||
uint32_t bic_count;
|
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
|
VK_NAMESPACE_END
|
||||||
|
@ -95,9 +95,9 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,DeviceBuffer *buf,VkPipelineStage
|
|||||||
|
|
||||||
BufferImageCopy buffer_image_copy(tex);
|
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)
|
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;}
|
if(height>1){height>>=1;total_bytes>>=1;}
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyBufferToImageMipmapsInfo info(tex,buf->GetBuffer(),buffer_image_copy,miplevel);
|
return CopyBufferToImage(tex,buf,buffer_image_copy,miplevel,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||||
|
|
||||||
return CopyBufferToImage(&info,VK_PIPELINE_STAGE_TRANSFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
||||||
|
@ -90,7 +90,7 @@ bool GPUDevice::CommitTextureCube(TextureCube *tex,DeviceBuffer *buf,const uint3
|
|||||||
|
|
||||||
BufferImageCopy buffer_image_copy(tex);
|
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)
|
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;}
|
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<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
//bool GPUDevice::ChangeTexture2D(Texture2D *tex,DeviceBuffer *buf,const List<Image2DRegion> &ir_list,VkPipelineStageFlags destinationStage)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user