From 8b419522d7b594cfaabb5b25949e3ee4ad26c858 Mon Sep 17 00:00:00 2001 From: niki Date: Fri, 28 Apr 2023 14:27:46 +0200 Subject: [PATCH] vulkan: simplify code slightly --- src/modules/graphics/vulkan/Shader.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/modules/graphics/vulkan/Shader.cpp b/src/modules/graphics/vulkan/Shader.cpp index 94c06f53a..88f7f3537 100644 --- a/src/modules/graphics/vulkan/Shader.cpp +++ b/src/modules/graphics/vulkan/Shader.cpp @@ -178,24 +178,17 @@ public: private: - uint32_t getFreeBinding() { + uint32_t getFreeBinding() + { for (uint32_t i = 0;; i++) { - bool free = true; - for (const auto &entry : bindingMappings) - { - if (entry.second == i) - { - free = false; - break; - } - } - if (free) + if (isFreeBinding(i)) return i; } } - bool isFreeBinding(uint32_t binding) { + bool isFreeBinding(uint32_t binding) + { for (const auto &entry : bindingMappings) { if (entry.second == binding) @@ -218,8 +211,8 @@ static VkShaderStageFlagBits getStageBit(ShaderStageType type) return VK_SHADER_STAGE_FRAGMENT_BIT; case SHADERSTAGE_COMPUTE: return VK_SHADER_STAGE_COMPUTE_BIT; - default: - throw love::Exception("invalid type"); + default: + throw love::Exception("invalid type"); } }