Start adding support for some base extensions which others build on.

Many of the other extensions in Vulkan rely on these some just want to
get these landed so we can start building on top of them.

Bug: skia:
Change-Id: Icef82c169cd50ff51b97fe065923531ef2940319
Reviewed-on: https://skia-review.googlesource.com/145362
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index b0376da..24af9d7 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -13,10 +13,11 @@
 #include "GrVkInterface.h"
 #include "GrVkUtil.h"
 #include "vk/GrVkBackendContext.h"
+#include "vk/GrVkExtensions.h"
 
 GrVkCaps::GrVkCaps(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
                    VkPhysicalDevice physDev, const VkPhysicalDeviceFeatures& features,
-                   uint32_t instanceVersion)
+                   uint32_t instanceVersion, const GrVkExtensions& extensions)
     : INHERITED(contextOptions) {
     fMustDoCopiesFromOrigin = false;
     fMustSubmitCommandsBeforeCopyOp = false;
@@ -24,6 +25,12 @@
     fNewCBOnPipelineChange = false;
     fShouldAlwaysUseDedicatedImageMemory = false;
 
+    fSupportsPhysicalDeviceProperties2 = false;
+    fSupportsMemoryRequirements2 = false;
+    fSupportsMaintenance1 = false;
+    fSupportsMaintenance2 = false;
+    fSupportsMaintenance3 = false;
+
     /**************************************************************************
     * GrDrawTargetCaps fields
     **************************************************************************/
@@ -48,7 +55,7 @@
 
     fShaderCaps.reset(new GrShaderCaps(contextOptions));
 
-    this->init(contextOptions, vkInterface, physDev, features);
+    this->init(contextOptions, vkInterface, physDev, features, extensions);
 }
 
 bool GrVkCaps::initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc,
@@ -196,7 +203,8 @@
 }
 
 void GrVkCaps::init(const GrContextOptions& contextOptions, const GrVkInterface* vkInterface,
-                    VkPhysicalDevice physDev, const VkPhysicalDeviceFeatures& features) {
+                    VkPhysicalDevice physDev, const VkPhysicalDeviceFeatures& features,
+                    const GrVkExtensions& extensions) {
 
     VkPhysicalDeviceProperties properties;
     GR_VK_CALL(vkInterface, GetPhysicalDeviceProperties(physDev, &properties));
@@ -204,6 +212,33 @@
     VkPhysicalDeviceMemoryProperties memoryProperties;
     GR_VK_CALL(vkInterface, GetPhysicalDeviceMemoryProperties(physDev, &memoryProperties));
 
+    uint32_t physicalDeviceVersion = properties.apiVersion;
+
+    if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) ||
+        extensions.hasExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 1)) {
+        fSupportsPhysicalDeviceProperties2 = true;
+    }
+
+    if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) ||
+        extensions.hasExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, 1)) {
+        fSupportsMemoryRequirements2 = true;
+    }
+
+    if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) ||
+        extensions.hasExtension(VK_KHR_MAINTENANCE1_EXTENSION_NAME, 1)) {
+        fSupportsMaintenance1 = true;
+    }
+
+    if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) ||
+        extensions.hasExtension(VK_KHR_MAINTENANCE2_EXTENSION_NAME, 1)) {
+        fSupportsMaintenance2 = true;
+    }
+
+    if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) ||
+        extensions.hasExtension(VK_KHR_MAINTENANCE3_EXTENSION_NAME, 1)) {
+        fSupportsMaintenance3 = true;
+    }
+
     this->initGrCaps(properties, memoryProperties, features);
     this->initShaderCaps(properties, features);