From c23027d687135dbcfe602d941cb546557e39f452 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Mon, 1 Jan 2024 16:41:38 +0100 Subject: [PATCH] Minor code cleanup --- base/vulkanexamplebase.cpp | 4 ++-- base/vulkanexamplebase.h | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 5917f3e9..5d7434ba 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -144,7 +144,7 @@ VkResult VulkanExampleBase::createInstance(bool enableValidation) } VkResult result = vkCreateInstance(&instanceCreateInfo, nullptr, &instance); - // If the debug utils extension is present we set up debug functions, so samples an label objects for debugging + // If the debug utils extension is present we set up debug functions, so samples can label objects for debugging if (std::find(supportedInstanceExtensions.begin(), supportedInstanceExtensions.end(), VK_EXT_DEBUG_UTILS_EXTENSION_NAME) != supportedInstanceExtensions.end()) { vks::debugutils::setup(instance); } @@ -1076,7 +1076,7 @@ bool VulkanExampleBase::initVulkan() // Find a suitable depth and/or stencil format VkBool32 validFormat{ false }; - // Sample that make use of stencil will require a depth + stencil format, so we select from a different list + // Samples that make use of stencil will require a depth + stencil format, so we select from a different list if (requiresStencil) { validFormat = vks::tools::getSupportedDepthStencilFormat(physicalDevice, &depthFormat); } else { diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index ac73ed22..4c0c4ab2 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -100,16 +100,16 @@ protected: uint32_t lastFPS = 0; std::chrono::time_point lastTimestamp, tPrevEnd; // Vulkan instance, stores all per-application states - VkInstance instance; + VkInstance instance{ VK_NULL_HANDLE }; std::vector supportedInstanceExtensions; // Physical device (GPU) that Vulkan will use - VkPhysicalDevice physicalDevice; + VkPhysicalDevice physicalDevice{ VK_NULL_HANDLE }; // Stores physical device properties (for e.g. checking device limits) - VkPhysicalDeviceProperties deviceProperties; + VkPhysicalDeviceProperties deviceProperties{}; // Stores the features available on the selected physical device (for e.g. checking if a feature is available) - VkPhysicalDeviceFeatures deviceFeatures; + VkPhysicalDeviceFeatures deviceFeatures{}; // Stores all available memory (type) properties for the physical device - VkPhysicalDeviceMemoryProperties deviceMemoryProperties; + VkPhysicalDeviceMemoryProperties deviceMemoryProperties{}; /** @brief Set of physical device features to be enabled for this example (must be set in the derived constructor) */ VkPhysicalDeviceFeatures enabledFeatures{}; /** @brief Set of device extensions to be enabled for this example (must be set in the derived constructor) */ @@ -118,13 +118,13 @@ protected: /** @brief Optional pNext structure for passing extension structures to device creation */ void* deviceCreatepNextChain = nullptr; /** @brief Logical device, application's view of the physical device (GPU) */ - VkDevice device; + VkDevice device{ VK_NULL_HANDLE }; // Handle to the device graphics queue that command buffers are submitted to - VkQueue queue; + VkQueue queue{ VK_NULL_HANDLE }; // Depth buffer format (selected during Vulkan initialization) VkFormat depthFormat; // Command buffer pool - VkCommandPool cmdPool; + VkCommandPool cmdPool{ VK_NULL_HANDLE }; /** @brief Pipeline stages used to wait at for graphics queue submissions */ VkPipelineStageFlags submitPipelineStages = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; // Contains command buffers and semaphores to be presented to the queue @@ -132,17 +132,17 @@ protected: // Command buffers used for rendering std::vector drawCmdBuffers; // Global render pass for frame buffer writes - VkRenderPass renderPass = VK_NULL_HANDLE; + VkRenderPass renderPass{ VK_NULL_HANDLE }; // List of available frame buffers (same as number of swap chain images) std::vectorframeBuffers; // Active frame buffer index uint32_t currentBuffer = 0; // Descriptor set pool - VkDescriptorPool descriptorPool = VK_NULL_HANDLE; + VkDescriptorPool descriptorPool{ VK_NULL_HANDLE }; // List of shader modules created (stored for cleanup) std::vector shaderModules; // Pipeline cache object - VkPipelineCache pipelineCache; + VkPipelineCache pipelineCache{ VK_NULL_HANDLE }; // Wraps the swap chain to present images (framebuffers) to the windowing system VulkanSwapChain swapChain; // Synchronization semaphores