layers_extensions.h revision 83506d84d00bbb35ecebb44261b2139bc40ef3e2
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); 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}; 48 49void DiscoverLayers(); 50uint32_t EnumerateInstanceLayers(uint32_t count, VkLayerProperties* properties); 51uint32_t EnumerateDeviceLayers(uint32_t count, VkLayerProperties* properties); 52void GetInstanceLayerExtensions(const char* name, 53 const VkExtensionProperties** properties, 54 uint32_t* count); 55void GetDeviceLayerExtensions(const char* name, 56 const VkExtensionProperties** properties, 57 uint32_t* count); 58LayerRef GetInstanceLayerRef(const char* name); 59LayerRef GetDeviceLayerRef(const char* name); 60 61} // namespace api 62} // namespace vulkan 63 64#endif // LIBVULKAN_LAYERS_EXTENSIONS_H 65