blob: 32e1a67c15f2cdd34564032685a712fbb63ced3d [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:
Chia-I Wubea09db2016-04-22 09:42:41 +080029 LayerRef(const Layer* layer, bool is_instance);
Chia-I Wuc96880f2016-03-26 06:56:45 +080030 LayerRef(LayerRef&& other);
31 ~LayerRef();
32 LayerRef(const LayerRef&) = delete;
33 LayerRef& operator=(const LayerRef&) = delete;
34
35 const char* GetName() const;
Chia-I Wu83506d82016-04-19 11:45:57 +080036 uint32_t GetSpecVersion() const;
Chia-I Wuc96880f2016-03-26 06:56:45 +080037
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:
Chia-I Wu83506d82016-04-19 11:45:57 +080047 const Layer* layer_;
Chia-I Wubea09db2016-04-22 09:42:41 +080048 bool is_instance_;
Chia-I Wuc96880f2016-03-26 06:56:45 +080049};
50
51void DiscoverLayers();
Chia-I Wu25700b42016-04-28 06:36:09 +080052
53uint32_t GetLayerCount();
54const Layer& GetLayer(uint32_t index);
Chia-I Wu04c65512016-04-27 09:54:02 +080055const Layer* FindLayer(const char* name);
Chia-I Wu25700b42016-04-28 06:36:09 +080056
57const VkLayerProperties& GetLayerProperties(const Layer& layer);
58bool IsLayerGlobal(const Layer& layer);
Chia-I Wu04c65512016-04-27 09:54:02 +080059const VkExtensionProperties* GetLayerInstanceExtensions(const Layer& layer,
60 uint32_t& count);
61const VkExtensionProperties* GetLayerDeviceExtensions(const Layer& layer,
62 uint32_t& count);
Chia-I Wu25700b42016-04-28 06:36:09 +080063
Chia-I Wud6e6f512016-04-28 07:39:32 +080064LayerRef GetInstanceLayerRef(const Layer& layer);
65LayerRef GetDeviceLayerRef(const Layer& layer);
Chia-I Wuc96880f2016-03-26 06:56:45 +080066
67} // namespace api
68} // namespace vulkan
69
70#endif // LIBVULKAN_LAYERS_EXTENSIONS_H