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 // clang-format on 37 38 inline InstanceData& GetData(VkInstance instance) { 39 return driver::GetData(instance).opaque_api_data; 40 } 41 42 inline InstanceData& GetData(VkPhysicalDevice physical_dev) { 43 return driver::GetData(physical_dev).opaque_api_data; 44 } 45 46 inline DeviceData& GetData(VkDevice dev) { 47 return driver::GetData(dev).opaque_api_data; 48 } 49 50 inline DeviceData& GetData(VkQueue queue) { 51 return driver::GetData(queue).opaque_api_data; 52 } 53 54 inline DeviceData& GetData(VkCommandBuffer cmd) { 55 return driver::GetData(cmd).opaque_api_data; 56 } 57 58 } // namespace api 59 } // namespace vulkan 60 61 #endif // LIBVULKAN_API_H 62