1 //
2 // Copyright 2015 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 // ImageImpl.h: Defines the rx::ImageImpl class representing the EGLimage object.
8 
9 #ifndef LIBANGLE_RENDERER_IMAGEIMPL_H_
10 #define LIBANGLE_RENDERER_IMAGEIMPL_H_
11 
12 #include "common/angleutils.h"
13 #include "libANGLE/Error.h"
14 #include "libANGLE/formatutils.h"
15 #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h"
16 
17 namespace gl
18 {
19 class Context;
20 }  // namespace gl
21 
22 namespace egl
23 {
24 class Display;
25 class ImageSibling;
26 struct ImageState;
27 }  // namespace egl
28 
29 namespace rx
30 {
31 class ExternalImageSiblingImpl : public FramebufferAttachmentObjectImpl
32 {
33   public:
~ExternalImageSiblingImpl()34     ~ExternalImageSiblingImpl() override {}
35 
36     virtual egl::Error initialize(const egl::Display *display) = 0;
onDestroy(const egl::Display * display)37     virtual void onDestroy(const egl::Display *display) {}
38 
39     virtual gl::Format getFormat() const                        = 0;
40     virtual bool isRenderable(const gl::Context *context) const = 0;
41     virtual bool isTexturable(const gl::Context *context) const = 0;
42     virtual gl::Extents getSize() const                         = 0;
43     virtual size_t getSamples() const                           = 0;
44 };
45 
46 class ImageImpl : angle::NonCopyable
47 {
48   public:
ImageImpl(const egl::ImageState & state)49     ImageImpl(const egl::ImageState &state) : mState(state) {}
~ImageImpl()50     virtual ~ImageImpl() {}
onDestroy(const egl::Display * display)51     virtual void onDestroy(const egl::Display *display) {}
52 
53     virtual egl::Error initialize(const egl::Display *display) = 0;
54 
55     virtual angle::Result orphan(const gl::Context *context, egl::ImageSibling *sibling) = 0;
56 
57   protected:
58     const egl::ImageState &mState;
59 };
60 }  // namespace rx
61 
62 #endif  // LIBANGLE_RENDERER_IMAGEIMPL_H_
63