diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index fad5993e..01f1403f 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -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); diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index ccf6735a..0ab2a319 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -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) */ @@ -202,11 +202,12 @@ public: std::string name = "vulkanExample"; uint32_t apiVersion = VK_API_VERSION_1_0; + /** @brief Default depth stencil attachment used by the default render pass */ struct { VkImage image; - VkDeviceMemory mem; + VkDeviceMemory memory; VkImageView view; - } depthStencil; + } depthStencil{}; struct { glm::vec2 axisLeft = glm::vec2(0.0f); diff --git a/examples/triangle/triangle.cpp b/examples/triangle/triangle.cpp index 59f6f0a7..c71b8ef8 100644 --- a/examples/triangle/triangle.cpp +++ b/examples/triangle/triangle.cpp @@ -485,8 +485,8 @@ public: vkGetImageMemoryRequirements(device, depthStencil.image, &memReqs); memAlloc.allocationSize = memReqs.size; memAlloc.memoryTypeIndex = getMemoryTypeIndex(memReqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); - VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &depthStencil.mem)); - VK_CHECK_RESULT(vkBindImageMemory(device, depthStencil.image, depthStencil.mem, 0)); + VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &depthStencil.memory)); + VK_CHECK_RESULT(vkBindImageMemory(device, depthStencil.image, depthStencil.memory, 0)); // Create a view for the depth stencil image // Images aren't directly accessed in Vulkan, but rather through views described by a subresource range