deleted not needed params at GPUDevice::CommitTexture2D that they are width and height.

This commit is contained in:
hyzboy 2022-01-07 12:05:52 +08:00
parent a28d857b96
commit b064a4de5f
2 changed files with 10 additions and 10 deletions

View File

@ -156,7 +156,7 @@ public: //Image
private: //texture private: //texture
bool CommitTexture2D (Texture2D *,GPUBuffer *buf,uint32_t width,uint32_t height,VkPipelineStageFlags stage); bool CommitTexture2D (Texture2D *,GPUBuffer *buf,VkPipelineStageFlags stage);
bool CommitTexture2DMipmaps (Texture2D *,GPUBuffer *buf,uint32_t width,uint32_t height,uint32_t); bool CommitTexture2DMipmaps (Texture2D *,GPUBuffer *buf,uint32_t width,uint32_t height,uint32_t);
bool CommitTexture2D (Texture2D *,GPUBuffer *buf,const VkBufferImageCopy *,const int count,VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); bool CommitTexture2D (Texture2D *,GPUBuffer *buf,const VkBufferImageCopy *,const int count,VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);

View File

@ -1,4 +1,4 @@
#include<hgl/graph/VKDevice.h> #include<hgl/graph/VKDevice.h>
#include<hgl/graph/VKImageCreateInfo.h> #include<hgl/graph/VKImageCreateInfo.h>
#include<hgl/graph/VKCommandBuffer.h> #include<hgl/graph/VKCommandBuffer.h>
#include"BufferImageCopy2D.h" #include"BufferImageCopy2D.h"
@ -61,19 +61,19 @@ Texture2D *GPUDevice::CreateTexture2D(TextureCreateInfo *tci)
texture_cmd_buf->Begin(); texture_cmd_buf->Begin();
if(tci->target_mipmaps==tci->origin_mipmaps) if(tci->target_mipmaps==tci->origin_mipmaps)
{ {
if(tci->target_mipmaps<=1) //本身不含mipmaps但也不要mipmaps if(tci->target_mipmaps<=1) //本身不含mipmaps但也不要mipmaps
{ {
CommitTexture2D(tex,tci->buffer,tci->extent.width,tci->extent.height,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); CommitTexture2D(tex,tci->buffer,VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
} }
else //本身有mipmaps数据 else //本身有mipmaps数据
{ {
CommitTexture2DMipmaps(tex,tci->buffer,tci->extent.width,tci->extent.height,tci->mipmap_zero_total_bytes); CommitTexture2DMipmaps(tex,tci->buffer,tci->extent.width,tci->extent.height,tci->mipmap_zero_total_bytes);
} }
} }
else else
if(tci->origin_mipmaps<=1) //本身不含mipmaps数据,又想要mipmaps if(tci->origin_mipmaps<=1) //本身不含mipmaps数据,又想要mipmaps
{ {
CommitTexture2D(tex,tci->buffer,tci->extent.width,tci->extent.height,VK_PIPELINE_STAGE_TRANSFER_BIT); CommitTexture2D(tex,tci->buffer,VK_PIPELINE_STAGE_TRANSFER_BIT);
GenerateMipmaps2D(texture_cmd_buf,tex->GetImage(),tex->GetAspect(),tci->extent,tex_data->miplevel); GenerateMipmaps2D(texture_cmd_buf,tex->GetImage(),tex->GetAspect(),tci->extent,tex_data->miplevel);
} }
texture_cmd_buf->End(); texture_cmd_buf->End();
@ -110,7 +110,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag
count, count,
buffer_image_copy); buffer_image_copy);
if(destinationStage==VK_PIPELINE_STAGE_TRANSFER_BIT) //接下来还有一般是给自动生成mipmaps if(destinationStage==VK_PIPELINE_STAGE_TRANSFER_BIT) //接下来还有一般是给自动生成mipmaps
{ {
texture_cmd_buf->ImageMemoryBarrier(tex->GetImage(), texture_cmd_buf->ImageMemoryBarrier(tex->GetImage(),
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
@ -121,7 +121,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
subresourceRange); subresourceRange);
} }
else// if(destinationStage==VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) //接下来就给fragment shader用了证明是最后一步 else// if(destinationStage==VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT) //接下来就给fragment shader用了证明是最后一步
{ {
texture_cmd_buf->ImageMemoryBarrier(tex->GetImage(), texture_cmd_buf->ImageMemoryBarrier(tex->GetImage(),
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
@ -136,7 +136,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag
return(true); return(true);
} }
bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,uint32_t width,uint32_t height,VkPipelineStageFlags destinationStage) bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,VkPipelineStageFlags destinationStage)
{ {
if(!tex||!buf)return(false); if(!tex||!buf)return(false);