layers_extensions.h revision bea09db9c2165f06771f3a3da423f4f85ac6347e
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;
26class LayerRef {
27   public:
28    LayerRef(const Layer* layer, bool is_instance);
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() const;
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    const Layer* layer_;
47    bool is_instance_;
48};
49
50void DiscoverLayers();
51uint32_t EnumerateInstanceLayers(uint32_t count, VkLayerProperties* properties);
52uint32_t EnumerateDeviceLayers(uint32_t count, VkLayerProperties* properties);
53void GetInstanceLayerExtensions(const char* name,
54                                const VkExtensionProperties** properties,
55                                uint32_t* count);
56void GetDeviceLayerExtensions(const char* name,
57                              const VkExtensionProperties** properties,
58                              uint32_t* count);
59LayerRef GetInstanceLayerRef(const char* name);
60LayerRef GetDeviceLayerRef(const char* name);
61
62}  // namespace api
63}  // namespace vulkan
64
65#endif  // LIBVULKAN_LAYERS_EXTENSIONS_H
66