1 // Copyright 2013 The Flutter Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_VULKAN_H_ 6 #define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_VULKAN_H_ 7 8 #include <jni.h> 9 #include <memory> 10 #include "flutter/fml/macros.h" 11 #include "flutter/shell/platform/android/android_native_window.h" 12 #include "flutter/shell/platform/android/android_surface.h" 13 #include "flutter/vulkan/vulkan_window.h" 14 15 namespace flutter { 16 17 class AndroidSurfaceVulkan : public AndroidSurface { 18 public: 19 AndroidSurfaceVulkan(); 20 21 ~AndroidSurfaceVulkan() override; 22 23 // |AndroidSurface| 24 bool IsValid() const override; 25 26 // |AndroidSurface| 27 std::unique_ptr<Surface> CreateGPUSurface() override; 28 29 // |AndroidSurface| 30 void TeardownOnScreenContext() override; 31 32 // |AndroidSurface| 33 bool OnScreenSurfaceResize(const SkISize& size) const override; 34 35 // |AndroidSurface| 36 bool ResourceContextMakeCurrent() override; 37 38 // |AndroidSurface| 39 bool ResourceContextClearCurrent() override; 40 41 // |AndroidSurface| 42 bool SetNativeWindow(fml::RefPtr<AndroidNativeWindow> window) override; 43 44 private: 45 fml::RefPtr<vulkan::VulkanProcTable> proc_table_; 46 fml::RefPtr<AndroidNativeWindow> native_window_; 47 48 FML_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceVulkan); 49 }; 50 51 } // namespace flutter 52 53 #endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_VULKAN_H_ 54