| 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; | 
| Chia-I Wu | 25700b4 | 2016-04-28 06:36:09 +0800 | [diff] [blame] | 26 |  | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 27 | class LayerRef { | 
 | 28 |    public: | 
| Chih-Hung Hsieh | d56988d | 2016-09-01 11:37:47 -0700 | [diff] [blame] | 29 |     explicit LayerRef(const Layer* layer); | 
| Chih-Hung Hsieh | 5bc849f | 2018-09-25 14:21:50 -0700 | [diff] [blame] | 30 |     LayerRef(LayerRef&& other) noexcept; | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 31 |     ~LayerRef(); | 
 | 32 |     LayerRef(const LayerRef&) = delete; | 
 | 33 |     LayerRef& operator=(const LayerRef&) = delete; | 
 | 34 |  | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 35 |     // provides bool-like behavior | 
| Chih-Hung Hsieh | 75067a7 | 2018-12-20 15:54:30 -0800 | [diff] [blame] | 36 |     // NOLINTNEXTLINE(google-explicit-constructor) | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 37 |     operator const Layer*() const { return layer_; } | 
 | 38 |  | 
 | 39 |     PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const; | 
 | 40 |     PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const; | 
 | 41 |  | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 42 |    private: | 
| Chia-I Wu | 83506d8 | 2016-04-19 11:45:57 +0800 | [diff] [blame] | 43 |     const Layer* layer_; | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 44 | }; | 
 | 45 |  | 
 | 46 | void DiscoverLayers(); | 
| Chia-I Wu | 25700b4 | 2016-04-28 06:36:09 +0800 | [diff] [blame] | 47 |  | 
 | 48 | uint32_t GetLayerCount(); | 
 | 49 | const Layer& GetLayer(uint32_t index); | 
| Chia-I Wu | 04c6551 | 2016-04-27 09:54:02 +0800 | [diff] [blame] | 50 | const Layer* FindLayer(const char* name); | 
| Chia-I Wu | 25700b4 | 2016-04-28 06:36:09 +0800 | [diff] [blame] | 51 |  | 
 | 52 | const VkLayerProperties& GetLayerProperties(const Layer& layer); | 
 | 53 | bool IsLayerGlobal(const Layer& layer); | 
| Chia-I Wu | 04c6551 | 2016-04-27 09:54:02 +0800 | [diff] [blame] | 54 | const VkExtensionProperties* GetLayerInstanceExtensions(const Layer& layer, | 
 | 55 |                                                         uint32_t& count); | 
 | 56 | const VkExtensionProperties* GetLayerDeviceExtensions(const Layer& layer, | 
 | 57 |                                                       uint32_t& count); | 
| Chia-I Wu | 25700b4 | 2016-04-28 06:36:09 +0800 | [diff] [blame] | 58 |  | 
| Chia-I Wu | dab2565 | 2016-04-28 07:15:51 +0800 | [diff] [blame] | 59 | const VkExtensionProperties* FindLayerInstanceExtension(const Layer& layer, | 
 | 60 |                                                         const char* name); | 
 | 61 | const VkExtensionProperties* FindLayerDeviceExtension(const Layer& layer, | 
 | 62 |                                                       const char* name); | 
 | 63 |  | 
 | 64 | LayerRef GetLayerRef(const Layer& layer); | 
| Chia-I Wu | c96880f | 2016-03-26 06:56:45 +0800 | [diff] [blame] | 65 |  | 
 | 66 | }  // namespace api | 
 | 67 | }  // namespace vulkan | 
 | 68 |  | 
 | 69 | #endif  // LIBVULKAN_LAYERS_EXTENSIONS_H |