blob: 2a215d74277632802d7de400e8da804a6a66d9e1 [file] [log] [blame]
Chia-I Wu0c203242016-03-15 13:44:51 +08001/*
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
24namespace vulkan {
25namespace api {
26
Yiwei Zhang93b521c2020-07-11 16:32:09 -070027VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
28 const VkAllocationCallbacks* pAllocator,
29 VkInstance* pInstance);
30VKAPI_ATTR void DestroyInstance(VkInstance instance,
31 const VkAllocationCallbacks* pAllocator);
32VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice,
33 const VkDeviceCreateInfo* pCreateInfo,
34 const VkAllocationCallbacks* pAllocator,
35 VkDevice* pDevice);
36VKAPI_ATTR void DestroyDevice(VkDevice device,
37 const VkAllocationCallbacks* pAllocator);
38VKAPI_ATTR VkResult
39EnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
40 VkLayerProperties* pProperties);
41VKAPI_ATTR VkResult
42EnumerateInstanceExtensionProperties(const char* pLayerName,
43 uint32_t* pPropertyCount,
44 VkExtensionProperties* pProperties);
45VKAPI_ATTR VkResult
46EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
47 uint32_t* pPropertyCount,
48 VkLayerProperties* pProperties);
49VKAPI_ATTR VkResult
50EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
51 const char* pLayerName,
52 uint32_t* pPropertyCount,
53 VkExtensionProperties* pProperties);
Daniel Kochf25f5bb2017-10-05 00:26:58 -040054VKAPI_ATTR VkResult EnumerateInstanceVersion(uint32_t* pApiVersion);
Chia-I Wu0c203242016-03-15 13:44:51 +080055
56inline InstanceData& GetData(VkInstance instance) {
57 return driver::GetData(instance).opaque_api_data;
58}
59
60inline InstanceData& GetData(VkPhysicalDevice physical_dev) {
61 return driver::GetData(physical_dev).opaque_api_data;
62}
63
64inline DeviceData& GetData(VkDevice dev) {
65 return driver::GetData(dev).opaque_api_data;
66}
67
68inline DeviceData& GetData(VkQueue queue) {
69 return driver::GetData(queue).opaque_api_data;
70}
71
72inline 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