Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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_LAYERS_EXTENSIONS_H |
| 18 | #define LIBVULKAN_LAYERS_EXTENSIONS_H 1 |
| 19 | |
| 20 | #include <vulkan/vulkan.h> |
| 21 | |
| 22 | namespace vulkan { |
| 23 | namespace api { |
| 24 | |
| 25 | struct Layer; |
| 26 | class LayerRef { |
| 27 | public: |
| 28 | LayerRef(Layer* layer); |
| 29 | LayerRef(LayerRef&& other); |
| 30 | ~LayerRef(); |
| 31 | LayerRef(const LayerRef&) = delete; |
| 32 | LayerRef& operator=(const LayerRef&) = delete; |
| 33 | |
| 34 | const char* GetName() const; |
| 35 | uint32_t GetSpecVersion(); |
| 36 | |
| 37 | // provides bool-like behavior |
| 38 | operator const Layer*() const { return layer_; } |
| 39 | |
| 40 | PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const; |
| 41 | PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const; |
| 42 | |
| 43 | bool SupportsExtension(const char* name) const; |
| 44 | |
| 45 | private: |
| 46 | Layer* layer_; |
| 47 | }; |
| 48 | |
| 49 | void DiscoverLayers(); |
| 50 | uint32_t EnumerateInstanceLayers(uint32_t count, VkLayerProperties* properties); |
| 51 | uint32_t EnumerateDeviceLayers(uint32_t count, VkLayerProperties* properties); |
| 52 | void GetInstanceLayerExtensions(const char* name, |
| 53 | const VkExtensionProperties** properties, |
| 54 | uint32_t* count); |
| 55 | void GetDeviceLayerExtensions(const char* name, |
| 56 | const VkExtensionProperties** properties, |
| 57 | uint32_t* count); |
| 58 | LayerRef GetInstanceLayerRef(const char* name); |
| 59 | LayerRef GetDeviceLayerRef(const char* name); |
| 60 | |
| 61 | } // namespace api |
| 62 | } // namespace vulkan |
| 63 | |
| 64 | #endif // LIBVULKAN_LAYERS_EXTENSIONS_H |