From: Mikko Rasa Date: Wed, 16 Mar 2022 09:28:11 +0000 (+0200) Subject: Replace some local pointers with references in VulkanCommands X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=652e82177c0fe5ae962b6c400c49e1c28ec96045;p=libs%2Fgl.git Replace some local pointers with references in VulkanCommands --- diff --git a/source/backends/vulkan/commands_backend.cpp b/source/backends/vulkan/commands_backend.cpp index 16926044..13acd8a3 100644 --- a/source/backends/vulkan/commands_backend.cpp +++ b/source/backends/vulkan/commands_backend.cpp @@ -36,20 +36,20 @@ void VulkanCommands::begin_buffer(VkRenderPass render_pass) const VulkanFunctions &vk = device.get_functions(); - CommandPool *current_pool = &command_pools[frame_index]; - if(!current_pool->in_use) + CommandPool ¤t_pool = command_pools[frame_index]; + if(!current_pool.in_use) { - current_pool->fence.reset(); - current_pool->in_use = true; + current_pool.fence.reset(); + current_pool.in_use = true; } - CommandBuffers &buffers = (render_pass ? current_pool->secondary : current_pool->primary); + CommandBuffers &buffers = (render_pass ? current_pool.secondary : current_pool.primary); if(buffers.next_buffer>=buffers.buffers.size()) { VkCommandBufferAllocateInfo alloc_info = { }; alloc_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; - alloc_info.commandPool = handle_cast<::VkCommandPool>(current_pool->pool); + alloc_info.commandPool = handle_cast<::VkCommandPool>(current_pool.pool); alloc_info.level = (render_pass ? VK_COMMAND_BUFFER_LEVEL_SECONDARY : VK_COMMAND_BUFFER_LEVEL_PRIMARY); alloc_info.commandBufferCount = 1; @@ -182,14 +182,14 @@ void VulkanCommands::begin_frame(unsigned index) command_pools.emplace_back(device); } - CommandPool *current_pool = &command_pools[frame_index]; - if(current_pool->in_use) + CommandPool ¤t_pool = command_pools[frame_index]; + if(current_pool.in_use) { - current_pool->fence.wait(); - vk.ResetCommandPool(current_pool->pool, 0); - current_pool->in_use = false; - current_pool->primary.next_buffer = 0; - current_pool->secondary.next_buffer = 0; + current_pool.fence.wait(); + vk.ResetCommandPool(current_pool.pool, 0); + current_pool.in_use = false; + current_pool.primary.next_buffer = 0; + current_pool.secondary.next_buffer = 0; } device.get_descriptor_pool().begin_frame();