Vulkan: Add code to track allocator usage info.

This way we can potentially debug leaks, if any.
This commit is contained in:
Unknown W. Brackets committed 2018-04-06 21:42:32 -07:00
1 parent ca0fb77080
commit 1c253ee271
4 files changed
+62 -7

No files matched your search

+7 -1
View File
@@ -74,7 +74,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, int w, int h, int numMips,
vkGetImageMemoryRequirements(vulkan_->GetDevice(), image_, &mem_reqs);
if (allocator_) {
offset_ = allocator_->Allocate(mem_reqs, &mem_);
offset_ = allocator_->Allocate(mem_reqs, &mem_, Tag());
if (offset_ == VulkanDeviceAllocator::ALLOCATE_FAILED) {
return false;
}
@@ -207,6 +207,12 @@ void VulkanTexture::EndCreate(VkCommandBuffer cmd, bool vertexTexture) {
VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT);
}
void VulkanTexture::Touch() {
if (allocator_ && mem_ != VK_NULL_HANDLE) {
allocator_->Touch(mem_, offset_);
}
}
void VulkanTexture::Destroy() {
if (view_ != VK_NULL_HANDLE) {
vulkan_->Delete().QueueDeleteImageView(view_);