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