blob: 9e2ff5bb51abf744461918636ceafc27018f53df [file] [log] [blame]
Chia-I Wuc96880f2016-03-26 06:56:45 +08001/*
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;
Chia-I Wu25700b42016-04-28 06:36:09 +080026
Chia-I Wuc96880f2016-03-26 06:56:45 +080027class LayerRef {
28 public:
Chih-Hung Hsiehd56988d2016-09-01 11:37:47 -070029 explicit LayerRef(const Layer* layer);
Chih-Hung Hsieh5bc849f2018-09-25 14:21:50 -070030 LayerRef(LayerRef&& other) noexcept;
Chia-I Wuc96880f2016-03-26 06:56:45 +080031 ~LayerRef();
32 LayerRef(const LayerRef&) = delete;
33 LayerRef& operator=(const LayerRef&) = delete;
34
Chia-I Wuc96880f2016-03-26 06:56:45 +080035 // provides bool-like behavior
Chih-Hung Hsieh75067a72018-12-20 15:54:30 -080036 // NOLINTNEXTLINE(google-explicit-constructor)
Chia-I Wuc96880f2016-03-26 06:56:45 +080037 operator const Layer*() const { return layer_; }
38
39 PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const;
40 PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const;
41
Chia-I Wuc96880f2016-03-26 06:56:45 +080042 private:
Chia-I Wu83506d82016-04-19 11:45:57 +080043 const Layer* layer_;
Chia-I Wuc96880f2016-03-26 06:56:45 +080044};
45
46void DiscoverLayers();
Chia-I Wu25700b42016-04-28 06:36:09 +080047
48uint32_t GetLayerCount();
49const Layer& GetLayer(uint32_t index);
Chia-I Wu04c65512016-04-27 09:54:02 +080050const Layer* FindLayer(const char* name);
Chia-I Wu25700b42016-04-28 06:36:09 +080051
52const VkLayerProperties& GetLayerProperties(const Layer& layer);
53bool IsLayerGlobal(const Layer& layer);
Chia-I Wu04c65512016-04-27 09:54:02 +080054const VkExtensionProperties* GetLayerInstanceExtensions(const Layer& layer,
55 uint32_t& count);
56const VkExtensionProperties* GetLayerDeviceExtensions(const Layer& layer,
57 uint32_t& count);
Chia-I Wu25700b42016-04-28 06:36:09 +080058
Chia-I Wudab25652016-04-28 07:15:51 +080059const VkExtensionProperties* FindLayerInstanceExtension(const Layer& layer,
60 const char* name);
61const VkExtensionProperties* FindLayerDeviceExtension(const Layer& layer,
62 const char* name);
63
64LayerRef GetLayerRef(const Layer& layer);
Chia-I Wuc96880f2016-03-26 06:56:45 +080065
66} // namespace api
67} // namespace vulkan
68
69#endif // LIBVULKAN_LAYERS_EXTENSIONS_H