layers_extensions.h revision 25700b452535ce7ae838bfe832392b46ed555ed2
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
22namespace vulkan {
23namespace api {
24
25struct Layer;
26
27class LayerRef {
28   public:
29    LayerRef(const Layer* layer, bool is_instance);
30    LayerRef(LayerRef&& other);
31    ~LayerRef();
32    LayerRef(const LayerRef&) = delete;
33    LayerRef& operator=(const LayerRef&) = delete;
34
35    const char* GetName() const;
36    uint32_t GetSpecVersion() const;
37
38    // provides bool-like behavior
39    operator const Layer*() const { return layer_; }
40
41    PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const;
42    PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const;
43
44    bool SupportsExtension(const char* name) const;
45
46   private:
47    const Layer* layer_;
48    bool is_instance_;
49};
50
51void DiscoverLayers();
52
53uint32_t GetLayerCount();
54const Layer& GetLayer(uint32_t index);
55
56const VkLayerProperties& GetLayerProperties(const Layer& layer);
57bool IsLayerGlobal(const Layer& layer);
58
59void GetInstanceLayerExtensions(const char* name,
60                                const VkExtensionProperties** properties,
61                                uint32_t* count);
62void GetDeviceLayerExtensions(const char* name,
63                              const VkExtensionProperties** properties,
64                              uint32_t* count);
65LayerRef GetInstanceLayerRef(const char* name);
66LayerRef GetDeviceLayerRef(const char* name);
67
68}  // namespace api
69}  // namespace vulkan
70
71#endif  // LIBVULKAN_LAYERS_EXTENSIONS_H
72