Vulkan: Follow up change to optimize number of condition checks

This is a follow up of a comment on this CL:
https://chromium-review.googlesource.com/c/angle/angle/+/985954

Bug: angleproject:2442

Change-Id: Id104c1437d77e6102b94351623ee8538a1d6c3d7
Reviewed-on: https://chromium-review.googlesource.com/996012
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Luc Ferron <lucferron@chromium.org>
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index f2761b5..6287c93 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -437,24 +437,38 @@
         return;
     }
 
-    for (auto &uniformBlock : mDefaultUniformBlocks)
+    if (linkedUniform.typeInfo->type == entryPointType)
     {
-        const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
-
-        // Assume an offset of -1 means the block is unused.
-        if (layoutInfo.offset == -1)
+        for (auto &uniformBlock : mDefaultUniformBlocks)
         {
-            continue;
-        }
+            const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
 
-        const GLint componentCount = linkedUniform.typeInfo->componentCount;
-        if (linkedUniform.typeInfo->type == entryPointType)
-        {
+            // Assume an offset of -1 means the block is unused.
+            if (layoutInfo.offset == -1)
+            {
+                continue;
+            }
+
+            const GLint componentCount = linkedUniform.typeInfo->componentCount;
             UpdateDefaultUniformBlock(count, locationInfo.arrayIndex, componentCount, v, layoutInfo,
                                       &uniformBlock.uniformData);
+            uniformBlock.uniformsDirty = true;
         }
-        else
+    }
+    else
+    {
+        for (auto &uniformBlock : mDefaultUniformBlocks)
         {
+            const sh::BlockMemberInfo &layoutInfo = uniformBlock.uniformLayout[location];
+
+            // Assume an offset of -1 means the block is unused.
+            if (layoutInfo.offset == -1)
+            {
+                continue;
+            }
+
+            const GLint componentCount = linkedUniform.typeInfo->componentCount;
+
             ASSERT(linkedUniform.typeInfo->type == gl::VariableBoolVectorType(entryPointType));
 
             GLint initialArrayOffset = locationInfo.arrayIndex * layoutInfo.arrayStride;
@@ -470,8 +484,8 @@
                     dest[c] = (source[c] == static_cast<T>(0)) ? GL_FALSE : GL_TRUE;
                 }
             }
+            uniformBlock.uniformsDirty = true;
         }
-        uniformBlock.uniformsDirty = true;
     }
 }