Code cleanup

This commit is contained in:
Sascha Willems 2024-03-19 21:51:27 +01:00
parent 720afde027
commit a9ae9eafaa
3 changed files with 11 additions and 10 deletions

View file

@ -1,7 +1,7 @@
/*
* Vulkan Example base class
*
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
*
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/
@ -910,7 +910,7 @@ VulkanExampleBase::~VulkanExampleBase()
}
vkDestroyImageView(device, depthStencil.view, nullptr);
vkDestroyImage(device, depthStencil.image, nullptr);
vkFreeMemory(device, depthStencil.mem, nullptr);
vkFreeMemory(device, depthStencil.memory, nullptr);
vkDestroyPipelineCache(device, pipelineCache, nullptr);
@ -3007,8 +3007,8 @@ void VulkanExampleBase::setupDepthStencil()
memAllloc.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
memAllloc.allocationSize = memReqs.size;
memAllloc.memoryTypeIndex = vulkanDevice->getMemoryType(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
VK_CHECK_RESULT(vkAllocateMemory(device, &memAllloc, nullptr, &depthStencil.mem));
VK_CHECK_RESULT(vkBindImageMemory(device, depthStencil.image, depthStencil.mem, 0));
VK_CHECK_RESULT(vkAllocateMemory(device, &memAllloc, nullptr, &depthStencil.memory));
VK_CHECK_RESULT(vkBindImageMemory(device, depthStencil.image, depthStencil.memory, 0));
VkImageViewCreateInfo imageViewCI{};
imageViewCI.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
@ -3149,7 +3149,7 @@ void VulkanExampleBase::windowResize()
// Recreate the frame buffers
vkDestroyImageView(device, depthStencil.view, nullptr);
vkDestroyImage(device, depthStencil.image, nullptr);
vkFreeMemory(device, depthStencil.mem, nullptr);
vkFreeMemory(device, depthStencil.memory, nullptr);
setupDepthStencil();
for (uint32_t i = 0; i < frameBuffers.size(); i++) {
vkDestroyFramebuffer(device, frameBuffers[i], nullptr);