Don't log a protected swapchain error if extension isn't implemented

Whenever VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR was set, the validation
errors would log an error if VK_KHR_surface_protected_capabilities
didn't return supportsProtected. This doesn't work if the extension
isn't supported on the current driver.

Upstream bug report:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4692

Bug: 112839
Bug: 112606
Change-Id: Icaa3865309423d8791ec256e33e34e6b2d04b965
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/Vulkan-ValidationLayers/+/746004
Reviewed-by: Craig Stout <cstout@google.com>
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp
index 5e32cb3..43f2d20 100644
--- a/layers/core_validation.cpp
+++ b/layers/core_validation.cpp
@@ -18152,7 +18152,9 @@
         const bool is_required_ext_enabled = IsExtEnabled(instance_extensions.vk_khr_surface_protected_capabilities);
 
         // Assume that the "protected" flag is not supported if VK_KHR_surface_protected_capabilities is not enabled
-        bool log_error = !is_required_ext_enabled;
+        // Fuchsia change: don't warn unless the extension is supported. See fxbug.dev/112839 and
+        // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4692
+        bool log_error = instance_extensions.vk_khr_surface_protected_capabilities && !is_required_ext_enabled;
 
         if (is_required_ext_enabled) {
             VkPhysicalDeviceSurfaceInfo2KHR surface_info = LvlInitStruct<VkPhysicalDeviceSurfaceInfo2KHR>();