diff --git a/inc/hgl/graph/VKDevice.h b/inc/hgl/graph/VKDevice.h index ceebb25f..8e702b08 100644 --- a/inc/hgl/graph/VKDevice.h +++ b/inc/hgl/graph/VKDevice.h @@ -156,7 +156,7 @@ public: //Image 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 CommitTexture2D (Texture2D *,GPUBuffer *buf,const VkBufferImageCopy *,const int count,VkPipelineStageFlags=VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); diff --git a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp index 13b6c5e0..cc536a2f 100644 --- a/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp +++ b/src/SceneGraph/Vulkan/Texture/VKDeviceTexture2D.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include"BufferImageCopy2D.h" @@ -61,19 +61,19 @@ Texture2D *GPUDevice::CreateTexture2D(TextureCreateInfo *tci) texture_cmd_buf->Begin(); 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); } } 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); } texture_cmd_buf->End(); @@ -110,7 +110,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag count, 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(), VK_PIPELINE_STAGE_TRANSFER_BIT, @@ -121,7 +121,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 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(), VK_PIPELINE_STAGE_TRANSFER_BIT, @@ -136,7 +136,7 @@ bool GPUDevice::CommitTexture2D(Texture2D *tex,GPUBuffer *buf,const VkBufferImag 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);