xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/egl/ImageEGL.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2018 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 // ImageEGL.h: Defines the rx::ImageEGL class, the EGL implementation of EGL images
8 
9 #ifndef LIBANGLE_RENDERER_GL_EGL_IMAGEEGL_H_
10 #define LIBANGLE_RENDERER_GL_EGL_IMAGEEGL_H_
11 
12 #include "libANGLE/renderer/gl/ImageGL.h"
13 
14 namespace egl
15 {
16 class AttributeMap;
17 }
18 
19 namespace rx
20 {
21 
22 class FunctionsEGL;
23 
24 class ImageEGL final : public ImageGL
25 {
26   public:
27     ImageEGL(const egl::ImageState &state,
28              const gl::Context *context,
29              EGLenum target,
30              const egl::AttributeMap &attribs,
31              const FunctionsEGL *egl);
32     ~ImageEGL() override;
33 
34     egl::Error initialize(const egl::Display *display) override;
35 
36     angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) override;
37 
38     angle::Result setTexture2D(const gl::Context *context,
39                                gl::TextureType type,
40                                TextureGL *texture,
41                                GLenum *outInternalFormat) override;
42     angle::Result setRenderbufferStorage(const gl::Context *context,
43                                          RenderbufferGL *renderbuffer,
44                                          GLenum *outInternalFormat) override;
45 
46   private:
47     const FunctionsEGL *mEGL;
48 
49     // State needed for initialization
50     EGLContext mContext;
51     EGLenum mTarget;
52     bool mPreserveImage;
53 
54     GLenum mNativeInternalFormat;
55 
56     EGLImage mImage;
57 };
58 
59 }  // namespace rx
60 
61 #endif  // LIBANGLE_RENDERER_GL_EGL_IMAGEEGL_H_
62