Vulkan: Selectively wait for WarmUp tasks

If the GraphicsPipelineDesc used by a draw call differs from the
one being used by the WarmUp tasks there is no need to wait for
their completion.

Bug: angleproject:8297
Change-Id: Ibbf3ee710036936060990455bb8657d83c7b6faf
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5421594
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: mohan maiya <m.maiya@samsung.com>
diff --git a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp
index bfe2d81..ff58e50 100644
--- a/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramExecutableVk.cpp
@@ -1027,7 +1027,22 @@
         return;
     }
 
-    // Wait unconditionally for now.
+    const vk::GraphicsPipelineSubset subset =
+        contextVk->getFeatures().supportsGraphicsPipelineLibrary.enabled
+            ? vk::GraphicsPipelineSubset::Shaders
+            : vk::GraphicsPipelineSubset::Complete;
+
+    if (currentGraphicsPipelineDesc &&
+        (mWarmUpGraphicsPipelineDesc.hash(subset) != currentGraphicsPipelineDesc->hash(subset)))
+    {
+        // The GraphicsPipelineDesc used for warmup differs from the one used by the draw call.
+        // There is no need to wait for the warmup tasks to complete.
+        ANGLE_PERF_WARNING(
+            contextVk->getDebug(), GL_DEBUG_SEVERITY_LOW,
+            "GraphicsPipelineDesc used for warmup differs from the one used by draw.");
+        return;
+    }
+
     waitForPostLinkTasksImpl(contextVk);
 }