• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @addtogroup vulkan
18  * @{
19  *
20  * @brief Defines driver functions of the vulkan moudle.
21  *
22  * @since 1.0
23  * @version 2.0
24  */
25 
26 /**
27 * @file HDI_VULKAN_H.h
28 *
29 * @brief Declares the driver functions for vulkan.
30 *
31 * @since 1.0
32 * @version 2.0
33 */
34 
35 #ifndef HDI_VULKAN_H
36 #define HDI_VULKAN_H
37 
38 #include "vulkan/vulkan.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 #define HDIVULKAN_DISPATCH_MAGIC 0x01CDC0DE
44 
45 typedef struct {
46     VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName,
47         uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
48     VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo,
49         const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
50     PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
51 } VulkanFuncs;
52 
53 /**
54  * @brief Initialize the vulkan module to obtain the pointer to functions for memory operation.
55  *
56  * @param funcs Indicates the double pointer to functions for vulkan
57  *
58  * @return Returns <b>0</b> if the operation is successful.
59  * otherwise.
60  * @since 1.0
61  * @version 1.0
62  */
63 __attribute__((visibility("default"))) int32_t VulkanInitialize(VulkanFuncs **funcs);
64 
65 /**
66  * @brief Deinitialize the functions module to release the resource of vulkan.
67  *
68  * @param funcs Indicates the pointer to functions for vulkan.
69  *
70  * @return Returns <b>0</b> if the operation is successful.
71  * @since 1.0
72  * @version 1.0
73  */
74 __attribute__((visibility("default"))) int32_t VulkanUnInitialize(VulkanFuncs *funcs);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 #endif
80 /** @} */
81