// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_VULKAN_VULKAN_APPLICATION_H_ #define FLUTTER_VULKAN_VULKAN_APPLICATION_H_ #include #include #include #include "flutter/fml/macros.h" #include "flutter/vulkan/vulkan_debug_report.h" #include "flutter/vulkan/vulkan_handle.h" namespace vulkan { static const int kGrCacheMaxCount = 8192; static const size_t kGrCacheMaxByteSize = 512 * (1 << 20); class VulkanDevice; class VulkanProcTable; /// Applications using Vulkan acquire a VulkanApplication that attempts to /// create a VkInstance (with debug reporting optionally enabled). class VulkanApplication { public: VulkanApplication(VulkanProcTable& vk, const std::string& application_name, std::vector enabled_extensions, uint32_t application_version = VK_MAKE_VERSION(1, 0, 0), uint32_t api_version = VK_MAKE_VERSION(1, 0, 0)); ~VulkanApplication(); bool IsValid() const; uint32_t GetAPIVersion() const; const VulkanHandle& GetInstance() const; void ReleaseInstanceOwnership(); std::unique_ptr AcquireFirstCompatibleLogicalDevice() const; private: VulkanProcTable& vk; VulkanHandle instance_; uint32_t api_version_; std::unique_ptr debug_report_; bool valid_; std::vector GetPhysicalDevices() const; std::vector GetSupportedInstanceExtensions( const VulkanProcTable& vk) const; bool ExtensionSupported( const std::vector& supported_extensions, std::string extension_name); FML_DISALLOW_COPY_AND_ASSIGN(VulkanApplication); }; } // namespace vulkan #endif // FLUTTER_VULKAN_VULKAN_APPLICATION_H_