From 6d09582d6df58c27cc74924670b4a62174427c28 Mon Sep 17 00:00:00 2001 From: Joilnen Date: Tue, 3 Oct 2023 17:44:35 -0300 Subject: [PATCH] Vulkan: range loop refactoring (#2947) --- .../src/OgreVulkanHardwareBufferManager.cpp | 18 +++----- RenderSystems/Vulkan/src/OgreVulkanUtils.cpp | 42 +++++++++---------- 2 files changed, 26 insertions(+), 34 deletions(-) diff --git a/RenderSystems/Vulkan/src/OgreVulkanHardwareBufferManager.cpp b/RenderSystems/Vulkan/src/OgreVulkanHardwareBufferManager.cpp index 4ae5f0646e5..a70ca165cc5 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanHardwareBufferManager.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanHardwareBufferManager.cpp @@ -46,26 +46,18 @@ namespace Ogre { { OGRE_LOCK_MUTEX( mVertexBuffersMutex ); - VertexBufferList::const_iterator itor = mVertexBuffers.begin(); - VertexBufferList::const_iterator end = mVertexBuffers.end(); - - while( itor != end ) + for (auto& b : mVertexBuffers) { - auto hwBuffer = (*itor)->_getImpl(); + auto hwBuffer = b->_getImpl(); hwBuffer->_notifyDeviceStalled(); - ++itor; } } { OGRE_LOCK_MUTEX( mIndexBuffersMutex ); - IndexBufferList::const_iterator itor = mIndexBuffers.begin(); - IndexBufferList::const_iterator end = mIndexBuffers.end(); - - while( itor != end ) + for (auto& i : mIndexBuffers) { - auto hwBuffer = (*itor)->_getImpl(); + auto hwBuffer = i->_getImpl(); hwBuffer->_notifyDeviceStalled(); - ++itor; } } } @@ -105,4 +97,4 @@ namespace Ogre return std::make_shared(VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, sizeBytes, usage, false, mDevice); } -} // namespace Ogre \ No newline at end of file +} // namespace Ogre diff --git a/RenderSystems/Vulkan/src/OgreVulkanUtils.cpp b/RenderSystems/Vulkan/src/OgreVulkanUtils.cpp index 75d8684f9d8..5e227c53d27 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanUtils.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanUtils.cpp @@ -44,29 +44,29 @@ namespace Ogre case VK_TIMEOUT: return "VK_TIMEOUT"; case VK_EVENT_SET: return "VK_EVENT_SET"; case VK_EVENT_RESET: return "VK_EVENT_RESET"; - case VK_INCOMPLETE: return"VK_INCOMPLETE"; + case VK_INCOMPLETE: return "VK_INCOMPLETE"; case VK_ERROR_OUT_OF_HOST_MEMORY: return "VK_ERROR_OUT_OF_HOST_MEMORY"; case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; - case VK_ERROR_INITIALIZATION_FAILED: return"VK_ERROR_INITIALIZATION_FAILED"; - case VK_ERROR_DEVICE_LOST: return"VK_ERROR_DEVICE_LOST"; - case VK_ERROR_MEMORY_MAP_FAILED: return"VK_ERROR_MEMORY_MAP_FAILED"; - case VK_ERROR_LAYER_NOT_PRESENT: return"VK_ERROR_LAYER_NOT_PRESENT"; - case VK_ERROR_EXTENSION_NOT_PRESENT: return"VK_ERROR_EXTENSION_NOT_PRESENT"; - case VK_ERROR_FEATURE_NOT_PRESENT: return"VK_ERROR_FEATURE_NOT_PRESENT"; - case VK_ERROR_INCOMPATIBLE_DRIVER: return"VK_ERROR_INCOMPATIBLE_DRIVER"; - case VK_ERROR_TOO_MANY_OBJECTS: return"VK_ERROR_TOO_MANY_OBJECTS"; - case VK_ERROR_FORMAT_NOT_SUPPORTED: return"VK_ERROR_FORMAT_NOT_SUPPORTED"; - case VK_ERROR_FRAGMENTED_POOL: return"VK_ERROR_FRAGMENTED_POOL"; - case VK_ERROR_OUT_OF_POOL_MEMORY: return"VK_ERROR_OUT_OF_POOL_MEMORY"; - case VK_ERROR_INVALID_EXTERNAL_HANDLE: return"VK_ERROR_INVALID_EXTERNAL_HANDLE"; - case VK_ERROR_SURFACE_LOST_KHR: return"VK_ERROR_SURFACE_LOST_KHR"; - case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return"VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; - case VK_SUBOPTIMAL_KHR: return"VK_SUBOPTIMAL_KHR"; - case VK_ERROR_OUT_OF_DATE_KHR: return"VK_ERROR_OUT_OF_DATE_KHR"; - case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return"VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; - case VK_ERROR_VALIDATION_FAILED_EXT: return"VK_ERROR_VALIDATION_FAILED_EXT"; - case VK_ERROR_INVALID_SHADER_NV: return"VK_ERROR_INVALID_SHADER_NV"; - case VK_ERROR_NOT_PERMITTED_EXT: return"VK_ERROR_NOT_PERMITTED_EXT"; + case VK_ERROR_INITIALIZATION_FAILED: return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_OUT_OF_POOL_MEMORY: return "VK_ERROR_OUT_OF_POOL_MEMORY"; + case VK_ERROR_INVALID_EXTERNAL_HANDLE: return "VK_ERROR_INVALID_EXTERNAL_HANDLE"; + case VK_ERROR_SURFACE_LOST_KHR: return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_INVALID_SHADER_NV: return "VK_ERROR_INVALID_SHADER_NV"; + case VK_ERROR_NOT_PERMITTED_EXT: return "VK_ERROR_NOT_PERMITTED_EXT"; default: return StringConverter::toString( result ); }