Flutter Impeller
android_hardware_buffer_texture_source_vk.h
Go to the documentation of this file.
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 #pragma once
6 
7 #include "flutter/fml/build_config.h"
8 #include "vulkan/vulkan_core.h"
9 
10 #ifdef FML_OS_ANDROID
11 
12 #include "flutter/fml/macros.h"
13 #include "impeller/geometry/size.h"
17 
18 #include <android/hardware_buffer.h>
19 #include <android/hardware_buffer_jni.h>
20 
21 namespace impeller {
22 
23 class AndroidHardwareBufferTextureSourceVK final : public TextureSourceVK {
24  public:
25  AndroidHardwareBufferTextureSourceVK(
26  TextureDescriptor desc,
27  const vk::Device& device,
28  struct AHardwareBuffer* hardware_buffer,
29  const AHardwareBuffer_Desc& hardware_buffer_desc);
30 
31  // |TextureSourceVK|
32  ~AndroidHardwareBufferTextureSourceVK() override;
33 
34  // |TextureSourceVK|
35  vk::Image GetImage() const override;
36 
37  // |TextureSourceVK|
38  vk::ImageView GetImageView() const override;
39 
40  bool IsValid() const;
41 
42  private:
43  const vk::Device& device_;
44  vk::Image image_ = VK_NULL_HANDLE;
45  vk::UniqueImageView image_view_ = {};
46  vk::DeviceMemory device_memory_ = VK_NULL_HANDLE;
47 
48  bool is_valid_ = false;
49 
50  FML_DISALLOW_COPY_AND_ASSIGN(AndroidHardwareBufferTextureSourceVK);
51 };
52 
53 } // namespace impeller
54 
55 #endif
texture_source_vk.h
formats_vk.h
vk.h
impeller
Definition: aiks_context.cc:10
size.h