1cb93a386Sopenharmony_ci/* 2cb93a386Sopenharmony_ci * Copyright 2015 Google Inc. 3cb93a386Sopenharmony_ci * 4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci * found in the LICENSE file. 6cb93a386Sopenharmony_ci */ 7cb93a386Sopenharmony_ci 8cb93a386Sopenharmony_ci#include "include/gpu/vk/GrVkBackendContext.h" 9cb93a386Sopenharmony_ci#include "include/gpu/vk/GrVkExtensions.h" 10cb93a386Sopenharmony_ci#include "src/gpu/vk/GrVkInterface.h" 11cb93a386Sopenharmony_ci#include "src/gpu/vk/GrVkUtil.h" 12cb93a386Sopenharmony_ci 13cb93a386Sopenharmony_ci#define ACQUIRE_PROC(name, instance, device) \ 14cb93a386Sopenharmony_ci fFunctions.f##name = reinterpret_cast<PFN_vk##name>(getProc("vk" #name, instance, device)) 15cb93a386Sopenharmony_ci 16cb93a386Sopenharmony_ci#define ACQUIRE_PROC_SUFFIX(name, suffix, instance, device) \ 17cb93a386Sopenharmony_ci fFunctions.f##name = \ 18cb93a386Sopenharmony_ci reinterpret_cast<PFN_vk##name##suffix>(getProc("vk" #name #suffix, instance, device)) 19cb93a386Sopenharmony_ci 20cb93a386Sopenharmony_ciGrVkInterface::GrVkInterface(GrVkGetProc getProc, 21cb93a386Sopenharmony_ci VkInstance instance, 22cb93a386Sopenharmony_ci VkDevice device, 23cb93a386Sopenharmony_ci uint32_t instanceVersion, 24cb93a386Sopenharmony_ci uint32_t physicalDeviceVersion, 25cb93a386Sopenharmony_ci const GrVkExtensions* extensions) { 26cb93a386Sopenharmony_ci if (getProc == nullptr) { 27cb93a386Sopenharmony_ci return; 28cb93a386Sopenharmony_ci } 29cb93a386Sopenharmony_ci // Global/Loader Procs. 30cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateInstance, VK_NULL_HANDLE, VK_NULL_HANDLE); 31cb93a386Sopenharmony_ci ACQUIRE_PROC(EnumerateInstanceExtensionProperties, VK_NULL_HANDLE, VK_NULL_HANDLE); 32cb93a386Sopenharmony_ci ACQUIRE_PROC(EnumerateInstanceLayerProperties, VK_NULL_HANDLE, VK_NULL_HANDLE); 33cb93a386Sopenharmony_ci 34cb93a386Sopenharmony_ci // Instance Procs. 35cb93a386Sopenharmony_ci ACQUIRE_PROC(EnumeratePhysicalDevices, instance, VK_NULL_HANDLE); 36cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceFeatures, instance, VK_NULL_HANDLE); 37cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceFormatProperties, instance, VK_NULL_HANDLE); 38cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceImageFormatProperties, instance, VK_NULL_HANDLE); 39cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceProperties, instance, VK_NULL_HANDLE); 40cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties, instance, VK_NULL_HANDLE); 41cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceMemoryProperties, instance, VK_NULL_HANDLE); 42cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceSparseImageFormatProperties, instance, VK_NULL_HANDLE); 43cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyInstance, instance, VK_NULL_HANDLE); 44cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateDevice, instance, VK_NULL_HANDLE); 45cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyDevice, instance, VK_NULL_HANDLE); 46cb93a386Sopenharmony_ci ACQUIRE_PROC(EnumerateDeviceExtensionProperties, instance, VK_NULL_HANDLE); 47cb93a386Sopenharmony_ci ACQUIRE_PROC(EnumerateDeviceLayerProperties, instance, VK_NULL_HANDLE); 48cb93a386Sopenharmony_ci 49cb93a386Sopenharmony_ci // Device Procs. 50cb93a386Sopenharmony_ci ACQUIRE_PROC(GetDeviceQueue, VK_NULL_HANDLE, device); 51cb93a386Sopenharmony_ci ACQUIRE_PROC(QueueSubmit, VK_NULL_HANDLE, device); 52cb93a386Sopenharmony_ci ACQUIRE_PROC(QueueWaitIdle, VK_NULL_HANDLE, device); 53cb93a386Sopenharmony_ci ACQUIRE_PROC(DeviceWaitIdle, VK_NULL_HANDLE, device); 54cb93a386Sopenharmony_ci ACQUIRE_PROC(AllocateMemory, VK_NULL_HANDLE, device); 55cb93a386Sopenharmony_ci ACQUIRE_PROC(FreeMemory, VK_NULL_HANDLE, device); 56cb93a386Sopenharmony_ci ACQUIRE_PROC(MapMemory, VK_NULL_HANDLE, device); 57cb93a386Sopenharmony_ci ACQUIRE_PROC(UnmapMemory, VK_NULL_HANDLE, device); 58cb93a386Sopenharmony_ci ACQUIRE_PROC(FlushMappedMemoryRanges, VK_NULL_HANDLE, device); 59cb93a386Sopenharmony_ci ACQUIRE_PROC(InvalidateMappedMemoryRanges, VK_NULL_HANDLE, device); 60cb93a386Sopenharmony_ci ACQUIRE_PROC(GetDeviceMemoryCommitment, VK_NULL_HANDLE, device); 61cb93a386Sopenharmony_ci ACQUIRE_PROC(BindBufferMemory, VK_NULL_HANDLE, device); 62cb93a386Sopenharmony_ci ACQUIRE_PROC(BindImageMemory, VK_NULL_HANDLE, device); 63cb93a386Sopenharmony_ci ACQUIRE_PROC(GetBufferMemoryRequirements, VK_NULL_HANDLE, device); 64cb93a386Sopenharmony_ci ACQUIRE_PROC(GetImageMemoryRequirements, VK_NULL_HANDLE, device); 65cb93a386Sopenharmony_ci ACQUIRE_PROC(GetImageSparseMemoryRequirements, VK_NULL_HANDLE, device); 66cb93a386Sopenharmony_ci ACQUIRE_PROC(QueueBindSparse, VK_NULL_HANDLE, device); 67cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateFence, VK_NULL_HANDLE, device); 68cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyFence, VK_NULL_HANDLE, device); 69cb93a386Sopenharmony_ci ACQUIRE_PROC(ResetFences, VK_NULL_HANDLE, device); 70cb93a386Sopenharmony_ci ACQUIRE_PROC(GetFenceStatus, VK_NULL_HANDLE, device); 71cb93a386Sopenharmony_ci ACQUIRE_PROC(WaitForFences, VK_NULL_HANDLE, device); 72cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateSemaphore, VK_NULL_HANDLE, device); 73cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroySemaphore, VK_NULL_HANDLE, device); 74cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateEvent, VK_NULL_HANDLE, device); 75cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyEvent, VK_NULL_HANDLE, device); 76cb93a386Sopenharmony_ci ACQUIRE_PROC(GetEventStatus, VK_NULL_HANDLE, device); 77cb93a386Sopenharmony_ci ACQUIRE_PROC(SetEvent, VK_NULL_HANDLE, device); 78cb93a386Sopenharmony_ci ACQUIRE_PROC(ResetEvent, VK_NULL_HANDLE, device); 79cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateQueryPool, VK_NULL_HANDLE, device); 80cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyQueryPool, VK_NULL_HANDLE, device); 81cb93a386Sopenharmony_ci ACQUIRE_PROC(GetQueryPoolResults, VK_NULL_HANDLE, device); 82cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateBuffer, VK_NULL_HANDLE, device); 83cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyBuffer, VK_NULL_HANDLE, device); 84cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateBufferView, VK_NULL_HANDLE, device); 85cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyBufferView, VK_NULL_HANDLE, device); 86cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateImage, VK_NULL_HANDLE, device); 87cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyImage, VK_NULL_HANDLE, device); 88cb93a386Sopenharmony_ci ACQUIRE_PROC(GetImageSubresourceLayout, VK_NULL_HANDLE, device); 89cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateImageView, VK_NULL_HANDLE, device); 90cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyImageView, VK_NULL_HANDLE, device); 91cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateShaderModule, VK_NULL_HANDLE, device); 92cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyShaderModule, VK_NULL_HANDLE, device); 93cb93a386Sopenharmony_ci ACQUIRE_PROC(CreatePipelineCache, VK_NULL_HANDLE, device); 94cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyPipelineCache, VK_NULL_HANDLE, device); 95cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPipelineCacheData, VK_NULL_HANDLE, device); 96cb93a386Sopenharmony_ci ACQUIRE_PROC(MergePipelineCaches, VK_NULL_HANDLE, device); 97cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateGraphicsPipelines, VK_NULL_HANDLE, device); 98cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateComputePipelines, VK_NULL_HANDLE, device); 99cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyPipeline, VK_NULL_HANDLE, device); 100cb93a386Sopenharmony_ci ACQUIRE_PROC(CreatePipelineLayout, VK_NULL_HANDLE, device); 101cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyPipelineLayout, VK_NULL_HANDLE, device); 102cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateSampler, VK_NULL_HANDLE, device); 103cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroySampler, VK_NULL_HANDLE, device); 104cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateDescriptorSetLayout, VK_NULL_HANDLE, device); 105cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyDescriptorSetLayout, VK_NULL_HANDLE, device); 106cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateDescriptorPool, VK_NULL_HANDLE, device); 107cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyDescriptorPool, VK_NULL_HANDLE, device); 108cb93a386Sopenharmony_ci ACQUIRE_PROC(ResetDescriptorPool, VK_NULL_HANDLE, device); 109cb93a386Sopenharmony_ci ACQUIRE_PROC(AllocateDescriptorSets, VK_NULL_HANDLE, device); 110cb93a386Sopenharmony_ci ACQUIRE_PROC(FreeDescriptorSets, VK_NULL_HANDLE, device); 111cb93a386Sopenharmony_ci ACQUIRE_PROC(UpdateDescriptorSets, VK_NULL_HANDLE, device); 112cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateFramebuffer, VK_NULL_HANDLE, device); 113cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyFramebuffer, VK_NULL_HANDLE, device); 114cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateRenderPass, VK_NULL_HANDLE, device); 115cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyRenderPass, VK_NULL_HANDLE, device); 116cb93a386Sopenharmony_ci ACQUIRE_PROC(GetRenderAreaGranularity, VK_NULL_HANDLE, device); 117cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateCommandPool, VK_NULL_HANDLE, device); 118cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroyCommandPool, VK_NULL_HANDLE, device); 119cb93a386Sopenharmony_ci ACQUIRE_PROC(ResetCommandPool, VK_NULL_HANDLE, device); 120cb93a386Sopenharmony_ci ACQUIRE_PROC(AllocateCommandBuffers, VK_NULL_HANDLE, device); 121cb93a386Sopenharmony_ci ACQUIRE_PROC(FreeCommandBuffers, VK_NULL_HANDLE, device); 122cb93a386Sopenharmony_ci ACQUIRE_PROC(BeginCommandBuffer, VK_NULL_HANDLE, device); 123cb93a386Sopenharmony_ci ACQUIRE_PROC(EndCommandBuffer, VK_NULL_HANDLE, device); 124cb93a386Sopenharmony_ci ACQUIRE_PROC(ResetCommandBuffer, VK_NULL_HANDLE, device); 125cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBindPipeline, VK_NULL_HANDLE, device); 126cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetViewport, VK_NULL_HANDLE, device); 127cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetScissor, VK_NULL_HANDLE, device); 128cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetLineWidth, VK_NULL_HANDLE, device); 129cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetDepthBias, VK_NULL_HANDLE, device); 130cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetBlendConstants, VK_NULL_HANDLE, device); 131cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetDepthBounds, VK_NULL_HANDLE, device); 132cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetStencilCompareMask, VK_NULL_HANDLE, device); 133cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetStencilWriteMask, VK_NULL_HANDLE, device); 134cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetStencilReference, VK_NULL_HANDLE, device); 135cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBindDescriptorSets, VK_NULL_HANDLE, device); 136cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBindIndexBuffer, VK_NULL_HANDLE, device); 137cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBindVertexBuffers, VK_NULL_HANDLE, device); 138cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDraw, VK_NULL_HANDLE, device); 139cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDrawIndexed, VK_NULL_HANDLE, device); 140cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDrawIndirect, VK_NULL_HANDLE, device); 141cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDrawIndexedIndirect, VK_NULL_HANDLE, device); 142cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDispatch, VK_NULL_HANDLE, device); 143cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDispatchIndirect, VK_NULL_HANDLE, device); 144cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdCopyBuffer, VK_NULL_HANDLE, device); 145cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdCopyImage, VK_NULL_HANDLE, device); 146cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBlitImage, VK_NULL_HANDLE, device); 147cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdCopyBufferToImage, VK_NULL_HANDLE, device); 148cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdCopyImageToBuffer, VK_NULL_HANDLE, device); 149cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdUpdateBuffer, VK_NULL_HANDLE, device); 150cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdFillBuffer, VK_NULL_HANDLE, device); 151cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdClearColorImage, VK_NULL_HANDLE, device); 152cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdClearDepthStencilImage, VK_NULL_HANDLE, device); 153cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdClearAttachments, VK_NULL_HANDLE, device); 154cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdResolveImage, VK_NULL_HANDLE, device); 155cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdSetEvent, VK_NULL_HANDLE, device); 156cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdResetEvent, VK_NULL_HANDLE, device); 157cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdWaitEvents, VK_NULL_HANDLE, device); 158cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdPipelineBarrier, VK_NULL_HANDLE, device); 159cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBeginQuery, VK_NULL_HANDLE, device); 160cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdEndQuery, VK_NULL_HANDLE, device); 161cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdResetQueryPool, VK_NULL_HANDLE, device); 162cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdWriteTimestamp, VK_NULL_HANDLE, device); 163cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdCopyQueryPoolResults, VK_NULL_HANDLE, device); 164cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdPushConstants, VK_NULL_HANDLE, device); 165cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdBeginRenderPass, VK_NULL_HANDLE, device); 166cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdNextSubpass, VK_NULL_HANDLE, device); 167cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdEndRenderPass, VK_NULL_HANDLE, device); 168cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdExecuteCommands, VK_NULL_HANDLE, device); 169cb93a386Sopenharmony_ci ACQUIRE_PROC(CmdDrawBlurImageHUAWEI, VK_NULL_HANDLE, device); 170cb93a386Sopenharmony_ci ACQUIRE_PROC(GetBlurImageSizeHUAWEI, VK_NULL_HANDLE, device); 171cb93a386Sopenharmony_ci 172cb93a386Sopenharmony_ci // Functions for VK_KHR_get_physical_device_properties2 173cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 174cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceFeatures2, instance, VK_NULL_HANDLE); 175cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceProperties2, instance, VK_NULL_HANDLE); 176cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceFormatProperties2, instance, VK_NULL_HANDLE); 177cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceImageFormatProperties2, instance, VK_NULL_HANDLE); 178cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties2, instance, VK_NULL_HANDLE); 179cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceMemoryProperties2, instance, VK_NULL_HANDLE); 180cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceSparseImageFormatProperties2, instance, VK_NULL_HANDLE); 181cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 182cb93a386Sopenharmony_ci 1)) { 183cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceFeatures2, KHR, instance, VK_NULL_HANDLE); 184cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceProperties2, KHR, instance, VK_NULL_HANDLE); 185cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceFormatProperties2, KHR, instance, VK_NULL_HANDLE); 186cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceImageFormatProperties2, KHR, instance, VK_NULL_HANDLE); 187cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceQueueFamilyProperties2, KHR, instance, VK_NULL_HANDLE); 188cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceMemoryProperties2, KHR, instance, VK_NULL_HANDLE); 189cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceSparseImageFormatProperties2, KHR, instance, 190cb93a386Sopenharmony_ci VK_NULL_HANDLE); 191cb93a386Sopenharmony_ci } 192cb93a386Sopenharmony_ci 193cb93a386Sopenharmony_ci // Functions for VK_KHR_get_memory_requirements2 194cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 195cb93a386Sopenharmony_ci ACQUIRE_PROC(GetImageMemoryRequirements2, VK_NULL_HANDLE, device); 196cb93a386Sopenharmony_ci ACQUIRE_PROC(GetBufferMemoryRequirements2, VK_NULL_HANDLE, device); 197cb93a386Sopenharmony_ci ACQUIRE_PROC(GetImageSparseMemoryRequirements2, VK_NULL_HANDLE, device); 198cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, 1)) { 199cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetImageMemoryRequirements2, KHR, VK_NULL_HANDLE, device); 200cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetBufferMemoryRequirements2, KHR, VK_NULL_HANDLE, device); 201cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetImageSparseMemoryRequirements2, KHR, VK_NULL_HANDLE, device); 202cb93a386Sopenharmony_ci } 203cb93a386Sopenharmony_ci 204cb93a386Sopenharmony_ci // Functions for VK_KHR_bind_memory2 205cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 206cb93a386Sopenharmony_ci ACQUIRE_PROC(BindBufferMemory2, VK_NULL_HANDLE, device); 207cb93a386Sopenharmony_ci ACQUIRE_PROC(BindImageMemory2, VK_NULL_HANDLE, device); 208cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, 1)) { 209cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(BindBufferMemory2, KHR, VK_NULL_HANDLE, device); 210cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(BindImageMemory2, KHR, VK_NULL_HANDLE, device); 211cb93a386Sopenharmony_ci } 212cb93a386Sopenharmony_ci 213cb93a386Sopenharmony_ci // Functions for VK_KHR_maintenance1 or vulkan 1.1 214cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 215cb93a386Sopenharmony_ci ACQUIRE_PROC(TrimCommandPool, VK_NULL_HANDLE, device); 216cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_MAINTENANCE1_EXTENSION_NAME, 1)) { 217cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(TrimCommandPool, KHR, VK_NULL_HANDLE, device); 218cb93a386Sopenharmony_ci } 219cb93a386Sopenharmony_ci 220cb93a386Sopenharmony_ci // Functions for VK_KHR_maintenance3 or vulkan 1.1 221cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 222cb93a386Sopenharmony_ci ACQUIRE_PROC(GetDescriptorSetLayoutSupport, VK_NULL_HANDLE, device); 223cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_MAINTENANCE3_EXTENSION_NAME, 1)) { 224cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetDescriptorSetLayoutSupport, KHR, VK_NULL_HANDLE, device); 225cb93a386Sopenharmony_ci } 226cb93a386Sopenharmony_ci 227cb93a386Sopenharmony_ci // Functions for VK_KHR_external_memory_capabilities 228cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 229cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPhysicalDeviceExternalBufferProperties, instance, VK_NULL_HANDLE); 230cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, 1)) { 231cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetPhysicalDeviceExternalBufferProperties, KHR, instance, 232cb93a386Sopenharmony_ci VK_NULL_HANDLE); 233cb93a386Sopenharmony_ci } 234cb93a386Sopenharmony_ci 235cb93a386Sopenharmony_ci // Functions for VK_KHR_sampler_ycbcr_conversion 236cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0)) { 237cb93a386Sopenharmony_ci ACQUIRE_PROC(CreateSamplerYcbcrConversion, VK_NULL_HANDLE, device); 238cb93a386Sopenharmony_ci ACQUIRE_PROC(DestroySamplerYcbcrConversion, VK_NULL_HANDLE, device); 239cb93a386Sopenharmony_ci } else if (extensions->hasExtension(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, 1)) { 240cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(CreateSamplerYcbcrConversion, KHR, VK_NULL_HANDLE, device); 241cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(DestroySamplerYcbcrConversion, KHR, VK_NULL_HANDLE, device); 242cb93a386Sopenharmony_ci } 243cb93a386Sopenharmony_ci 244cb93a386Sopenharmony_ci#ifdef SKIA_USE_XEG 245cb93a386Sopenharmony_ci ACQUIRE_PROC(GetPerFrameLoad, VK_NULL_HANDLE, device); 246cb93a386Sopenharmony_ci#endif 247cb93a386Sopenharmony_ci 248cb93a386Sopenharmony_ci#ifdef SK_BUILD_FOR_ANDROID 249cb93a386Sopenharmony_ci // Functions for VK_ANDROID_external_memory_android_hardware_buffer 250cb93a386Sopenharmony_ci if (extensions->hasExtension( 251cb93a386Sopenharmony_ci VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, 2)) { 252cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetAndroidHardwareBufferProperties, ANDROID, VK_NULL_HANDLE, device); 253cb93a386Sopenharmony_ci ACQUIRE_PROC_SUFFIX(GetMemoryAndroidHardwareBuffer, ANDROID, VK_NULL_HANDLE, device); 254cb93a386Sopenharmony_ci } 255cb93a386Sopenharmony_ci#endif 256cb93a386Sopenharmony_ci 257cb93a386Sopenharmony_ci} 258cb93a386Sopenharmony_ci 259cb93a386Sopenharmony_ci#ifdef SK_DEBUG 260cb93a386Sopenharmony_ci static int kIsDebug = 1; 261cb93a386Sopenharmony_ci#else 262cb93a386Sopenharmony_ci static int kIsDebug = 0; 263cb93a386Sopenharmony_ci#endif 264cb93a386Sopenharmony_ci 265cb93a386Sopenharmony_ci#define RETURN_FALSE_INTERFACE \ 266cb93a386Sopenharmony_ci if (kIsDebug) { SkDebugf("%s:%d GrVkInterface::validate() failed.\n", __FILE__, __LINE__); } \ 267cb93a386Sopenharmony_ci return false; 268cb93a386Sopenharmony_ci 269cb93a386Sopenharmony_cibool GrVkInterface::validate(uint32_t instanceVersion, uint32_t physicalDeviceVersion, 270cb93a386Sopenharmony_ci const GrVkExtensions* extensions) const { 271cb93a386Sopenharmony_ci // functions that are always required 272cb93a386Sopenharmony_ci if (nullptr == fFunctions.fCreateInstance || 273cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyInstance || 274cb93a386Sopenharmony_ci nullptr == fFunctions.fEnumeratePhysicalDevices || 275cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceFeatures || 276cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceFormatProperties || 277cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceImageFormatProperties || 278cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceProperties || 279cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceQueueFamilyProperties || 280cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceMemoryProperties || 281cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateDevice || 282cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyDevice || 283cb93a386Sopenharmony_ci nullptr == fFunctions.fEnumerateInstanceExtensionProperties || 284cb93a386Sopenharmony_ci nullptr == fFunctions.fEnumerateDeviceExtensionProperties || 285cb93a386Sopenharmony_ci nullptr == fFunctions.fEnumerateInstanceLayerProperties || 286cb93a386Sopenharmony_ci nullptr == fFunctions.fEnumerateDeviceLayerProperties || 287cb93a386Sopenharmony_ci nullptr == fFunctions.fGetDeviceQueue || 288cb93a386Sopenharmony_ci nullptr == fFunctions.fQueueSubmit || 289cb93a386Sopenharmony_ci nullptr == fFunctions.fQueueWaitIdle || 290cb93a386Sopenharmony_ci nullptr == fFunctions.fDeviceWaitIdle || 291cb93a386Sopenharmony_ci nullptr == fFunctions.fAllocateMemory || 292cb93a386Sopenharmony_ci nullptr == fFunctions.fFreeMemory || 293cb93a386Sopenharmony_ci nullptr == fFunctions.fMapMemory || 294cb93a386Sopenharmony_ci nullptr == fFunctions.fUnmapMemory || 295cb93a386Sopenharmony_ci nullptr == fFunctions.fFlushMappedMemoryRanges || 296cb93a386Sopenharmony_ci nullptr == fFunctions.fInvalidateMappedMemoryRanges || 297cb93a386Sopenharmony_ci nullptr == fFunctions.fGetDeviceMemoryCommitment || 298cb93a386Sopenharmony_ci nullptr == fFunctions.fBindBufferMemory || 299cb93a386Sopenharmony_ci nullptr == fFunctions.fBindImageMemory || 300cb93a386Sopenharmony_ci nullptr == fFunctions.fGetBufferMemoryRequirements || 301cb93a386Sopenharmony_ci nullptr == fFunctions.fGetImageMemoryRequirements || 302cb93a386Sopenharmony_ci nullptr == fFunctions.fGetImageSparseMemoryRequirements || 303cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceSparseImageFormatProperties || 304cb93a386Sopenharmony_ci nullptr == fFunctions.fQueueBindSparse || 305cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateFence || 306cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyFence || 307cb93a386Sopenharmony_ci nullptr == fFunctions.fResetFences || 308cb93a386Sopenharmony_ci nullptr == fFunctions.fGetFenceStatus || 309cb93a386Sopenharmony_ci nullptr == fFunctions.fWaitForFences || 310cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateSemaphore || 311cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroySemaphore || 312cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateEvent || 313cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyEvent || 314cb93a386Sopenharmony_ci nullptr == fFunctions.fGetEventStatus || 315cb93a386Sopenharmony_ci nullptr == fFunctions.fSetEvent || 316cb93a386Sopenharmony_ci nullptr == fFunctions.fResetEvent || 317cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateQueryPool || 318cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyQueryPool || 319cb93a386Sopenharmony_ci nullptr == fFunctions.fGetQueryPoolResults || 320cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateBuffer || 321cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyBuffer || 322cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateBufferView || 323cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyBufferView || 324cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateImage || 325cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyImage || 326cb93a386Sopenharmony_ci nullptr == fFunctions.fGetImageSubresourceLayout || 327cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateImageView || 328cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyImageView || 329cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateShaderModule || 330cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyShaderModule || 331cb93a386Sopenharmony_ci nullptr == fFunctions.fCreatePipelineCache || 332cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyPipelineCache || 333cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPipelineCacheData || 334cb93a386Sopenharmony_ci nullptr == fFunctions.fMergePipelineCaches || 335cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateGraphicsPipelines || 336cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateComputePipelines || 337cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyPipeline || 338cb93a386Sopenharmony_ci nullptr == fFunctions.fCreatePipelineLayout || 339cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyPipelineLayout || 340cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateSampler || 341cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroySampler || 342cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateDescriptorSetLayout || 343cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyDescriptorSetLayout || 344cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateDescriptorPool || 345cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyDescriptorPool || 346cb93a386Sopenharmony_ci nullptr == fFunctions.fResetDescriptorPool || 347cb93a386Sopenharmony_ci nullptr == fFunctions.fAllocateDescriptorSets || 348cb93a386Sopenharmony_ci nullptr == fFunctions.fFreeDescriptorSets || 349cb93a386Sopenharmony_ci nullptr == fFunctions.fUpdateDescriptorSets || 350cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateFramebuffer || 351cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyFramebuffer || 352cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateRenderPass || 353cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyRenderPass || 354cb93a386Sopenharmony_ci nullptr == fFunctions.fGetRenderAreaGranularity || 355cb93a386Sopenharmony_ci nullptr == fFunctions.fCreateCommandPool || 356cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroyCommandPool || 357cb93a386Sopenharmony_ci nullptr == fFunctions.fResetCommandPool || 358cb93a386Sopenharmony_ci nullptr == fFunctions.fAllocateCommandBuffers || 359cb93a386Sopenharmony_ci nullptr == fFunctions.fFreeCommandBuffers || 360cb93a386Sopenharmony_ci nullptr == fFunctions.fBeginCommandBuffer || 361cb93a386Sopenharmony_ci nullptr == fFunctions.fEndCommandBuffer || 362cb93a386Sopenharmony_ci nullptr == fFunctions.fResetCommandBuffer || 363cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBindPipeline || 364cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetViewport || 365cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetScissor || 366cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetLineWidth || 367cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetDepthBias || 368cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetBlendConstants || 369cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetDepthBounds || 370cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetStencilCompareMask || 371cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetStencilWriteMask || 372cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetStencilReference || 373cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBindDescriptorSets || 374cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBindIndexBuffer || 375cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBindVertexBuffers || 376cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDraw || 377cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDrawIndexed || 378cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDrawIndirect || 379cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDrawIndexedIndirect || 380cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDispatch || 381cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdDispatchIndirect || 382cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdCopyBuffer || 383cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdCopyImage || 384cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBlitImage || 385cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdCopyBufferToImage || 386cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdCopyImageToBuffer || 387cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdUpdateBuffer || 388cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdFillBuffer || 389cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdClearColorImage || 390cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdClearDepthStencilImage || 391cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdClearAttachments || 392cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdResolveImage || 393cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdSetEvent || 394cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdResetEvent || 395cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdWaitEvents || 396cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdPipelineBarrier || 397cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBeginQuery || 398cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdEndQuery || 399cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdResetQueryPool || 400cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdWriteTimestamp || 401cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdCopyQueryPoolResults || 402cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdPushConstants || 403cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdBeginRenderPass || 404cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdNextSubpass || 405cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdEndRenderPass || 406cb93a386Sopenharmony_ci nullptr == fFunctions.fCmdExecuteCommands) { 407cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 408cb93a386Sopenharmony_ci } 409cb93a386Sopenharmony_ci 410cb93a386Sopenharmony_ci // Functions for VK_KHR_get_physical_device_properties2 or vulkan 1.1 411cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 412cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, 1)) { 413cb93a386Sopenharmony_ci if (nullptr == fFunctions.fGetPhysicalDeviceFeatures2 || 414cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceProperties2 || 415cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceFormatProperties2 || 416cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceImageFormatProperties2 || 417cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceQueueFamilyProperties2 || 418cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceMemoryProperties2 || 419cb93a386Sopenharmony_ci nullptr == fFunctions.fGetPhysicalDeviceSparseImageFormatProperties2) { 420cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 421cb93a386Sopenharmony_ci } 422cb93a386Sopenharmony_ci } 423cb93a386Sopenharmony_ci 424cb93a386Sopenharmony_ci // Functions for VK_KHR_get_memory_requirements2 or vulkan 1.1 425cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 426cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, 1)) { 427cb93a386Sopenharmony_ci if (nullptr == fFunctions.fGetImageMemoryRequirements2 || 428cb93a386Sopenharmony_ci nullptr == fFunctions.fGetBufferMemoryRequirements2 || 429cb93a386Sopenharmony_ci nullptr == fFunctions.fGetImageSparseMemoryRequirements2) { 430cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 431cb93a386Sopenharmony_ci } 432cb93a386Sopenharmony_ci } 433cb93a386Sopenharmony_ci 434cb93a386Sopenharmony_ci // Functions for VK_KHR_bind_memory2 435cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 436cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, 1)) { 437cb93a386Sopenharmony_ci if (nullptr == fFunctions.fBindBufferMemory2 || 438cb93a386Sopenharmony_ci nullptr == fFunctions.fBindImageMemory2) { 439cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 440cb93a386Sopenharmony_ci } 441cb93a386Sopenharmony_ci } 442cb93a386Sopenharmony_ci 443cb93a386Sopenharmony_ci // Functions for VK_KHR_maintenance1 or vulkan 1.1 444cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 445cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_MAINTENANCE1_EXTENSION_NAME, 1)) { 446cb93a386Sopenharmony_ci if (nullptr == fFunctions.fTrimCommandPool) { 447cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 448cb93a386Sopenharmony_ci } 449cb93a386Sopenharmony_ci } 450cb93a386Sopenharmony_ci 451cb93a386Sopenharmony_ci // Functions for VK_KHR_maintenance3 or vulkan 1.1 452cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 453cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_MAINTENANCE3_EXTENSION_NAME, 1)) { 454cb93a386Sopenharmony_ci if (nullptr == fFunctions.fGetDescriptorSetLayoutSupport) { 455cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 456cb93a386Sopenharmony_ci } 457cb93a386Sopenharmony_ci } 458cb93a386Sopenharmony_ci 459cb93a386Sopenharmony_ci // Functions for VK_KHR_external_memory_capabilities 460cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 461cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, 1)) { 462cb93a386Sopenharmony_ci if (nullptr == fFunctions.fGetPhysicalDeviceExternalBufferProperties) { 463cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 464cb93a386Sopenharmony_ci } 465cb93a386Sopenharmony_ci } 466cb93a386Sopenharmony_ci 467cb93a386Sopenharmony_ci // Functions for VK_KHR_sampler_ycbcr_conversion 468cb93a386Sopenharmony_ci if (physicalDeviceVersion >= VK_MAKE_VERSION(1, 1, 0) || 469cb93a386Sopenharmony_ci extensions->hasExtension(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, 1)) { 470cb93a386Sopenharmony_ci if (nullptr == fFunctions.fCreateSamplerYcbcrConversion || 471cb93a386Sopenharmony_ci nullptr == fFunctions.fDestroySamplerYcbcrConversion) { 472cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 473cb93a386Sopenharmony_ci } 474cb93a386Sopenharmony_ci } 475cb93a386Sopenharmony_ci 476cb93a386Sopenharmony_ci#ifdef SK_BUILD_FOR_ANDROID 477cb93a386Sopenharmony_ci // Functions for VK_ANDROID_external_memory_android_hardware_buffer 478cb93a386Sopenharmony_ci if (extensions->hasExtension( 479cb93a386Sopenharmony_ci VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME, 2)) { 480cb93a386Sopenharmony_ci if (nullptr == fFunctions.fGetAndroidHardwareBufferProperties || 481cb93a386Sopenharmony_ci nullptr == fFunctions.fGetMemoryAndroidHardwareBuffer) { 482cb93a386Sopenharmony_ci RETURN_FALSE_INTERFACE 483cb93a386Sopenharmony_ci } 484cb93a386Sopenharmony_ci } 485cb93a386Sopenharmony_ci#endif 486cb93a386Sopenharmony_ci 487cb93a386Sopenharmony_ci return true; 488cb93a386Sopenharmony_ci} 489cb93a386Sopenharmony_ci 490