• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // HardwareBufferImageSiblingVkAndroid.h: Defines the HardwareBufferImageSiblingVkAndroid to wrap
8 // EGL images created from AHardwareBuffer objects
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_ANDROID_HARDWAREBUFFERIMAGESIBLINGVKANDROID_H_
11 #define LIBANGLE_RENDERER_VULKAN_ANDROID_HARDWAREBUFFERIMAGESIBLINGVKANDROID_H_
12 
13 #include "libANGLE/renderer/vulkan/ImageVk.h"
14 
15 namespace rx
16 {
17 
18 class HardwareBufferImageSiblingVkAndroid : public ExternalImageSiblingVk
19 {
20   public:
21     HardwareBufferImageSiblingVkAndroid(EGLClientBuffer buffer);
22     ~HardwareBufferImageSiblingVkAndroid() override;
23 
24     static egl::Error ValidateHardwareBuffer(RendererVk *renderer, EGLClientBuffer buffer);
25 
26     egl::Error initialize(const egl::Display *display) override;
27     void onDestroy(const egl::Display *display) override;
28 
29     // ExternalImageSiblingImpl interface
30     gl::Format getFormat() const override;
31     bool isRenderable(const gl::Context *context) const override;
32     bool isTexturable(const gl::Context *context) const override;
33     bool isYUV() const override;
34     gl::Extents getSize() const override;
35     size_t getSamples() const override;
36 
37     // ExternalImageSiblingVk interface
38     vk::ImageHelper *getImage() const override;
39 
40     void release(RendererVk *renderer) override;
41 
42   private:
43     angle::Result initImpl(DisplayVk *displayVk);
44 
45     EGLClientBuffer mBuffer;
46     gl::Extents mSize;
47     gl::Format mFormat;
48 
49     bool mRenderable;
50     bool mTextureable;
51     bool mYUV;
52     size_t mSamples;
53 
54     vk::ImageHelper *mImage;
55 };
56 
57 }  // namespace rx
58 
59 #endif  // LIBANGLE_RENDERER_VULKAN_ANDROID_HARDWAREBUFFERIMAGESIBLINGVKANDROID_H_
60