blob: 416cba01252e85b9f155863d35b24cb07b2befc8 [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
27// clang-format off
28VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);
29VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator);
30VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice);
31VKAPI_ATTR void DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator);
32VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties);
33VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
34VKAPI_ATTR VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties);
35VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties);
Daniel Kochf25f5bb2017-10-05 00:26:58 -040036VKAPI_ATTR VkResult EnumerateInstanceVersion(uint32_t* pApiVersion);
Chia-I Wu0c203242016-03-15 13:44:51 +080037// clang-format on
38
39inline InstanceData& GetData(VkInstance instance) {
40 return driver::GetData(instance).opaque_api_data;
41}
42
43inline InstanceData& GetData(VkPhysicalDevice physical_dev) {
44 return driver::GetData(physical_dev).opaque_api_data;
45}
46
47inline DeviceData& GetData(VkDevice dev) {
48 return driver::GetData(dev).opaque_api_data;
49}
50
51inline DeviceData& GetData(VkQueue queue) {
52 return driver::GetData(queue).opaque_api_data;
53}
54
55inline 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