mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- release staging buffer after the frame it was used in
This commit is contained in:
parent
34a8e9050b
commit
d985d98122
2 changed files with 7 additions and 7 deletions
|
@ -65,7 +65,6 @@ void VkHardwareTexture::Reset()
|
|||
auto &deleteList = fb->FrameDeleteList;
|
||||
if (mImage) deleteList.Images.push_back(std::move(mImage));
|
||||
if (mImageView) deleteList.ImageViews.push_back(std::move(mImageView));
|
||||
if (mStagingBuffer) deleteList.Buffers.push_back(std::move(mStagingBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,12 +222,12 @@ void VkHardwareTexture::CreateTexture(int w, int h, int pixelsize, VkFormat form
|
|||
BufferBuilder bufbuilder;
|
||||
bufbuilder.setSize(totalSize);
|
||||
bufbuilder.setUsage(VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VMA_MEMORY_USAGE_CPU_ONLY);
|
||||
mStagingBuffer = bufbuilder.create(fb->device);
|
||||
mStagingBuffer->SetDebugName("VkHardwareTexture.mStagingBuffer");
|
||||
std::unique_ptr<VulkanBuffer> stagingBuffer = bufbuilder.create(fb->device);
|
||||
stagingBuffer->SetDebugName("VkHardwareTexture.mStagingBuffer");
|
||||
|
||||
uint8_t *data = (uint8_t*)mStagingBuffer->Map(0, totalSize);
|
||||
uint8_t *data = (uint8_t*)stagingBuffer->Map(0, totalSize);
|
||||
memcpy(data, pixels, totalSize);
|
||||
mStagingBuffer->Unmap();
|
||||
stagingBuffer->Unmap();
|
||||
|
||||
ImageBuilder imgbuilder;
|
||||
imgbuilder.setFormat(format);
|
||||
|
@ -254,7 +253,9 @@ void VkHardwareTexture::CreateTexture(int w, int h, int pixelsize, VkFormat form
|
|||
region.imageExtent.depth = 1;
|
||||
region.imageExtent.width = w;
|
||||
region.imageExtent.height = h;
|
||||
cmdbuffer->copyBufferToImage(mStagingBuffer->buffer, mImage->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion);
|
||||
cmdbuffer->copyBufferToImage(stagingBuffer->buffer, mImage->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion);
|
||||
|
||||
fb->FrameDeleteList.Buffers.push_back(std::move(stagingBuffer));
|
||||
|
||||
GenerateMipmaps(mImage.get(), cmdbuffer);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,6 @@ private:
|
|||
std::vector<DescriptorEntry> mDescriptorSets;
|
||||
std::unique_ptr<VulkanImage> mImage;
|
||||
std::unique_ptr<VulkanImageView> mImageView;
|
||||
std::unique_ptr<VulkanBuffer> mStagingBuffer;
|
||||
VkImageLayout mImageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
int mTexelsize = 4;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue