[graphite] Set up VK_KHR_dynamic_rendering extension

Bug: b/237107064
Change-Id: I1957e6ea7639d75926857eb6989670c32454c2d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/702838
Reviewed-by: Nicolette Prevost <nicolettep@google.com>
Commit-Queue: Nicolette Prevost <nicolettep@google.com>
Auto-Submit: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/vk/VulkanInterface.cpp b/src/gpu/vk/VulkanInterface.cpp
index fb5e6d9..4cc9ac3 100644
--- a/src/gpu/vk/VulkanInterface.cpp
+++ b/src/gpu/vk/VulkanInterface.cpp
@@ -239,6 +239,12 @@
         ACQUIRE_PROC_SUFFIX(DestroySamplerYcbcrConversion, KHR, VK_NULL_HANDLE, device);
     }
 
+    // Functions for VK_KHR_dynamic_rendering
+    if (extensions->hasExtension(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, 1)) {
+        ACQUIRE_PROC_SUFFIX(CmdBeginRendering, KHR, VK_NULL_HANDLE, device);
+        ACQUIRE_PROC_SUFFIX(CmdEndRendering, KHR, VK_NULL_HANDLE, device);
+    }
+
 #ifdef SK_BUILD_FOR_ANDROID
     // Functions for VK_ANDROID_external_memory_android_hardware_buffer
     if (extensions->hasExtension(
diff --git a/src/gpu/vk/VulkanInterface.h b/src/gpu/vk/VulkanInterface.h
index bcb9024..c1eac59 100644
--- a/src/gpu/vk/VulkanInterface.h
+++ b/src/gpu/vk/VulkanInterface.h
@@ -223,6 +223,10 @@
         VkPtr<PFN_vkCreateSamplerYcbcrConversion> fCreateSamplerYcbcrConversion;
         VkPtr<PFN_vkDestroySamplerYcbcrConversion> fDestroySamplerYcbcrConversion;
 
+        // Functions for VK_KHR_dynamic_rendering
+        VkPtr<PFN_vkCmdBeginRenderingKHR> fCmdBeginRendering;
+        VkPtr<PFN_vkCmdEndRenderingKHR> fCmdEndRendering;
+
 #ifdef SK_BUILD_FOR_ANDROID
         // Functions for VK_ANDROID_external_memory_android_hardware_buffer
         VkPtr<PFN_vkGetAndroidHardwareBufferPropertiesANDROID> fGetAndroidHardwareBufferProperties;
diff --git a/tools/gpu/vk/VkTestUtils.cpp b/tools/gpu/vk/VkTestUtils.cpp
index 44ed3a8..68c275f 100644
--- a/tools/gpu/vk/VkTestUtils.cpp
+++ b/tools/gpu/vk/VkTestUtils.cpp
@@ -435,6 +435,18 @@
         tailPNext = &ycbcrFeature->pNext;
     }
 
+    VkPhysicalDeviceDynamicRenderingFeaturesKHR* dynamicRenderingFeature = nullptr;
+    if (extensions->hasExtension(VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME, 1)) {
+        dynamicRenderingFeature = (VkPhysicalDeviceDynamicRenderingFeaturesKHR*)sk_malloc_throw(
+            sizeof(VkPhysicalDeviceDynamicRenderingFeaturesKHR));
+        dynamicRenderingFeature->sType =
+                VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_FEATURES_KHR;
+        dynamicRenderingFeature->pNext = nullptr;
+        dynamicRenderingFeature->dynamicRendering = VK_TRUE;
+        *tailPNext = dynamicRenderingFeature;
+        tailPNext = &dynamicRenderingFeature->pNext;
+    }
+
     if (physDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) {
         ACQUIRE_VK_PROC_LOCAL(GetPhysicalDeviceFeatures2, inst, VK_NULL_HANDLE);
         grVkGetPhysicalDeviceFeatures2(physDev, features);