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 // clang-format off
28 VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
29 VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator);
30 VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
31 VKAPI_ATTR void DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator);
32 VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
33 VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
34 VKAPI_ATTR VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
35 VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
36 VKAPI_ATTR VkResult EnumerateInstanceVersion(uint32_t* pApiVersion);
37 // clang-format on
38
GetData(VkInstance instance)39 inline InstanceData& GetData(VkInstance instance) {
40 return driver::GetData(instance).opaque_api_data;
41 }
42
GetData(VkPhysicalDevice physical_dev)43 inline InstanceData& GetData(VkPhysicalDevice physical_dev) {
44 return driver::GetData(physical_dev).opaque_api_data;
45 }
46
GetData(VkDevice dev)47 inline DeviceData& GetData(VkDevice dev) {
48 return driver::GetData(dev).opaque_api_data;
49 }
50
GetData(VkQueue queue)51 inline DeviceData& GetData(VkQueue queue) {
52 return driver::GetData(queue).opaque_api_data;
53 }
54
GetData(VkCommandBuffer cmd)55 inline DeviceData& GetData(VkCommandBuffer cmd) {
56 return driver::GetData(cmd).opaque_api_data;
57 }
58
59 } // namespace api
60 } // namespace vulkan
61
62 #endif // LIBVULKAN_API_H
63