1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LIBVULKAN_DRIVER_H 17 #define LIBVULKAN_DRIVER_H 1 18 19 #include "vulkan/vulkan.h" 20 #include "vulkan/vk_ohos_native_buffer.h" 21 22 23 namespace vulkan { 24 namespace driver { 25 VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, 26 const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); 27 VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, 28 uint32_t* pPropertyCount, VkExtensionProperties* pProperties); 29 VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName); 30 VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator); 31 VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, 32 const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); 33 VKAPI_ATTR void GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties); 34 VKAPI_ATTR PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName); 35 VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, 36 uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); 37 VKAPI_ATTR void DestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); 38 VKAPI_ATTR VkResult CreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, 39 const VkAllocationCallbacks* pAllocator, VkImage* pImage); 40 VKAPI_ATTR VkResult GetSwapchainGrallocUsageOpenHarmony(VkDevice device, VkFormat format, 41 VkImageUsageFlags imageUsage, uint64_t* grallocUsage); 42 VKAPI_ATTR VkResult SetNativeFenceFdOpenHarmony(VkDevice device, 43 int32_t nativeFenceFd, VkSemaphore semaphore, VkFence fence); 44 VKAPI_ATTR VkResult GetNativeFenceFdOpenHarmony(VkQueue queue, uint32_t waitSemaphoreCount, 45 const VkSemaphore* pWaitSemaphores, VkImage image, int32_t* pNativeFenceFd); 46 void QueryPresentationProperties(VkPhysicalDevice physicalDevice, 47 VkPhysicalDevicePresentationPropertiesOpenHarmony* presentation_properties); 48 VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties); 49 bool IsSupportedVulkan(); 50 } // namespace driver 51 } // namespace vulkan 52 53 #endif // LIBVULKAN_DRIVER_H 54