1 /*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef LIBVULKAN_API_H
18 #define LIBVULKAN_API_H 1
19
20 #include <vulkan/vulkan.h>
21 #include "api_gen.h"
22 #include "driver.h"
23
24 namespace vulkan {
25 namespace api {
26
27 VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
28 const VkAllocationCallbacks* pAllocator,
29 VkInstance* pInstance);
30 VKAPI_ATTR void DestroyInstance(VkInstance instance,
31 const VkAllocationCallbacks* pAllocator);
32 VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice,
33 const VkDeviceCreateInfo* pCreateInfo,
34 const VkAllocationCallbacks* pAllocator,
35 VkDevice* pDevice);
36 VKAPI_ATTR void DestroyDevice(VkDevice device,
37 const VkAllocationCallbacks* pAllocator);
38 VKAPI_ATTR VkResult
39 EnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
40 VkLayerProperties* pProperties);
41 VKAPI_ATTR VkResult
42 EnumerateInstanceExtensionProperties(const char* pLayerName,
43 uint32_t* pPropertyCount,
44 VkExtensionProperties* pProperties);
45 VKAPI_ATTR VkResult
46 EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
47 uint32_t* pPropertyCount,
48 VkLayerProperties* pProperties);
49 VKAPI_ATTR VkResult
50 EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
51 const char* pLayerName,
52 uint32_t* pPropertyCount,
53 VkExtensionProperties* pProperties);
54 VKAPI_ATTR VkResult EnumerateInstanceVersion(uint32_t* pApiVersion);
55
GetData(VkInstance instance)56 inline InstanceData& GetData(VkInstance instance) {
57 return driver::GetData(instance).opaque_api_data;
58 }
59
GetData(VkPhysicalDevice physical_dev)60 inline InstanceData& GetData(VkPhysicalDevice physical_dev) {
61 return driver::GetData(physical_dev).opaque_api_data;
62 }
63
GetData(VkDevice dev)64 inline DeviceData& GetData(VkDevice dev) {
65 return driver::GetData(dev).opaque_api_data;
66 }
67
GetData(VkQueue queue)68 inline DeviceData& GetData(VkQueue queue) {
69 return driver::GetData(queue).opaque_api_data;
70 }
71
GetData(VkCommandBuffer cmd)72 inline DeviceData& GetData(VkCommandBuffer cmd) {
73 return driver::GetData(cmd).opaque_api_data;
74 }
75
76 } // namespace api
77 } // namespace vulkan
78
79 #endif // LIBVULKAN_API_H
80