diff options
author | 2016-03-15 13:44:51 +0800 | |
---|---|---|
committer | 2016-03-30 09:42:47 +0800 | |
commit | 0c2032490b80178ec823bf22a7f5d08398851cc3 (patch) | |
tree | 9675ef1e494d8593698063c5160cda6351883c30 /vulkan/libvulkan/api.h | |
parent | baa85bd893665a48aee73d7ca7b73cd39b48f998 (diff) |
vulkan: rewrite top of loader
The top is responsible for layer discovery and chaining, and the bottom is
like a regular layer that is always enabled and is inserted just before
the driver. Make the separation clear by rewriting the top and stripping
the layer managment code from loader.cpp.
Change-Id: I64e525e27bd4c297bccd94a1eb9b88e28088e85d
Diffstat (limited to 'vulkan/libvulkan/api.h')
-rw-r--r-- | vulkan/libvulkan/api.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/vulkan/libvulkan/api.h b/vulkan/libvulkan/api.h new file mode 100644 index 0000000000..ded7d1779f --- /dev/null +++ b/vulkan/libvulkan/api.h @@ -0,0 +1,61 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LIBVULKAN_API_H +#define LIBVULKAN_API_H 1 + +#include <vulkan/vulkan.h> +#include "api_gen.h" +#include "driver.h" + +namespace vulkan { +namespace api { + +// clang-format off +VKAPI_ATTR VkResult CreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); +VKAPI_ATTR void DestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator); +VKAPI_ATTR VkResult CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); +VKAPI_ATTR void DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator); +VKAPI_ATTR VkResult EnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties); +VKAPI_ATTR VkResult EnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +VKAPI_ATTR VkResult EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); +VKAPI_ATTR VkResult EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +// clang-format on + +inline InstanceData& GetData(VkInstance instance) { + return driver::GetData(instance).opaque_api_data; +} + +inline InstanceData& GetData(VkPhysicalDevice physical_dev) { + return driver::GetData(physical_dev).opaque_api_data; +} + +inline DeviceData& GetData(VkDevice dev) { + return driver::GetData(dev).opaque_api_data; +} + +inline DeviceData& GetData(VkQueue queue) { + return driver::GetData(queue).opaque_api_data; +} + +inline DeviceData& GetData(VkCommandBuffer cmd) { + return driver::GetData(cmd).opaque_api_data; +} + +} // namespace api +} // namespace vulkan + +#endif // LIBVULKAN_API_H |